UtilityBase logoUtilityBase

Generators

Maze Generator

Printable perfect mazes in three sizes — with a solution toggle.

Updated July 10, 2026

How to use the maze generator

  1. 1Pick a size — easy, medium, or hard.
  2. 2Regenerate until the maze looks right.
  3. 3Toggle the solution to check it (screenshot for an answer key).
  4. 4Download the PNG — it always exports the unsolved puzzle.

Common uses

  • Printable activities for kids, classrooms, and rainy days
  • Restaurant-wait and road-trip entertainment
  • Party and puzzle-book page material
  • Demonstrating maze algorithms and the wall-follower rule

Frequently asked questions

What makes a maze 'perfect', and why does it matter?

A perfect maze has exactly one path between any two points — no loops, no isolated sections — which is the mathematical guarantee behind two things you care about: every maze here is solvable, and every maze has exactly one solution (no accidental shortcuts that deflate the puzzle). Structurally it's a spanning tree of the grid. The recursive backtracker that carves these also tends to produce long, winding corridors rather than short choppy ones, which players experience as more satisfying.

Does the hand-on-the-wall trick really work?

On these mazes, guaranteed — pick a wall at the entrance, keep one hand on it, and you will reach the exit (possibly the long way). It works because a perfect maze's walls are all connected to the outer boundary; the trick fails only in mazes with loops, where an interior wall island can trap you circling forever. So it's a real algorithm with a real precondition, not folklore. Teaching kids why it works — and then generating a looped maze elsewhere to watch it fail — is a legitimately good math lesson.

Which size should I print for which age?

Rough calibration from the corridor lengths: Easy 12×12 suits roughly ages 4–7 (solvable in a couple minutes, chunky corridors for crayons); Medium 20×20 fits 7–12 and casual adults; Hard 30×30 gives most adults a genuine several-minute fight, especially printed small. Difficulty in perfect mazes scales with dead-end count and path length, both of which grow fast with grid size. For a party or classroom set, print several regenerations of one size so neighbors can't copy.

Why does the download exclude the solution?

Because the printed maze is almost always for someone else to solve — kids, students, puzzle pages — and accidentally handing out spoiled copies is the predictable failure, so the PNG always exports the clean puzzle no matter what the on-screen toggle shows. To keep an answer key: toggle the solution on and screenshot it before printing the batch. The solution path is computed by breadth-first search, so it's provably the one true route, not just a route.

About this tool

The maze generator carves mazes with the recursive backtracker algorithm — a depth-first walk that knocks down walls as it wanders — producing 'perfect' mazes: exactly one path between any two points, no loops, no unreachable pockets. Three difficulty sizes (12×12 to 30×30), a solution overlay found by breadth-first search for checking or mercy, and a print-crisp PNG download that always exports the unsolved puzzle regardless of what's on screen. Endless regeneration, all on your device — hit new-maze until one looks pleasingly evil.

Like most tools on UtilityBase, the maze generator runs entirely in your browser — nothing you enter is uploaded or stored on a server. It's free to use with no account required. Browse more generators here.

Was this tool helpful?

Related tools