Generator · Print-true

Maze maker

Make a printable maze with its answer key on the next page. Choose the grid, the dead ends, the paper and the margin, then print the maze or save it as a PDF. The route from the entrance to the exit is guaranteed to exist, and the key draws it. The maze is carved in your browser at true page size, with no watermark and no account, and nothing is uploaded.

Adjust

Details
Sheet— Grid— Cell— Pages— Seed—

How this generator works

Everything on the sheet is drawn in millimeters, and the cell size is the measurement 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. Columns and rows each run from 3 to 50, and a number outside that range is brought inside it with a note saying so. Cells are square, so the smaller of the two divisions wins, and the maze is centered in the space that remains. The Details panel below the sheet shows the cell size and the clear width left between two walls once the wall thickness is subtracted. 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 is carved by a randomized depth-first walk over the grid. The walk steps into a random unvisited neighbor and knocks down the wall between the two cells; when there is nowhere new to go, it backs up and tries again. A seeded generator drives it, so a given seed, grid and paper always carve the same maze. The walk keeps its trail on an explicit stack in an array, because the largest grid offered here is 2500 cells and a recursive call stack that deep is not safe to rely on. Since the walk never enters a cell twice, its passages reach every cell without closing a single loop, which makes them a spanning tree of the grid. Breadth-first search then finds the solution in the same array of passages the sheet is drawn from, so the puzzle and the key cannot disagree. 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.

A practiced solver can finish any perfect maze by filling in dead ends: follow each corridor to where it stops, cross it off, and repeat. The braided settings open dead ends to stop that tactic. A braided maze has several routes, and its key draws the shortest, labeled "shortest route" in the corner stamp where a perfect maze says "the only route". Small cells are the other limit. 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 start to fight the paper, so the page warns at 5 mm and shows an error under 3.5 mm. Print at 100% or "Actual size": "Fit to page" rescales the sheet, and the cell size in the readout then no longer matches the paper.

Frequently asked questions

How hard are these mazes, and what makes one harder?
Grid size matters most. The 20 by 24 grid this page opens with holds 480 cells and its route runs through 187 of them; a 10 by 12 grid holds 120 cells and its route runs through 67. The dead-end setting is the second control, and it makes the search harder while the route gets shorter: in that same 20 by 24 maze, opening some of the dead ends cuts the shortest way through to 63 cells and opening most of them cuts it to 59, because a loop is a shortcut. In a perfect maze the dead ends are the only obstacle, so 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 on a braided maze that tactic stops working.
Is there always exactly one way through?
Yes, as long as the dead-end setting stays on "Keep all", the default. That follows from how the maze is built: the carving produces a spanning tree of the grid, and a tree has exactly one simple path between any two cells, so the route on the answer key is the only route through the maze. The braided settings change that. Opening dead ends creates loops and several routes, so the key prints the shortest one and stamps it "shortest route".
Where is the answer key?
On the second page of the printout. It shows the same maze with the walls in gray and the solution drawn from the entrance gap to the exit gap, with the route length printed in the corner. If you are copying class sets and want to hold the key back, untick "Include an answer key" and the maze prints as a single page.
How small can the grid go before it stops printing well?
Cells under 5 mm get a warning, and cells under 3.5 mm get an error message. The cell size comes from your paper, orientation and margin, and the Details panel below the sheet shows it next to the clear width between two walls. On US Letter portrait with the default 12.7 mm margin the printable width is 190.5 mm, so 20 columns give cells of at most 9.53 mm, 30 columns at most 6.35 mm and 40 columns at most 4.76 mm. Ask for enough rows and the height becomes the limit instead. The pen and the hand usually give out before the printer does: walls are drawn between 0.3 and 0.55 mm thick, which a 600 dpi laser resolves several times over.
Is anything uploaded or stored?
No. This page carves, solves and draws the maze, and it prints through your browser's own dialog. Nothing is sent anywhere, there is no account or watermark, and no settings are saved, so the maze is gone when you close the tab. To print the same maze again later, note the seed; entering it with the same grid and paper gives the identical maze. "New maze" picks a random seed between 1 and 999999.

Related tools