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.
Generate
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
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.