Free tool

Maze generator, printed in a click.

Pick a square or a round maze, a size and a way of building it, and a new maze appears. Every maze has exactly one way through, from an entrance to an exit you choose. Show the solution with a switch, see a rating of how hard it is, and use the seed to bring back the same maze later. Save a PDF with a page for each maze and an answer page, or save a PNG or SVG. It all happens in your browser.

Level

Seed

The same seed with the same settings gives the same maze. Type your own, or click New maze for a fresh one.

Look

PDF

The maze is made in your browser. Nothing is uploaded, and only your settings are kept in this browser for next time.

Made to print

One way through, every time.

01 / Perfect

Always solvable

Every cell can be reached and there is exactly one path between any two, so the maze always has one answer.

02 / Seed

Bring it back

The seed and settings rebuild the same maze on any device, and a link can carry them.

03 / Print

A real PDF

Sharp lines, a page for each maze, an answer page for each, on A4 or US Letter.

Guide

How to make a maze, and pick the right level.

A maze generator builds a maze from a few choices: the shape, the size and the way it is carved. This one makes a perfect maze: every cell can be reached and there is exactly one route between any two cells, so there are no loops. It draws the maze as you change a setting, rates how hard it is, shows the solution on a switch and saves a printable PDF with an answer page.

How to use the maze generator

  1. Click a Level (Kids, Easy, Medium, Hard or Expert), or set the size yourself with Columns and Rows. For a round maze, choose Round, in rings under Shape and set Rings.
  2. Choose how it is built under Built by. The three choices below explain what each one feels like.
  3. Pick Entrance and exit: top to bottom, left to right, opposite corners, farthest apart, or random sides. A round maze can run from the outside to the centre, or across the outside between the two openings that are farthest apart.
  4. Tick Show the solution to see the answer path. The Rating card shows how hard the maze is.
  5. Click New maze for another one. The Seed box shows the seed behind the one on screen.
  6. For paper, set a Title, How many mazes, Paper (A4 or US Letter) and whether to add A line for the name and Answer pages at the end. Then click Save PDF. PNG and SVG save the picture on screen, and Copy picture puts it on the clipboard.

The three ways of building a maze

All three start with a grid of cells with every wall in place and take walls down until every cell is joined. They differ in the order they do it, and that decides how the maze feels.

  • Recursive backtracker walks on from cell to cell, always into a cell it has not seen, and backs up when it is stuck. The result has long winding corridors and few branches.
  • Prim grows outward from one cell, opening a random wall on the edge of what is carved. The result has many short branches and dead ends that fan out in every direction.
  • Kruskal takes every wall in random order and removes it whenever the two cells beside it are not yet connected. The result is an even, knotty mix with short dead ends all over.

How the rating works

The rating counts wrong turns on the way from the entrance to the exit: at each cell on the solution, every opening besides the one you came in by and the one you leave by is a chance to go wrong. Fewer than 6 is Very easy, under 14 is Easy, under 32 is Medium, under 64 is Hard, and 64 or more is Very hard. That scale is our own and only a guide.

Here are averages over 60 seeds for 20 by 20 mazes from top to bottom:

Built byWrong turnsSteps to solveDead endsUsually rated
Recursive backtracker12.9110.210.6% of cellsEasy
Prim29.537.632.2% of cellsMedium
Kruskal31.249.230.3% of cellsMedium

The backtracker gives the longest walk but the fewest decisions, so it suits children who like to follow a path. Prim and Kruskal have a shorter way through with many more places to go wrong. Size matters too: at 50 by 50 the backtracker averages about 46 wrong turns and Kruskal about 92.

The seed, and why a perfect maze has cells minus one passages

A maze is a spanning tree of its cells. Joining n cells with no loops and no cell left out takes exactly n minus 1 openings. A 20 by 20 maze has 400 cells and 399 openings. The generator checks that count, that every cell can be reached and that the entrance leads to the exit, on every maze it makes.

The seed is a short piece of text that drives the random choices. The same seed, shape, size, builder and entrance and exit always give the same maze, on any device. Change the size or the builder and the same seed gives a different maze. Copy link puts all the settings and the seed after a # in the address, so whoever opens it sees your maze, and nothing is sent to a server.

Round mazes

A round maze is built in rings. The middle is one cell, the next ring has 6, then 12, and a ring gets more cells as it gets wider so the cells stay about the same shape. Four rings make 43 cells and nine rings make 235. The usual finish is the centre. Across the outside puts two openings on the outer ring instead.

Printing

Save PDF draws the walls as lines, not as a picture, so they stay sharp at any zoom and print cleanly. How many mazes makes that many different mazes from your seed, one to a page, and with Answer pages at the end ticked, each also gets an answer page with the path drawn in. Each page's footer says the level, the size, the builder and the seed, so you can recreate a printed maze later. The PDF uses A4 or US Letter, with your wall colour on white paper whatever background you picked for the picture.

Tips

For a young child, use Kids or Easy with the recursive backtracker and Thick walls. For a puzzle book page, use Farthest apart, which picks the two edge cells with the longest walk between them.

For other printable puzzles, try the word search maker and the crossword puzzle maker.

Questions

Good to know.

Is every maze solvable?

Yes. Each maze is a perfect maze: all cells are joined, with exactly one path between any two. The generator checks this for every maze, and the solution switch shows the path.

How do I make the same maze again?

Use the same seed with the same settings. Type the seed into the Seed box, or open a link made with Copy link, which holds the seed and every setting.

How do I print a maze with the answer?

Keep Answer pages at the end ticked and click Save PDF. Each maze has a page, and each answer page shows the same maze with the path drawn in.

Which way of building is the easiest?

The recursive backtracker gives the fewest wrong turns at a given size. Prim and Kruskal give more branching, so more places to go wrong.

What sizes can I make?

Square mazes from 3 by 3 to 100 by 100 cells, and round mazes from 3 to 40 rings. The Level buttons are shortcuts to common sizes.

Can I choose where the maze starts and ends?

You choose a pattern: top to bottom, left to right, opposite corners, farthest apart or random sides. The exact cell on the edge is picked from the seed, except for corners.

Can I make several different mazes at once?

Yes. Set How many mazes to up to 20. They go into one PDF, one to a page. Use Previous and Next to look at each on screen.

Can children solve it on screen?

This version is made for printing. Save the PDF and let them use a pencil, then check with the answer page.

Is anything uploaded?

No. The maze, the PDF and the PNG are all made in your browser. Only your settings are kept on this device, not the seed.