Maze Generator
Generate printable mazes of any size with a guaranteed single solution path. Set the grid, overlay the answer route and download a crisp PNG.
Maze 20 × 20
The maze is carved by a recursive backtracker: it walks to a random unvisited neighbour, knocking down the wall between them, and reverses out of dead ends until every cell has been reached. That leaves exactly one passage fewer than there are cells, which mathematically guarantees a perfect maze — every cell is reachable and there is exactly one route between any two of them. The overlay is that route, found with a breadth-first search. Everything is drawn in your browser and the PNG never leaves your device.
What is the Maze Generator?
This generator produces perfect mazes, which is the technical term for a maze with no loops and no unreachable areas.
- Perfect mazes — no loops, no unreachable cells, one solution
- Grids from 2×2 up to 80×80 with adjustable cell size
- Marked entrance and exit with an optional solution overlay
- Reproducible from a seed you can save or share
- PNG export rendered at 2× for crisp printing
- Drawn entirely in your browser, works offline
How to use the Maze Generator
- 1
Set the number of columns and rows, and the cell size in pixels.
- 2
Press New for a fresh maze, or type a saved seed to rebuild an old one.
- 3
Tick Overlay the solution path to see or hide the answer route.
- 4
Check the solution length stat to gauge how hard the maze is.
- 5
Press Download PNG for a print-ready image at double resolution.
About the Maze Generator
This generator produces perfect mazes, which is the technical term for a maze with no loops and no unreachable areas. A recursive backtracker walks to a random unvisited neighbour, knocking down the wall between them, and reverses out of dead ends until every cell has been visited. That leaves exactly one passage fewer than there are cells — a spanning tree, mathematically guaranteeing exactly one route between any two points.
Set any grid from 2×2 up to 80×80 and choose the cell size in pixels. The entrance is marked green at the top left and the exit red at the bottom right. Turn on the solution overlay and the unique route is drawn in orange, found with a breadth-first search of the finished maze.
The PNG download renders the maze fresh at double resolution, so it stays crisp when printed regardless of how big it looks on screen. Everything is drawn in your browser on a canvas, the image never leaves your device, and the tool works offline.
Frequently asked questions
What is a perfect maze?
A perfect maze has exactly one path between any two cells — no loops and no isolated sections. Because the generator carves exactly one passage fewer than there are cells, and every cell gets visited, the result is a spanning tree, which is precisely what a perfect maze is.
How does the recursive backtracker algorithm work?
It starts in one cell, picks a random neighbour it has not visited, removes the wall between them and moves there. When it reaches a dead end it backtracks to the last cell with an unvisited neighbour and carries on, until every cell has been reached.
How do I make the maze harder?
Increase the number of columns and rows. Bigger grids mean longer solution paths and many more dead ends. The solution length stat tells you exactly how many cells the correct route passes through, which is a good difficulty gauge.
Can I print the maze?
Yes. The PNG download is rendered at double resolution with a white background, so it prints sharply on paper. Download it with the solution hidden for the puzzle, then again with the overlay on for the answer sheet.
Where are the entrance and the exit?
The entrance is the green square at the top left and the exit is the red square at the bottom right. Because the maze is perfect, exactly one route connects them, and that is the route the overlay draws.
Related tools
Sudoku Generator
Generate printable sudoku puzzles with a guaranteed unique solution. Choose easy to expert, rebuild any puzzle from its seed and download the answer key.
Word Search Generator
Turn any word list into a printable word search puzzle with your choice of grid size and directions, plus a highlighted answer key for marking.
Graph Paper Generator
Draw printable graph paper in your browser — square, engineering, dot, isometric or hexagonal grids at any spacing, colour and paper size, exported as PNG.
Math Worksheet Generator
Create printable maths worksheets with randomised addition, subtraction, multiplication, division and fraction questions, plus a matching answer key.
Seeded Random Number Generator
Generate repeatable random numbers from a text seed. The same seed always returns the same list, with ranges, decimals, a no-duplicates mode and CSV export.