Maze Generator

Create a custom maze, explore different puzzle styles, find the solution, or download a printable maze for your next challenge.

Preparing workshop…

Six maze generation modes

Dedicated pages: rectangular, circular, hexagonal, braided, rooms, worksheets.

Choose a spanning-tree method

Perfect mazes (rectangular, circular, and hexagonal) are connected acyclic graphs: for N cells there are exactly N − 1 passages. Braided and room mazes may contain loops and are not described as perfect.

Play your maze

Time 00:00.0Moves 0

Arrow keys and WASD move the player when the maze canvas is focused. Hints follow a shortest path from the current cell. Undo counts as a traversed edge.

Maze structure

Total cells—
Open passages—
Dead ends—
Junctions—
Independent cycles—
Shortest solution—
Solution coverage—
Algorithm—
Seed—
Actual rooms—
Corridor cells—

Independent cycles use E − V + 1 on the connected undirected graph. Coverage is shortest-path cells divided by total cells.

Printable maze worksheet builder

Build a multi-puzzle sheet on the worksheet maker. Each puzzle uses a derived seed so the page does not repeat the same maze.

Export and download

Exports are generated in the browser. Appearance settings never change the maze graph. Generator version 1 is part of the seed hash so later engine changes can be documented.

Customize your maze

How a maze is built

Each panel runs the real generator one step at a time on an 8 × 6 graph. These are not prerecorded films.

Randomized depth-first search

Randomized Prim

Randomized Kruskal

Twelve maze presets

Choose your maze challenge

These presets are approximate configuration categories, not scientifically validated difficulty ratings. Size, junctions, dead ends, corridor length, loops, and the solver’s experience all affect how a puzzle feels.

  • Beginner — 8 × 8 rectangle, 4 rings, or hex radius 3.
  • Easy — 12 × 12, 6 rings, or hex radius 4.
  • Medium — 20 × 20, 8 rings, or hex radius 6.
  • Hard — 35 × 35, 12 rings, or hex radius 10.

Different ways to solve a maze

Breadth-first search

Explore cells in layers from the start. On an unweighted maze graph this finds a shortest path. Maze Foundry uses BFS for solutions and hints. It is not claimed to solve every weighted shortest-path problem.

Use: shortest route in a grid, polar, hex, braided, or room maze. Limit: equal edge costs only.

Depth-first search

Walk as far as possible before backtracking. Useful for exploring, and the same idea generates many of our perfect mazes. DFS is not guaranteed to find the shortest path when loops exist.

Use: generation and exploratory solving. Limit: first path found may be long.

Backtracking

When a corridor dead-ends, reverse to the last junction with an unused option. Humans do this with a finger; generators do it with an explicit stack.

Use: perfect mazes with many dead ends. Limit: slow if you forget visited cells.

Wall-following method

Keep one hand on a wall. This can finish simply connected mazes, but it is not guaranteed for every configuration. It can fail when walls are disconnected or when loops isolate the destination from the followed wall.

Use: printed hedges with one continuous wall. Limit: not universal.

Dead-end elimination

Fill every cell of degree one that is not the entrance or exit, then repeat. Remaining corridors contain the solution in a perfect maze.

Use: pencil-and-paper perfect mazes. Limit: loops keep extra corridors alive.

Shortest-path reconstruction

After BFS, walk predecessor pointers from the exit back to the start. That path is what the orange overlay draws. Weighted graphs would need a different algorithm such as Dijkstra’s method.

Use: reporting length and drawing the answer sheet. Limit: unweighted edges.

Common maze questions

Is every maze a perfect maze?
No. Rectangular, circular, and hexagonal modes generate spanning trees. Braided and room-and-corridor mazes may contain loops. Statistics report independent cycles as E − V + 1.
Will the same seed always match?
Yes, when maze type, dimensions, algorithm, structural settings, and generator version 1 stay the same. Wall color does not change the graph. The generator is not cryptographically secure; it exists for puzzle reproducibility.
What is the cell limit?
Rectangular mazes: 5–80 per side, at most 6,400 cells. Circular: 3–20 rings, at most 2,400 cells. Hexagonal: radius 2–25.
Does wall-following always work?
No. Following one wall can miss the exit in mazes with disconnected wall components or certain loops.

About and contact

Maze Foundry is a free browser-based puzzle workshop operated by Shane Pratt. Generation, solving, and exports run locally. There are no accounts, subscriptions, or puzzle caps.

Shane Pratt
11 Hyland Cir
Troy NY 12182
usowmv7@gmail.com