Free Maze Generator
Generate mazes up to 50×50 in two styles, play them with the keyboard or a swipe, show the solution and print PDF mazes with answer keys.
Loading tool…
How to make and play a maze
This maze generator makes perfect mazes: every square can be reached and there is exactly one route between any two points, so the maze has one solution and no loops. Choose a width and height and one of two styles, then solve it on screen or print it.
- Choose a width and height from 8 to 50 squares.
- Choose a style: long winding paths, made with a recursive backtracker, or many short dead ends, made with Prim's algorithm.
- Walk from the green square at the top left to the red square at the bottom right with the arrow keys or WASD, hold Shift to run to the next junction, swipe on a phone, or drag the dot along the path.
- Press Show solution to draw the route, or Back to start to try again. Your best time for each size is saved.
- Download a PDF with 1 to 10 mazes, one per page, followed by answer key pages with the solution drawn in.
How the two maze styles work
The recursive backtracker walks from a random square to a random unvisited neighbour, knocking down the wall between them, and backs up when it reaches a dead end. That makes long, twisting corridors with few branches.
Randomized Prim's algorithm grows the maze outward from one square, each time joining a random square on the edge of the maze. That makes many short branches and dead ends. Both methods connect every square without loops, so each maze has exactly one solution.
Picking a size
Bigger mazes take longer and need finer lines when printed.
| Size | Good for | Printed square size on US Letter |
|---|---|---|
| 8×8 to 10×10 | Ages 4–6 | About 0.7–0.9 inch (18–23 mm) |
| 15×15 to 20×20 | Ages 7–10 | About 0.36–0.48 inch (9–12 mm) |
| 30×30 | Older children and adults | About 0.24 inch (6 mm) |
| 40×40 to 50×50 | A real challenge | About 0.14–0.18 inch (4–5 mm) |
Useful tips and limitations
- For young children, print 8 by 8 or 10 by 10 mazes; for adults, try 40 by 40 or 50 by 50.
- The backtracker style feels like long corridors, while Prim's style has more forks near the start, so it is easier to take a wrong turn early.
- Print several mazes at once for a classroom: each one gets its own answer key page at the end of the PDF.
Common questions
What is a perfect maze?
A perfect maze has no loops and no closed-off areas. Exactly one path connects any two squares, so the solution is unique.
Can I get the same maze again?
Yes. Copy the link to this maze: it stores the size, style and maze number, and opens the same maze on any device.
Are the mazes free to print?
Yes. Print as many as you like for home or classroom use.
Are circular mazes available?
Not yet. The generator makes rectangular mazes with square cells.
Every puzzle is made and played in your browser. Best times, scores and solved puzzles are saved only in this browser on this device; nothing is uploaded and no account is needed. Clearing site data removes them.
