Guide
How to Create a Custom Maze Online
A maze generator builds a graph of cells, opens passages according to a rule, then draws walls wherever a passage is missing. Maze Foundry does that in the browser so you can play the puzzle, reveal a shortest path, or download a file without an account.
What a maze generator does
Every cell becomes a vertex. A permitted step to a neighbor becomes an edge. The drawing layer consults that graph: if two cells share an edge, the shared wall is omitted; if they do not, the wall stays. The entrance and exit are ordinary cells with openings on the boundary. If the graph is connected, a solver can walk from one to the other. If the graph is also a tree, there is exactly one simple path between any pair of cells.
That last property is a perfect maze. Rectangular, circular, and hexagonal modes aim for that structure. Braided and room mazes may add loops. The statistics panel reports independent cycles as E − V + 1.
Choosing a maze shape
Start with geometry, not color. A rectangular grid uses north–east–south–west neighbors. A circular maze uses concentric rings and angular sectors, with radial passages that actually follow the polar graph. A hexagonal maze uses axial coordinates and up to six neighbors. Changing the outer silhouette without changing adjacency is decoration; here the neighbor lists change.
If you want a familiar pencil puzzle, stay rectangular. If you want corridors that curve around a hub, open the circular maze generator. If you want diagonal-looking movement without cheating through corners, use the hexagonal maze generator.
Selecting dimensions
Columns and rows on a rectangle must stay between 5 and 80, with at most 6,400 cells. Circular mazes allow 3 to 20 rings. Hexagonal radius runs from 2 to 25, and the cell count is 1 + 3R(R + 1). Larger graphs take longer to generate and to draw. Medium (20 × 20, eight rings, or hex radius 6) is the workshop default because it still fits a laptop screen while leaving room for dead ends.
Difficulty presets only load those sizes. They are configuration categories, not a claim that every 35 × 35 maze is harder for every person than every 12 × 12 maze.
Understanding entrances and exits
On a rectangle the default entrance is the north-west cell and the default exit is the south-east cell, with the outer wall opened so the markers are visible. On a polar maze the entrance is an outer-ring opening and the destination sits in the inner ring. Hex mazes use opposite rim cells. The solver and the player both respect those two identifiers. If they ever coincide, the workshop walks the graph to a farthest cell so the puzzle remains solvable.
Choosing a generation algorithm
Randomized depth-first search, also called recursive backtracking, uses an explicit stack. It tends to carve long corridors because it keeps walking into unvisited neighbors until it must retreat. Randomized Prim grows a set of visited cells from a frontier of candidate edges and often looks more branched. Randomized Kruskal shuffles every legal neighboring pair and accepts an edge only when a disjoint-set union shows the cells are still separate. All three produce spanning trees on perfect-maze modes. None is universally superior. Step through them on the algorithms page.
Random seeds
A seed is a short text or number that is hashed, mixed with generator version 1, and fed to a Mulberry32-style generator. Algorithm decisions read that stream instead of Math.random, so the same type, dimensions, algorithm, structural settings, and version reprint the same graph. Appearance colors never enter the hash. The stream is not cryptographically secure; it exists so a classroom can share one seed and get matching worksheets.
Difficulty settings and appearance
After a preset loads you can still edit every field. Wall color, background, solution color, player color, and thickness change only the drawing. If wall and paper contrast falls below a simple luminance ratio, a warning appears because passages become hard to see. Thickness is capped so it cannot paint over every corridor.
Finding the solution
Show solution runs breadth-first search from the entrance (or from the player during a hint) and overlays the reconstructed path in burnt orange by default. Because maze edges are unweighted, that path is a shortest path in move count. Depth-first search is not claimed to find shortest routes once loops exist. Animate solution walks the path step by step unless the browser asks for reduced motion, in which case the full path appears at once.
Downloading and printing
Download PNG rasterizes the maze at 1024, 2048, or 4096 pixels on the longest side while keeping aspect ratio. Download SVG writes actual wall geometry, not a screenshot. Print maze hides navigation and controls. For several puzzles on one sheet, use the worksheet maker.
Worked example: a 20 × 20 rectangle
Open the rectangular maze generator. Leave columns at 20 and rows at 20. Keep randomized depth-first search and the medium preset. Press Generate maze. The canvas should fill with a winding orthogonal puzzle. Copy the seed, change wall color to midnight blueprint, and press Regenerate same seed: the corridors stay put while ink color changes. Press Show solution: an orange polyline should run from IN to OUT without crossing a closed wall. Press Play maze, focus the canvas, and use arrow keys. Invalid bumps do not raise the move count. When you reach OUT, efficiency is shortest length divided by your valid moves.
Example graph (tiny 2 × 2). Cells A B / C D. A spanning tree might open A—B, B—D, D—C. That is 4 vertices and 3 edges. Adding A—C would create a 4-cycle; braiding might do that on purpose, perfect mode will not.
Switch the algorithm to Kruskal, keep the seed, and generate. The maze should differ because the decision order changed. Save preferences if you want those settings next visit.
FAQ
- Can I type any seed?
- Yes. Text and numbers are hashed. Empty seeds are replaced with a fresh workshop seed.
- Why did my maze look different after a site update?
- Generator version is mixed into the hash. This article documents version 1. A later engine change should bump that version so old seeds are not silently remapped.
- Do I need an account?
- No. Tools run locally. See the privacy policy.
Next: printable worksheets or generation algorithms.