Random Maze Generator
Generate a unique, solvable maze in the shape and difficulty you choose, with the entrance and exit clearly marked — then export it straight to PNG or PDF.
Generate
How the Random Maze Generator works
This maze is carved using randomized depth-first search: starting from the entrance, the algorithm repeatedly knocks down a wall into a random unvisited neighbouring cell, backtracking whenever it hits a dead end, until every reachable 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.
Square, wide, and tall shapes carve the full rectangular grid. Triangle and diamond shapes work differently: Xrandom first marks which cells fall inside the shape's outline (a mask), then only carves and connects cells within that outline — cells outside it are simply left blank. This is the standard technique for building non-rectangular mazes without changing the underlying algorithm.
Because the algorithm always chooses its next direction using a cryptographically secure random draw, no two generated mazes look alike, even at the same shape and difficulty, giving you an effectively unlimited supply of solvable, unique puzzles ready to export and print.
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?
They're marked directly on the maze with colored dots: green is the entrance, pink is the exit. For square and rectangular mazes they sit at opposite corners; for triangle and diamond mazes they sit at the shape's pointed ends.
How do I save or print the maze?
Use the Download PNG button for a high-resolution image, or Download PDF for a print-ready file — both are generated instantly in your browser at 3x resolution for crisp printing.
What's the difference between the shape and difficulty settings?
Shape controls the maze's outline (square, rectangle, triangle, or diamond); difficulty controls its size and complexity, from a quick Easy puzzle to a large, intricate Expert one.