Maze Generator
Create a maze first
This funnel step has no recoverable maze in this browser tab. Return to the first step to begin.
Return to setupChoose the maze size and challenge
Set rows and columns independently from 5 to 60. Challenge compares nine valid mazes with the same settings and selects a simpler, middle or tougher layout.
Create a rectangular maze with 5 to 60 rows and columns, choose a relative route challenge and compare three generation algorithms. Every result is a perfect maze with one route between any two cells, fixed entrances in opposite corners and an optional solution overlay. Enter a seed when you need the same maze again, then save it as SVG or PNG or print it directly. Generation and export happen locally in your browser.
How it works
-
1
Set the maze size
Choose between 5 and 60 rows and columns, or start with a square preset.
-
2
Choose an algorithm and seed
Select Backtracker, Prim or Kruskal. Enter a seed to reproduce a maze, or create a new one.
-
3
Generate and check the maze
Build the maze and show its unique solution when you want to inspect the corner-to-corner route.
-
4
Save or print your maze
Download an unsolved puzzle or answer key as SVG or PNG, or print it from your browser.
Create a maze for print, lessons or puzzles
A custom maze can be a quick activity sheet, a classroom handout, a party puzzle or a way to compare graph algorithms. Choose any rectangular grid from 5 × 5 to 60 × 60 cells. A square grid is familiar, but a wide or tall maze can fit a page, card or presentation more naturally.
The entrance and exit stay at opposite corners, so every generated maze has a consistent direction of travel. Turn on the solution overlay to inspect the route, then hide it before sharing the unsolved version.
What is a perfect maze?
This generator creates perfect mazes. In graph terms, the cells and passages form a spanning tree: every cell is connected, there are no loops and there is exactly one path between any two cells. That means the maze cannot contain an unreachable island, and the entrance-to-exit puzzle has one unambiguous solution.
“Perfect” describes the maze’s structure, not its challenge. A perfect maze can be simple or visually demanding. Size, corridor shape, wrong branches and the unique solution path all affect how it feels to solve.
Choose Backtracker, Prim or Kruskal
All three options produce a connected, loop-free maze, but their construction methods create noticeably different textures.
| Algorithm | How it grows | Typical appearance |
|---|---|---|
| Backtracker | Walks into unvisited cells and backs up at a dead end | Longer, winding corridors |
| Prim | Expands through randomly chosen frontier cells | Dense branching with many short dead ends |
| Kruskal | Joins separate cell groups without creating a cycle | Irregular branching and short cul-de-sacs |
Backtracker is a good first choice when you want long passages that are easy to follow visually. Randomized Prim often creates compact branches. Randomized Kruskal considers connections across the whole grid and tends to create a spikier pattern. These are tendencies, not guarantees.
Jamis Buck provides visual introductions to recursive backtracking, randomized Prim and randomized Kruskal. Princeton’s algorithms reference also explains the spanning-tree basis of Prim and Kruskal.
What the route challenge setting means
Easy, medium and hard are relative choices for the current settings, not promises about human solving time. The generator creates nine deterministic candidate mazes with the same size, algorithm and seed family. It scores measurable route features: solution length, turns and misleading junctions. Easy selects the lowest-scoring candidate, medium the middle candidate and hard the highest.
The summary shows those route measurements so the label remains transparent. A larger grid usually demands more scanning, but cell count alone does not determine challenge. If a result feels too simple or busy, create a new seed or change the algorithm.
Recreate a maze with its seed
A seed turns the generator’s choices into a repeatable sequence. Record it with the row count, column count, challenge and algorithm. The same complete settings reproduce the same maze in the same compatible generator version.
This helps when preparing an answer sheet, sharing one puzzle with a group or returning later. A seed is not a universal maze format: another generator or algorithm may interpret it differently.
Use the solution overlay
The solution overlay traces the unique route from the entrance to the exit. Show it to check the maze or prepare an answer key. Hide it before printing an unsolved worksheet. Because this is a perfect maze, the overlay displays the only valid route rather than choosing between alternatives.
SVG, PNG and printing
| Output | Best for | Important detail |
|---|---|---|
| SVG | Printing, resizing and editing | Vector lines stay sharp at different sizes |
| PNG | Documents, messages and slides | A raster image has fixed pixel dimensions |
| Immediate worksheets or PDF saving | Check orientation and margins in print preview |
SVG is usually best when the maze will be enlarged or edited. PNG is convenient when an application expects an ordinary image. Browsers support SVG as an image format, as described in MDN’s SVG guide, while canvas supports PNG creation as documented in MDN’s Canvas tutorial.
The tool does not upload a generated maze or create a server-side PDF. Use Print or save as PDF and choose your device’s PDF option when available. The 60 × 60 limit keeps previews and exports manageable; reduce the grid if passages look cramped on the chosen paper.
Browser-local privacy
Maze construction, solution calculation and image export run locally in this browser tab. The maze configuration and generated topology are not placed in the funnel URL or sent to our servers. Normal page requests still occur between funnel steps, and the tab uses session storage to preserve progress. If storage is unavailable, the normal one-page generator still works, but funnel navigation stops rather than losing the maze.
Frequently Asked Questions
A perfect maze is connected and contains no loops. Every cell is reachable, and exactly one route connects any two cells, including the entrance and exit.
Yes. Each generated maze is a spanning tree of the rectangular grid, so the fixed entrance and exit are connected by one unique path.
Choose Backtracker for longer winding corridors. Prim and Kruskal generally produce more short branches and dead ends. All three create valid perfect mazes.
No universal rating can guarantee that. The setting compares nine candidates with identical main settings and selects by solution length, turns and misleading junctions. The displayed metrics make the relative choice transparent.
Save the seed together with the rows, columns, challenge and algorithm. Enter the same complete settings later to reproduce the maze in the same compatible generator version.
Yes. Set rows and columns independently anywhere from 5 to 60, allowing wide, tall or square mazes.
Yes. The export controls provide separate puzzle and answer-key actions, so showing the solution on screen cannot accidentally add it to an unsolved download.
Use SVG for sharp lines at different print sizes or later vector editing. Use PNG for easy insertion into documents, slides and messages.
Choose Print or save as PDF, then select the PDF option in your browser or operating system when it is available.
Maze generation, solution calculation and export run locally in your browser tab. The generated topology is not uploaded for processing.
Related Tools
Mouse Tester
Test your mouse buttons, wheel scrolling, pointer movement and double-click timing in the browser. See event logs and movement samples without uploads.
Spacebar Counter
Count distinct spacebar presses or run a timed test with a target, timer, progress and presses-per-second estimate.
Fake Error Message Generator
Create custom fake error dialog images for Windows, macOS and web, with configurable title, body text and error code.
Fancy Serial Number Checker
Check US-style currency serial numbers for fancy patterns like radars, ladders, repeaters, low numbers and star notes.
Beat Maker
Create simple drum beats in a 16-step browser sequencer with tempo, swing, kits, pattern presets and local Web Audio playback.
Minecraft Circle Generator
Create hollow or filled Minecraft circle and ellipse blueprints. Set the block dimensions, count materials, inspect the grid and download an SVG.
Tool available in other languages
- 미로 생성기 [KO]
- Labyrintgenerator [SV]
- Doolhofgenerator [NL]
- Generator labiryntów [PL]
- Labyrinth-Generator [DE]
- เครื่องมือสร้างเขาวงกต [TH]
- Generador de laberintos [ES]
- Pembuat Labirin [ID]
- مولّد المتاهات [AR]
- Générateur de labyrinthes [FR]
- 迷路ジェネレーター [JA]
- Gerador de labirintos [PT]
- Trình tạo mê cung [VI]
- Generatore di labirinti [IT]
- Генератор лабиринтов [RU]
- Labirent Oluşturucu [TR]
- 迷宫生成器 [ZH]