Generator · Print-true

Maze maker

A printable maze with a route that is guaranteed to exist, and an answer key on the next page that shows it. Choose the grid, the paper and the margin; the maze is carved in your browser at true page size, with no watermark, no account, and nothing uploaded.

Sheet Grid Cell Pages Seed

How this generator works

Everything on the sheet is a millimeter measurement, and the cell size is the one that matters. The page starts from the physical sheet — 215.9 by 279.4 mm for US Letter, 210 by 297 mm for A4 — takes your margin off all four sides, takes off the title band and the two narrow rows that carry START and FINISH, and divides what is left by the columns and rows you asked for. Cells are square, so the smaller of the two divisions wins and the maze is centred in the space that remains. That number, and the clear width still open between two walls once the wall thickness is subtracted, are both printed in the readout strip above. Nothing is rescaled afterwards: the SVG viewBox is the physical page in millimeters, so a cell that reads 9.52 mm measures 9.52 mm on paper.

The maze itself is carved by a randomised depth-first walk over the grid — step into a random unvisited neighbour, knocking down the wall between the two; when there is nowhere new to go, back up and try again — driven by a seeded generator, so the same seed with the same grid and paper reproduces the same maze permanently. The walk runs on an explicit stack rather than by recursion, because the largest grid offered here is 2500 cells and a call stack that deep is not a thing to depend on. Because the walk never enters a cell twice, the passages it leaves behind form a spanning tree of the grid: every cell reachable, no loops anywhere, and exactly one simple path between any two cells. The solution is then found by breadth-first search over that same array of passages rather than over a second model of the maze, which is the reason the puzzle and the key cannot disagree with each other. The entrance and the exit are gaps cut in the border above the top-left cell and below the bottom-right one, and the drawn route runs out through both of them.

The honest limits. A perfect maze has no loops and exactly one solution, which is what makes an answer key meaningful — and it is also what makes it easier for a practised solver, because dead ends are then the only obstacle, so filling them in (follow each corridor to where it stops, cross it off, repeat) finishes any perfect maze mechanically. The braided settings exist for exactly that reason and they cost you uniqueness: several routes then exist, the key prints the shortest of them, and the sheet stamps itself "shortest route" rather than "the only route" so the two are never mistaken. Second, small cells. At 30 columns on Letter portrait the clear corridor is already down to 5.9 mm, and under 5 mm a felt tip and a young hand begin to fight the paper; the page warns at 5 mm and refuses under 3.5 mm rather than printing something nobody can trace. Third, the one thing no generator can control from outside the print dialog: print at 100% or "Actual size". "Fit to page" rescales the sheet, and then the cell measurement in the readout is not the cell measurement on your desk.

Frequently asked questions

How hard are these mazes, and what makes one harder?
Size is the main lever and an honest one: the 20 by 24 grid this page opens with holds 480 cells and its route runs 187 of them, while a 10 by 12 grid holds 120 and its route runs 67. The dead-end setting is the second lever, and it does not work by making the route longer — open most of the dead ends in that same 20 by 24 maze and the shortest way through drops to 59 cells, because a loop is a shortcut. What it changes is the search. In a perfect maze the dead ends are the only obstacle, so the ordinary tactic of following a corridor until it stops, backing up and crossing that branch off is guaranteed to finish it; backing out of a loop tells you nothing, so that tactic stops working.
Is there always exactly one way through?
With the dead-end setting left on "keep all", yes — and that is a property of how the maze is built rather than a claim made about it. The carving walk never enters a cell twice, so the passages it leaves form a spanning tree of the grid, and a tree has exactly one simple path between any two cells. The route the answer key draws is therefore the route, not a route. Choose one of the braided settings and that stops being true: opening dead ends creates loops, several routes exist, and the key prints the shortest one and stamps itself "shortest route" so the two are never confused.
Where is the answer key?
It is the second page of the printout: the same maze drawn in gray with the solution stroked through it from the entrance gap to the exit gap, and the route length printed in the corner. Untick "Include an answer key" if you are copying class sets and want the key held back — the maze then prints as a single page.
How small can the grid go before it stops printing well?
Cell size is computed from your paper, orientation and margin, and the readout above shows both it and the clear width left between two walls. On US Letter portrait with the default 12.7 mm margin the printable width is 190.5 mm, so 20 columns can give at most 9.53 mm cells, 30 at most 6.35 mm and 40 at most 4.76 mm; ask for enough rows and the height becomes the limit instead. Under 5 mm the page warns you, and under 3.5 mm it refuses to call the result a maze. The printer is rarely what fails first — walls are drawn between 0.3 and 0.55 mm, which a 600 dpi laser resolves several times over — the pen and the hand are.
Is anything uploaded or stored?
No. The maze is carved, solved and drawn by this page, and printed through your browser's own dialog. Nothing is sent anywhere, there is no account or watermark, and no settings are saved — close the tab and it is gone. The seed is the only thing worth writing down: type the same seed back with the same grid and paper and the identical maze comes out.

Related tools