PDF maze generator

Generate one or more mazes guaranteed to be solvable (a single path from entrance to exit), in the size of your choice, as a PDF with optional solutions.

Example:

How it works

Each maze is generated with the "recursive backtracker" algorithm (a depth-first search using a stack): starting from the top-left cell, the tool explores unvisited neighboring cells and knocks down walls along the way. This guarantees a "perfect" maze with a single path between the entrance and the exit, with no loops and no unreachable areas.

Is the maze guaranteed to be solvable?

Yes: the generation algorithm builds a complete spanning tree of the grid (every cell is visited exactly once), so a path always exists between the entrance (top left) and the exit (bottom right). That path is also recomputed and verified with a breadth-first search (BFS) to generate the solution page.

What grid size should I choose for each age?

For young children, a grid of around 8x10 stays simple and quick to solve. For a tougher challenge, go up to 20x25 cells or more (up to 30x40), which greatly increases the number of possible branches.

100% local processing: the maze is generated and solved entirely in your browser, with no data sent to a server.