Random Maze Generator screenshot

Random Maze Generator

Carve a perfect maze with a recursive backtracker from an odd grid and an integer seed. Runs in your browser.

Privacy First
0 Runs
Updated 2026-11-06
No upload

A perfect maze, carved

The page starts with every cell a wall and walks from the top-left floor cell, carving two cells at a time and backtracking when a cell has no unvisited neighbour two steps away. That is the recursive backtracker, and it produces a perfect maze: exactly one path between any two floor cells, and no loops.

Width and height must both be odd and from 9 to 41, because the border walls and the one-cell step need an odd span. An even value is refused with an explanation rather than rounded down, and so is a seed outside 0 to 4294967295.

Every choice is one draw from a 32-bit mulberry32 stream, so the same seed and size always print the same maze. The page is rendered text: nothing is uploaded, and the maze is not saved anywhere.

Carves a perfect maze with a recursive backtracker on an odd grid and prints it with a start, an exit and a wall legend.

Because the algorithm only carves between unvisited neighbours, the result has exactly one path between any two floor cells — it is not a cave scatter.

How to use it

Choose an odd width and height (9 to 41), add an integer seed and press Run. S marks the entry, E the exit, dots are floor and hashes are wall.

Odd spans are required because the carver moves two cells at a time from an odd coordinate. An even span has no consistent border, so the page refuses it instead of silently subtracting one.

What to Expect

Best for

  • a maze for a puzzle room
  • a printable pen-and-paper maze
  • testing a pathfinder

What this tool keeps

  • the seed, so the same maze can be redrawn
  • a marked start and exit
  • a maze that is solvable by construction

Frequently asked questions

How do I use the random maze generator?

Enter an odd width and height, an integer seed, then press Run. The grid prints with S at the entry, E at the exit, dots for floor and hashes for walls.

Is anything uploaded or stored when I press Run?

No. The draw happens in this tab with JavaScript: no request leaves the page, nothing is stored and a reload clears the form.

What are the limits and bounds?

Width and height must be odd and from 9 to 41, and the seed must be a whole number from 0 to 4294967295; an even span or a seed outside that range is refused, not adjusted.

Developer program

Build custom tools for your store

Join the SDK program to create useful ecommerce utilities for your store.