Skip to content
Shapes and styles

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 .

live tool
● live mazeseed mazeloom
672 cells · 209 dead ends · 0 loops
Shape and size
Paths
Look
Page

How to use the random maze generator, step by step

  1. Pick a shape and a difficulty, or set your own size.
  2. Then choose a carving method under Paths. Unbiased is a good first pick.
  3. Press New maze to roll a fresh seed and a fresh layout.
  4. When one looks right, copy the seed shown above the preview.
  5. 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

Random maze generator methods and their feel
MethodHow the maze feels
Recursive backtrackerlong winding corridors, few branches
Primmany short dead ends near the main paths
Kruskaleven and random looking, no clear direction
Wilsonunbiased, every perfect maze equally likely
Seedletters, digits and dashes, up to 32 characters
built and checked

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.

PNG + PDF with answer key: real output from the random maze generator test
PNG + PDF with answer key, exactly as the tool builds it
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.

questions

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.

Sources and references