We use cookies.This website uses essential cookies to operate core features. With your consent, we also use analytics cookies to understand traffic and improve the service. For more details, see our .
If this tool helped you, you can buy us a coffee ☕
Create reproducible mazes by size, algorithm, exit layout, and seed. View the shortest path or distance heatmap, play online, and download as SVG.
Maze settings
Adjust the size, algorithm, and exit placement to generate a reproducible grid maze.
Creates longer corridors with fewer branches for a smoother solving experience.
Use the same size, algorithm, exit placement, and seed to reproduce the exact same maze.
g9fydxrcA 15×15 grid maze can contain hundreds of branches while preserving one unique, non-repeating path from start to finish. The generator above lets you control the width, height, algorithm, exit layout, and random seed, then use the result for online play, classroom demonstrations, or printable maze worksheets.
A grid maze can be modeled as a graph of cells and passages. Each cell represents a node, while the walls between adjacent cells determine whether those nodes are connected. The process begins with every wall in place, then progressively opens passages between neighboring cells according to the selected algorithm. The result is a spanning tree that reaches every cell. This structure ensures that every pair of cells is connected and that the solution contains no loops. The generator uses a deterministic pseudorandom sequence for identical inputs, so the same seed produces the same walls, start, finish, and shortest path.
| Algorithm | Passage Pattern | Best For |
|---|---|---|
| Recursive Backtracker | Prominent long corridors, fewer consecutive turns, and typically deep dead ends | First-time solvers and a smooth puzzle-solving flow |
| Randomized Prim | Dense short branches and junctions with an even overall distribution | Visualizing distance spread and creating medium-difficulty exercises |
| Randomized Kruskal | Gradually merges many small regions, producing a balanced path distribution | Printable puzzles, algorithm lessons, and structural comparisons |
For example, in a 20×20 maze, Recursive Backtracker often creates long corridors that cross large areas. Randomized Prim looks more like branches growing outward in several directions, while Randomized Kruskal produces more dispersed local structures. You can keep the same size and seed while switching algorithms to compare their visual patterns and solving pace.
Left-to-right mode places the start and finish on the maze’s side edges, while top-to-bottom mode uses the upper and lower edges. Both work well for worksheets with a clear orientation. “Longest Path” does not simply add more walls. Instead, it analyzes passage distances after generation and selects endpoints farther apart, making the solution cover more cells. Difficulty still depends on the algorithm, maze size, and how the player scans the puzzle, so shortest-path length is a better measure of the actual route than canvas size alone.
The shortest path through a 10×10 maze might be only 25 moves or more than 50. The result heading displays the maze size and minimum move count, letting you see route-length changes immediately after switching the exit layout. For a more complex puzzle, increase the size and then select “Longest Path” instead of repeatedly generating mazes at the same dimensions.
“Show Shortest Path” draws the unique solution from the starting point. Use it to check an answer, explain pathfinding algorithms, or create worksheets with answer keys. “Show Distances” colors each cell according to its shortest distance from the start, revealing how the search expands outward. The heatmap does not represent the player’s route and does not alter any walls; hiding it leaves the maze unchanged.
In a classroom, you can begin with the solution hidden and ask students to find the exit manually. Then reveal the shortest path to check their work and enable the distance heatmap to discuss how breadth-first search visits cells layer by layer. Because the maze contains no loops, each cell has exactly one path from the start, giving every distance value a unique meaning.
Click “Start Playing,” then move with the arrow keys or WASD. On phones and tablets, use the on-screen directional controls. The status area tracks your moves and elapsed time, and a completion message appears when you reach the finish. “Restart” returns the player to the starting point without regenerating the maze. To get a different puzzle, click “Generate New Maze.”
SVG downloads use vector graphics, so maze walls stay sharp when enlarged or printed. Hide the shortest path before downloading a blank worksheet, then show it to create an answer key. The distance heatmap is useful for on-screen analysis, but it is usually best disabled for printouts so the colors do not distract from the passages. The filename includes the current seed, which you can enter again later to reproduce the same puzzle.
The generation logic uses the graph-theory concept of spanning trees, implemented through depth-first-search backtracking, Randomized Prim, and Randomized Kruskal. Shortest-path and distance data are calculated with breadth-first search across the maze passages. The interactive design was inspired by the Selfboot maze page and reimplemented with ToolKK sharing parameters, usage statistics, responsive layouts, and SVG export. Return to the settings above to choose a size and seed, then generate your first reproducible maze.