Geometry & Color

Random Maze Generator

Generate a unique, solvable maze on a grid of your chosen size — every maze is carved fresh using a randomized search algorithm.

Cryptographically secure Instant, in your browser Free, no sign-up

Generate

Your result will appear here

How the Random Maze Generator works

This maze is carved using randomized depth-first search: starting from one corner, the algorithm repeatedly knocks down a wall into a random unvisited neighbouring cell, backtracking whenever it hits a dead end, until every cell has been visited exactly once. The result is a 'perfect maze' — there is exactly one path between any two cells, with no loops and no isolated sections.

Because the algorithm always chooses its next direction using a cryptographically secure random draw, no two generated mazes look alike, even at the same grid size, giving you an effectively unlimited supply of solvable, unique puzzles.

How to use it

1
Choose a grid sizeSmaller grids solve quickly; larger grids make for a longer, more intricate maze.
2
GenerateXrandom carves a unique maze using a randomized depth-first search, guaranteeing exactly one path between any two cells.
3
Solve or printThe entrance is the top-left cell and the exit is the bottom-right cell — trace a path through, or print it for an offline puzzle.

Frequently asked questions

Is every maze solvable?

Yes — the randomized depth-first search algorithm guarantees a 'perfect maze' with exactly one connected path between any two cells, so a solution always exists.

Where's the entrance and exit?

By convention, the top-left cell is the entrance and the bottom-right cell is the exit.

Can I print the maze?

Yes, generate one and use your browser's print function — it renders as clean vector lines that print sharply at any size.