Random maze generator: a fresh maze every click
This random maze generator builds a brand new maze each time you press New maze. A short seed drives the randomness, so you can rebuild any layout later. Choose one of four carving methods for a different feel, then download a 300 DPI PNG and a PDF with the answer key.
By The Mazeloom team (Product and testing). Last updated .
How to use the random maze generator, step by step
- Pick a shape and a difficulty, or set your own size.
- Then choose a carving method under Paths. Unbiased is a good first pick.
- Press New maze to roll a fresh seed and a fresh layout.
- When one looks right, copy the seed shown above the preview.
- Finally, press Download PNG + PDF to save the puzzle and its answer key.
The live preview is always free, and you get one free PNG and PDF export a day. See the pricing page for Pro, $19 once, with clean files and a commercial license, or read how we test every puzzle.
How the random maze generator uses a seed
A computer cannot roll real dice, so it uses a pseudo random number generator instead. This is a small formula that turns one starting value into a long chain of numbers that look random. That starting value is the seed. In our tool, the seed is a short code of letters, digits and dashes, shown above the preview.
First, the engine turns the seed text into a number. Then that number feeds the generator, and every choice the carving method makes comes from the chain. As a result, the same seed with the same settings always gives the same maze, on your screen and in the download.
So the layouts feel random, but none of them are lost. Press New maze, and the tool rolls a fresh seed for you. Type a seed of your own, and you can share it with a friend who wants the very same puzzle.
Four ways to carve a random maze
Randomness alone does not decide how a maze feels. The carving method matters just as much, because each one uses its random choices in a different way. That is why the Paths menu offers four of them.
The recursive backtracker walks forward from cell to cell and only turns back when it gets stuck. For this reason, it makes long winding corridors with few branches. Prim's method, on the other hand, grows the maze from a frontier of cells around the edge of what it has built. So it leaves many short dead ends close to the main paths.
Kruskal's method looks at the walls in a shuffled order and removes each wall that joins two separate areas. The result is even and random looking, with no clear direction. Finally, Wilson's method uses random walks that erase their own loops. It is unbiased, which means every possible perfect maze on that grid is equally likely to appear.
Which method feels the most random?
If you want a puzzle with no hidden pattern, pick Unbiased. Wilson's method draws from all possible mazes in a uniform way, which mathematicians call a uniform spanning tree. Even mix comes close, and it looks very similar on paper.
However, the most random maze is not always the best puzzle. For example, a backtracker maze is easy to recognize, but its long corridors are fun to trace. Meanwhile, a Prim maze has so many short branches that young solvers get stuck often. So try each method with the same size and seed, and compare them before you print.
Random but always solvable
Every layout from the random maze generator is checked before you see it. Each cell can be reached, and a breadth first search finds the shortest route from start to finish. That route becomes the red line on the answer key.
With Loops at 0 and no rooms, the maze is perfect, so there is exactly one route. Raise Loops or add rooms, and extra routes appear. Even then, the answer key still shows the shortest path.
Random maze generator methods and their feel
| Method | How the maze feels |
|---|---|
| Recursive backtracker | long winding corridors, few branches |
| Prim | many short dead ends near the main paths |
| Kruskal | even and random looking, no clear direction |
| Wilson | unbiased, every perfect maze equally likely |
| Seed | letters, digits and dashes, up to 32 characters |
Random maze generator tested with a real run
We built this maze with the same code the tool on this page uses, with this page's settings and a fixed seed. So the image and the numbers below come from that run, not from a mockup.

- Test input
- 24 x 28 grid, seed sample-random-maze-generato
- Output
- PNG + PDF with answer key
- Cells
- 672
- Dead ends
- 199
- Loops
- 0
- Answer length
- 87 cells
- PDF size
- 14 KB
- Build time
- 13 ms
How we check mazes: a solver walks every maze before it is saved, and we open each PDF to check the page, the answer key and the print size. More on the about page.
Random maze generator FAQ
Is every maze really different?
Yes, as long as the seed changes. New maze rolls a fresh seed each time, so the chance of a repeat is tiny.
Can I get the same random maze twice?
Yes. Copy the seed and keep the same settings. Entering that seed again rebuilds the exact same layout.
Which carving method should I pick?
Pick Unbiased for a fair mix, Long winding paths for deep corridors, or Many short dead ends for a busy maze.
Does a random maze always have a solution?
Yes. A solver checks every maze, every cell can be reached, and the answer key shows the shortest route.