What a “perfect maze” is, and why the answer key depends on it
Most disappointing printable mazes fail in one of two ways. Either a region of the grid is walled off entirely, so no route exists, or the puzzle has several equally valid routes, which makes an “official” answer sheet arbitrary. Both failures come from the same source: walls placed at random and then checked afterwards, if at all.
This generator carves instead of placing. Starting from the top-left cell, it walks to a random unvisited neighbour, knocking down the wall between the two, and backtracks whenever it runs out of unvisited neighbours. That is the recursive backtracker, and what it produces is a spanning tree over the grid: every cell reachable, exactly rows * cols - 1 walls removed, no loops anywhere. A tree has one and only one simple path between any two of its nodes, which is why a maze built this way is solvable and has a single solution by construction rather than by inspection.
We did not take that on trust. The tests count the removed passages, run a breadth-first sweep to confirm every cell is reachable, and on small grids exhaustively enumerate every simple path between the two corners, asserting the count is exactly one. There is also a negative control that deliberately opens one extra passage to create a cycle and confirms the path count then climbs above one, so the check is proving something rather than passing vacuously.
Picking a grid size a pencil can actually follow
The difficulty selector is not a different algorithm at each setting, only a bigger grid: Easy is 10x10, Medium is 16x16, Hard is 22x22. Custom lets you set rows and columns separately, each between 5 and 40.
The number worth thinking about is the printed cell size. On A4 the page is 595 by 842 points, and the layout reserves a 40 point margin all round plus a 40 point strip for the title, leaving roughly 515 by 722 points for the grid. Cells are always square, sized by whichever axis is tighter. So a 22x22 hard maze gets cells of about 23 points, near 8 mm, which a pencil handles comfortably. Push Custom to 40x40 and cells fall to roughly 13 points, about 4.5 mm, where a pencil line starts to smear across two corridors and a fine-tip pen is a better idea.
For a class of seven to twelve year olds, Medium is the setting we would pick. Save the 40x40 grids for a wall poster or for someone who genuinely wants a ten minute puzzle.
From preview to printer
- Pick a Difficulty, or choose Custom and enter your own Rows and Columns.
- Set Paper size to A4 or Letter, matching whatever your printer is loaded with.
- Click Generate maze. The maze appears immediately as an SVG preview, sized so that even a 40x40 grid still fits the page column.
- Tick Show solution to overlay the route, or click Generate a new maze as many times as you like until you get one you like the look of.
- Click Download PDF. The file is built from the exact maze in the preview, so nothing changes between the screen and the page.
What actually lands in the two-page PDF
Page one is titled “Maze” and carries the grid with a break cut into the top-left cell’s outer left wall and another in the bottom-right cell’s outer right wall, labelled START and FINISH in the margin beside each. Those breaks only ever touch a boundary wall, which is why cutting them cannot disturb the connectivity proof above: that proof is only ever about walls between two real cells.
Page two is titled “Answer key” and redraws the identical walls with the unique solution traced through the cell centres as a red line. Same grid geometry, same cell positions, so you can hold the two pages up to the light and they align. The file is named after the grid, for example maze-22x22.pdf, which makes a folder of them easy to sort later. If you are handing the maze out, print page one only and keep page two for yourself.
The whole document is assembled with pdf-lib in the tab you have open, the same library behind our Printable Calendar and Bingo Card Generator. It shares the page-size constants with the rest of the PDF tools, so an A4 maze is the same 595 by 842 points as an A4 page anywhere else on this site.
Rectangular only, and why we did not fake a round one
There is no circular or hexagonal option here, and that is a deliberate omission rather than an oversight. A polar maze is built from concentric rings divided into sectors, where an outer ring usually holds more cells than the ring inside it, so a cell’s neighbour count is not fixed the way it is in a grid. Carving and solving one means writing the whole adjacency model again in ring and sector terms.
The tempting shortcut is to generate a square maze and crop it to a circle. That looks round and is wrong: the passages it shows are the ones a rectangular grid carved, chopped mid-corridor at the circle’s edge. Rather than ship a maze that misrepresents its own structure, we shipped rectangles properly and left polar geometry as a separate, honestly unbuilt feature. If you want something round to hand a small child in the meantime, the Coloring Page Maker is the better tool for that job.

