Free tool · Runs in your browser
Maze generator: any size, six algorithms, always solvable.
Choose how the maze is carved, how big it is and which seed it grows from. The maze appears at once with its start and exit; switch the solution on to see the shortest way through. Print it, or download it as a PNG, a clean SVG or JSON a game can load. No account, nothing uploaded.
- 6 algorithms
- Up to 80 × 80
- Solution on or off
- PNG · SVG · JSON · Print
What is a maze generator?
A maze generator is a tool that builds a maze automatically. It starts from a grid in which every cell is walled off and removes walls by a rule until all cells are connected. This one offers six such rules, from recursive backtracker to Wilson's algorithm, at any size from 2 × 2 to 80 × 80 cells, and can draw the shortest path from start to exit.
How to make a maze
Pick an algorithm
Start with Recursive backtracker for the classic look: long corridors that wind around. Try Prim or Kruskal for a maze full of short branches.
Set the size
Width and height are counted in cells. 10 × 10 suits a young child, 20 × 20 a quick puzzle, 40 × 40 and up a real challenge on a printed page.
Choose a seed
Press New maze until you like one. The seed in the box is all you need to get this exact maze back later.
Check the solution
Tick Show the solution to draw the shortest path. Leave it off to export the puzzle and on to export the answer key.
Print or export
Print puts the maze alone on a page. PNG is a picture, SVG stays sharp at any size, and JSON holds the walls, a tile grid and the solution for a game.
Maze generation algorithms compared
All six make a perfect maze, one with exactly one route between any two cells. They differ in how that maze feels.
| Algorithm | How it works | What the maze looks like | Good for |
|---|---|---|---|
| Recursive backtracker | A depth-first walk: move to a random unvisited neighbour, back up when stuck | Long, winding corridors, few dead ends, a long solution | Mazes meant to be explored, game levels |
| Prim | Grow from one cell, each time opening a random wall on the edge of the maze so far | Many short dead ends radiating outward, a short solution | Easier puzzles, a busy texture |
| Kruskal | Shuffle all walls and remove each one that joins two regions not yet connected | Even texture, short branches everywhere | A maze with no obvious centre |
| Wilson | Random walks from unvisited cells, with any loop the walk makes erased, until they hit the maze | No bias at all: every possible maze is equally likely | Fair, unpredictable mazes |
| Sidewinder | Row by row: join cells into runs eastward, open one cell of each run to the north | One open corridor along the top, paths that always lead up | Fast generation, vertical levels |
| Binary tree | Every cell opens either north or east | A strong diagonal lean, open corridors on two edges | The simplest algorithm to learn from |
Recursive backtracker is also called randomized depth-first search. Wilson is the slowest of the six on large grids, and still instant at 80 × 80.
Perfect mazes, loops and dead ends
A perfect maze has no loops and no closed-off areas: between any two cells there is exactly one path. In graph terms it is a spanning tree of the grid, which is why a perfect maze of 400 cells always has exactly 399 openings between cells. The status line under the maze says when it is perfect.
Perfect mazes suit pencil-and-paper puzzles because there is a single right answer. Games often want something else. A maze where an enemy chases the player needs loops, or the player is trapped in the first dead end. The Loops slider opens that share of dead ends into a neighbouring corridor; at 100% the maze has no dead ends left at all.
The solution is found by breadth-first search from the start to the exit, so it is always the shortest route, also in a maze with loops.
Export formats
| Format | What is inside | Use it for |
|---|---|---|
| The maze alone on a page, black walls on white, scaled to fit | Worksheets, activity books, a rainy afternoon | |
| PNG | The preview as a picture, with start and exit marked | Documents, slides, sharing |
| SVG | The walls as one vector path, plus the solution when it is switched on | Large prints, laser cutting, editing in a vector program |
| JSON | Per cell, which walls stand (north 1, east 2, south 4, west 8); a tile grid of 1 for wall and 0 for floor; start, exit and the solution | Loading the maze in a game or a script |
The tile grid is (2 × width + 1) by (2 × height + 1): cells sit on odd coordinates and the walls between them on even ones, the layout most tile engines expect.
Tips for printable mazes
- Match the size to the solver: about 10 × 10 for ages 4 to 6, 15 × 15 to 20 × 20 for ages 7 to 10, larger for adults
- Print the puzzle with the solution off, then the same seed with it on as the answer sheet
- Use a page shape close to the maze's: a wide maze prints larger in landscape
- Recursive backtracker gives the longest route, so it is the hardest at any size
- Write the seed on the back so you can reprint the same maze
Frequently asked questions
Is the maze generator free?
Yes. There is no sign-up, no watermark and no limit on mazes, downloads or prints. The maze is computed in your browser and nothing is uploaded.
Can every maze be solved?
Yes. All six algorithms connect every cell, so there is always a path from the start to the exit. With Loops at 0 there is exactly one. The page finds the shortest path with a breadth-first search and can draw it.
How do I print a maze?
Press Print. The maze opens in your browser's print dialog on its own page, without the rest of the site. Tick Show the solution first if you want the answer key, and print both from the same seed.
Which maze algorithm is the hardest?
Recursive backtracker usually is. Its corridors are long and its solution winds through much of the grid, so wrong turns cost more. Prim and Kruskal have many short dead ends that are quick to rule out.
What is the biggest maze I can make?
80 × 80 cells, which is 6,400 cells. That is generated at once. For print, mazes over about 50 × 50 need a large page to stay readable.
Can I use the mazes commercially?
Yes. Use them in books, worksheets, games and apps. The mazes come from standard, public algorithms and the files carry no licence terms.
How do I use the JSON in a game?
Read the grid: 1 is a wall tile and 0 is floor, with the start at the top-left floor tile and the exit at the bottom-right one. If your game uses thin walls instead, read the walls array, where each number is a bit mask of the walls around a cell.
What does the seed do?
It fixes the random choices. The same seed with the same size, algorithm and loops setting always gives the same maze, so you can save a maze as a few numbers or send it to someone else.
EvonX AI game maker
Got the asset? Now make the game.
Describe your game in one sentence and EvonX builds it: code, art, sound and a link you can share. Free to start, no download, plays on any phone.