How to use it
- Choose the Size, or type the Width (cells) and the Height (cells) yourself.
- Press Make the maze. Write the Sheet number down, so that you can make the same maze again.
- Press Print maze and solution: the maze prints first, and the solution prints on a page of its own.
- Use Download maze (PNG) or Download solution (PNG) to save a picture of either one.
How the maze is carved
The maze starts with every wall standing. From the current cell, the recursive backtracker picks a random neighbour it has not visited yet, removes the wall between them and moves on. When a cell has no unvisited neighbour, it steps back to the last cell that has one. This randomized depth-first search reaches every cell, as the Wikipedia article on maze generation describes.
The result has one passage fewer than it has cells. So the passages form a tree: any two cells are joined by exactly one path, which makes it a perfect maze.
From easy to expert
- Easy: 10 by 14 cells, 140 cells in all.
- Medium: 18 by 26 cells, 468 cells in all.
- Hard: 28 by 40 cells, 1,120 cells in all.
- Expert: 40 by 56 cells, 2,240 cells in all. The width and height can be any size from 4 to 60 cells.
What this page does not cover
- Mazes with loops, several exits, or a shape other than a rectangle.
- Hexagonal, circular or three-dimensional mazes.
- Timed play or saved mazes: the maze is drawn in your browser and printed or downloaded, and nothing is stored.
Worked example: a 4 by 4 maze
A maze of 4 by 4 cells has 16 cells. A perfect maze has one passage fewer than it has cells, so this one has 15 passages. Because the passages form a tree, there is exactly one way from the entrance to the exit.
| Item | Working |
|---|---|
| Cells | 4 × 4 = 16 |
| Passages | 16 − 1 = 15 |
| Ways from the start to the finish | 1 |
Frequently asked questions
How do I get the same maze again?
Write down the sheet number. Enter the same number with the same width and height, and the page draws the same maze. Another number gives another maze of the same size.
Does every cell connect to the others?
Yes. Every cell can be reached from the entrance, and only one path joins any two cells, so the maze has no loops and no isolated corners.
Why is there only one route to the finish?
The passages of a perfect maze form a tree: there are no loops, so any two cells are joined by one path. That is why the solution in the answer is the one route you must follow.
What is in the PNG pictures?
The maze picture has the walls, the start and the finish marked. The solution picture has the same walls with the route drawn in colour. Both are high-resolution pictures for printing or sharing.
Can I print the maze and the solution on separate pages?
Yes. The print button prints the maze first, then the solution on a page of its own, so you can give out the maze and keep the answer.
Are the mazes stored or sent to a server?
No. The maze is drawn in your browser. Nothing is saved on our side, and each new page starts with a new sheet number.
Sources
Figures and text last checked on Tuesday, November 10, 2026.