Maze generator

Set the number of columns and rows and print a new maze. The entrance is at the top left and the exit at the bottom right. Show the solution path for the answer, and use the seed number to get the same maze again.

The same settings and seed always give the same result. Press the button for a new one.

Runs in your browser: nothing you enter is sent anywhere.

How to use it

  1. Enter the columns and rows (3 to 50).
  2. Press New puzzle for a different maze, or type a seed.
  3. Tick Show the solution path to see the answer, then print.

How it works

The generator keeps a stack of visited cells. From the top cell of the stack it picks a random unvisited neighbour, opens the wall between them and pushes the neighbour. When no neighbour is free it pops the stack. A maze with c columns and r rows always has c × r − 1 open passages.

Example

A 15 by 15 maze has 225 cells and 224 open passages. A 3 by 1 maze is a straight corridor and its solution is the three cells in a row.

Tips

  • Print without the solution for the puzzle and keep the seed to print the answer later.
  • Keep a thick pencil for large mazes; the walls are thin at 50 by 50.

Frequently asked questions

How is the maze made?

With the recursive backtracker: start in a corner, move to a random unvisited neighbour and remove the wall between them, and step back when stuck. This produces a maze where every cell can be reached and there are no loops.

Is there only one route?

Yes. Because the maze has no loops, there is exactly one path between any two cells. The solution is found by a breadth-first search from the entrance.

What size should I choose?

As a rule of thumb, 8 by 8 to 12 by 12 suits young children, 20 by 20 and above suits older students and adults. Larger mazes print with thinner walls on one page.

Can I get the same maze again?

Yes. The same columns, rows and seed always produce the same maze.

More in Education

All tools in this category: Education ·Updated November 3, 2026

Privacy choices

Google Analytics shows us which tools are used and whether they work. It may set cookies. Your choice is kept in this browser.