gizmobench

Maze Generator

Pick a grid from 2 to 100 cells a side and the maze is carved in front of you by a recursive backtracker, with the entrance at the top left, the exit at the bottom right and the solution one button away. Two things here are different from the maze pages this competes with. The seed is visible and typeable, so the same seed at the same size rebuilds the identical maze on any machine and any day, which is what lets a printed worksheet be printed again instead of replaced by a new one. And the loops control is honest about what it changes: with loops off the maze is a spanning tree, so there is exactly one route between any two cells, and turning loops on opens a share of the dead ends into a neighbour, adding passages to the maze already on screen rather than drawing a different one. The drawing is SVG, so it stays sharp at any size, and Copy SVG, Download SVG and Print all give you the same maze, with the solution on it only while the solution is showing.

size not setLoops offSolution hiddenSeed pending

Carving the maze.

grid       20 x 20
algorithm  recursive backtracker

nothing built yet

Grid
x2 to 100 a side
Solution
Cells
none yet

Loops

With loops off the maze is a spanning tree carved by a recursive backtracker: every wrong turn ends in a dead end, and there is exactly one route between any two cells. Turning loops on opens a share of those dead ends into a neighbour, which adds passages to the maze already on screen rather than drawing a new one.

A perfect maze: exactly one route between any two cells, and every wrong turn ends in a dead end
  • Same seed, same mazeseed pending
    a maze has to build before it has a seed
  • Loops offoff
    nothing carved yet
  • Solution hiddenperfect maze
    no route to draw yet
The seed is the maze. A perfect maze: exactly one path between any two cells unless braiding is on. The same seed always produces the same maze, so a printed maze can be regenerated. The entrance is the top left cell and the exit is the bottom right, the solution is drawn through both doors when you show it, and Copy SVG and Download SVG hand you the same walls in black on white, with the solution on them only while it is showing.

Everything runs in this browser: nothing is uploaded, there is no account, and the grid size, seed and loop setting are remembered here so the next session opens where you left it. The Start over button at the top of the page forgets them.

Common questions

Can I get the same maze back later?
Yes, and that is what the seed field is for. The layout is carved from the seed text, so the same seed at the same grid size and the same loop setting rebuilds the identical maze, the identical solution and the identical SVG file. Write the seed down, or leave it in this browser and it will still be there next time. New seed draws a fresh one when you want a different maze at the same size, and a seed can be up to 64 characters of anything you can type, such as a class name or a date.
How big can the maze be?
From 2 to 100 cells a side, in any rectangle you like, so 100 by 100 is 10,000 cells and the largest maze the tool will build. It opens at 20 by 20. A width or height outside that range is refused with a message naming the field and the limit rather than being quietly rounded to something else, and the same goes for a size that is not a whole number. The cap is there because a grid larger than 100 cells a side prints too small to draw a line through.
What does the loops setting do?
With loops off you get a perfect maze: a spanning tree over every cell, exactly one route between any two of them, and every wrong turn ending in a dead end. Some loops opens about a third of those dead ends into a neighbouring cell, and Many loops opens most of them, which turns the maze into a network where several routes reach the same place. The extra passages are carved into the maze already on screen, so the walls you were looking at stay where they are, and the page says how many dead ends were opened.
Where are the entrance and the exit, and how do I see the answer?
The entrance is a gap in the top border above the first cell and the exit is a gap in the bottom border below the last one, so a solver crosses the whole grid. Setting Solution to Shown draws the route through both gaps, and the summary beside the maze says how long it is in cells. With loops off that route is the only one there is. With loops on it is a shortest route, because braiding has joined some routes up, and the page says so instead of claiming the maze still has one answer.
How do I print it, and what does the download contain?
Print opens a sheet of the maze in black on white and hands it to your browser's own print dialog, which is also how you save it as a PDF. The solution is on that sheet only while Solution is set to Shown, so you can print the puzzle, switch the solution on and print the answer on a second sheet. Download SVG saves that same drawing as a standalone SVG file, which stays sharp at any size because it is lines rather than pixels, and Copy SVG puts that same file's text on the clipboard for pasting into a document or a design tool.
Is anything uploaded, and does it remember my settings?
Nothing is uploaded and there is no account: the maze is carved, solved and drawn in this browser. The grid size, the seed and the loop setting are remembered in this browser alone so the next session opens where you left it, and the Start over button at the top of the page forgets them. If storage is blocked, as it is in some private windows, the tool still opens and still draws.

A perfect maze: exactly one path between any two cells unless braiding is on. The same seed always produces the same maze, so a printed maze can be regenerated.