Maze Generator – Make Printable Mazes with an Answer Key
Pick the grid size and difficulty, press “Generate maze”, and you get a maze with exactly one route from start to finish. You can reveal the solution, save the maze as a PNG, or print it straight away – handy for kids’ activity sheets, classroom handouts and party games. Looking for another simple game? Try the Amidakuji generator.
🔒 Runs in your browser · Your data is never sent to a server
Choose from 5 to 50 cells.
How to use
- Set the number of columns and rows, and choose a difficulty.
- Press "Generate maze" to see a new maze. You can regenerate as many times as you like.
- Tick "Show solution" to reveal the answer route.
- Use "Save as PNG" to download an image or "Print" to print it. Whatever is shown, including the solution if it is on, is what gets saved or printed.
Notes
- Generating the maze, computing the solution and creating the image all happen in your browser. Nothing is sent to a server.
- The start (S) is always the top-left and the goal (G) the bottom-right. Mazes are perfect mazes (see the glossary): there is exactly one route between any two cells, with no loops and no sealed-off areas.
- Width and height can each be 5 to 50 cells. Larger mazes have thinner passages and the lines may look fine when printed; around 10×10 or smaller is a good starting point for young children.
- Every press of "Generate maze" makes a different maze and the same one cannot be recreated later, so save it as a PNG or print it if you want to keep it.
- The PNG has a white background, and its longer side is at most about 1600 pixels.
- Printing scales the maze up to fill the page. You can adjust paper size and margins in your browser’s print dialog.
Glossary
Perfect maze
A maze in which there is exactly one path between any two cells: no loops and no unreachable areas. The route from start to goal is therefore unique. This tool always makes perfect mazes.
Recursive backtracker (depth-first search)
A generation method that carves in a random direction until it hits a dead end, then backs up and branches off. It produces long winding corridors and is used for Hard.
Prim’s algorithm
A generation method that repeatedly attaches a random cell next to the maze built so far. It produces many short branches and is used for Normal.
Binary tree algorithm
The simplest method: each cell opens a wall either downward or to the right at random. This bias lets you reach the goal by only moving down and right, so it is used for Easy.
FAQ
Is there always a solution?
Yes. Every maze is a "perfect" maze: all cells are reachable and there is exactly one route from the start (top-left) to the goal (bottom-right). Tick "Show solution" to see that route.
How does the difficulty setting work?
It changes the generation algorithm. Easy is biased so that moving only down and right reaches the goal; Normal has many short dead ends; Hard has long winding corridors. A larger grid makes any level harder.
How do I print a worksheet and an answer sheet?
Print with "Show solution" off, then tick it and print again to get the answer sheet of the same maze. Do not press "Generate maze" between the two prints, because that creates a different maze.
My printout has faint or cut-off lines. What can I do?
Printing scales the maze to the page width. Reduce the margins in your browser’s print dialog and match the page orientation to the maze shape. Very large grids have thin passages; try about 10×10 to 20×20, or save a PNG and print it from another app.
Can I recreate the same maze later?
No. Each maze is random and no seed is stored. If you want to keep one, save it as a PNG or print it.
Share this page
