Skip to content

Maze Generator

Choose a shape, a size and a style, and get a printable maze with exactly one route from start to finish. Show the solution, print the maze with an answer page, or save it as SVG or PNG. Free, no sign-up.

Shape
Maze style

Recursive backtracker: long corridors and a long route, with relatively few dead ends.

Type a number from 1 to 999999 to rebuild the same maze.

Your maze

Maze 240817

The filled dot is the start, in the top-left corner. The ringed dot is the finish, in the bottom-right.

About this maze

324

Cells

133

Cells on the solution

33

Dead ends

12

Turns to choose on the route

How to Use the Maze Generator

  1. 1. Pick the shape. Rectangular mazes start in the top-left corner and finish in the bottom-right. Circular mazes start on the outer edge and finish in the centre.
  2. 2. Choose the size. Easy is about 100 cells for a rectangle, up to Extreme at 1,600 cells. Custom size lets you set the columns and rows (3–60) or the rings (3–24) yourself.
  3. 3. Choose the style. Winding gives long corridors and a long route; Branching gives a shorter route with many more dead ends to wander into.
  4. 4. Generate, check, print. New maze draws another one. Show solution overlays the route. Print maze gives a clean page with an optional name-and-date line; Print maze and solution adds an answer page. Download SVG or PNG saves the picture for a worksheet or slide.

What Makes It a Perfect Maze

Every maze here is a perfect maze: every cell can be reached, there are no loops, and there is exactly one route between any two cells. In graph terms, the open passages form a spanning tree of the cells. That is why the start is always connected to the finish, why the solution is the shortest route as well as the only one, and why a solver can never go round in circles.

The tool builds the maze with one of two classic algorithms. Both work on any layout of cells, which is how one program draws both rectangles and circles.

  • Winding — the recursive backtracker. A depth-first search that carves from the current cell to a random unvisited neighbour and backs up only when it is stuck. It leaves long, twisting corridors and few dead ends.
  • Branching — Wilson's algorithm. Devised by David Bruce Wilson (1996), it adds loop-erased random walks to the maze until every cell is in. Every possible perfect maze of that layout is equally likely, so it has no built-in style: just lots of short dead ends.

Winding or Branching: Which Is Harder?

It depends on what you mean by hard. The numbers below are from maze number 240817 on the Medium rectangle (18 × 18 cells), which you can rebuild by typing that number into the box.

StyleCells on the solutionDead endsTurns to choose on the route
Winding133 of 3243312
Branching55 of 3248526

Across many mazes the tool's own tests find about 10 percent of cells are dead ends in a winding maze and about 29 percent in a branching one.

A winding maze takes longer to walk but has few wrong turns, so a child can usually follow the corridor with a pencil. A branching maze has a short route, but two to three times as many dead ends to fall into and about twice as many places where a wrong choice is possible. For younger children pick Easy and Winding; for a challenge pick Hard and Branching. The statistics under the maze show the actual counts for the one you made.

How the Circular Maze Is Laid Out

A circular maze (a "theta" maze) has a single cell at the centre, then rings of cells. The first ring has six cells. Each ring after that has a whole-number multiple of the cells of the ring inside it — usually the same number or double — chosen to keep the cells close to square instead of stretching thin towards the edge. The centre is the finish and a gap in the outer wall is the entrance. The solution line follows the rings and radial passages exactly, so it never cuts across a wall.

Using Mazes in the Classroom

  • Fine-motor and pencil control. An Easy maze on A4 or Letter paper is a good tracing exercise; the passages are wide enough for a thick pencil.
  • Planning and logic. Ask older pupils to plan the route by eye before they trace it, then check against the solution page.
  • Reusable worksheets. Note the maze number on the sheet. Typing it back in rebuilds the identical maze and its answer page for marking.
  • Vocabulary and quizzes. Download the SVG and add a question at each turn in a slide deck or document to build a quiz maze.

Frequently Asked Questions

How do I make a printable maze?
Choose a shape, size and style, press New maze until you like the result, then press Print maze. The print preview contains only the maze, a title, an optional name-and-date line and the start and finish key. Choose Print maze and solution to add a second page with the route drawn in.
Is every maze solvable?
Yes. Every maze is a perfect maze, which means every cell is connected to every other by exactly one route. The entrance and the exit are always joined, and there are no sealed-off rooms or loops.
What is the best algorithm for generating a maze?
There is no single best one; they make mazes with different character. The recursive backtracker makes long winding corridors with few dead ends, while Wilson's algorithm samples every possible perfect maze equally and produces many short dead ends. This tool offers both so you can choose the feel.
Can I make the same maze again?
Yes. Each maze has a six-digit number shown above it. Enter that number, keep the same shape, size and style, and press Make maze from this number. The same inputs always rebuild the same maze.
How do I show the solution to a maze?
Press Show solution to draw the route over the maze. To print it, use Print maze and solution; the answer page comes after the blank maze so you can hand out the first and keep the second.
How big can a maze be?
A rectangular maze can be up to 60 by 60 cells (3,600 cells) and a circular maze up to 24 rings. Very large mazes still print, but the passages get narrow; beyond about 40 cells across, choose a bigger sheet or save the SVG and print it at poster size.
Does the maze generator upload anything?
No. The maze is generated and drawn in your browser, and nothing is sent anywhere or saved between visits.

More in Classroom & Printables

See all Classroom & Printables