Guide
Making a printable maze: perfect mazes, shapes and the shortest route
A good maze has one right way through and plenty of tempting wrong turns. This generator makes mazes of that kind in the size and shape you choose, prints the worksheet with a green start and a red exit marked, and puts the solution on a second page so you can check an answer at a glance.
How the maze is built
The page marks every cell of the chosen shape and then runs a depth-first search from the starting cell. At each step it picks a random unvisited neighbour, knocks down the wall between the two cells and moves on; when a cell has no unvisited neighbour it backs up to the last cell that has one. When the stack empties every cell has been visited exactly once as a new cell, which means the passages form a tree: any two cells are joined by exactly one route, there are no loops and no sealed-off areas. The number of passages is always one fewer than the number of cells.
Shapes
A rectangle uses every cell of the grid. A circle keeps the cells whose centres lie inside the ellipse that fits the grid, and a diamond keeps those where the horizontal plus the vertical distance from the centre, each measured in half-widths of the grid, is at most one. Cells outside the shape are left out, and the outer wall follows the shape’s edge in steps. The shape fills the same page area as a rectangle of the same grid size, so a circle maze has fewer cells than a rectangle of equal width and height.
Start, exit and solution
The start S is the first cell of the shape from the top left. The exit E is not placed in a corner: after the maze is carved the page measures the number of steps from S to every cell and puts E at the cell with the largest number, so the route is as long as that maze allows. The solution page uses the shortest route, which for a perfect maze is the only route, and draws it as a thick red line over the walls.
A worked example
The default 25 by 30 rectangle has 750 cells and its shortest route is 422 cells long, more than half of the maze. The sample for a young child is 10 by 10, with 100 cells and a route of 69 cells. The circle and diamond samples are 35 by 35 and keep fewer cells than the 1,225 of a square grid of that size. Each sample gives two pages: the worksheet and the solution. The header carries name and date lines, and the title box lets you write a line such as Help the mouse find the cheese.
Choosing a size
Corridors get narrower as the grid gets larger because the maze always fills the page. At 10 by 10 each cell is about 18 mm wide on A4, which suits a thick crayon. At 25 by 30 it is about 7 mm, which suits a pencil. The limits are 5 to 60 cells across and 5 to 70 down. A tall, narrow maze fills the height of the page and leaves empty margins at the sides.
Limits
Every maze is perfect, so there are no loops, shortcuts or several exits, and there are no pictures or themed shapes beyond the three outlines. The exit is chosen by distance and cannot be moved. The maze is drawn at true size for A4 or US Letter; print at 100 percent. Nothing you set is sent anywhere.
Related tools
- Sudoku Generator is a number puzzle that also ships with its answers.
- Word Search Maker hides your own words in a grid of letters.
- Crossword Maker turns words and clues into a crossword.
- Coordinate Plane Generator prints the grids that a map-reading or graphing lesson needs.
Checked against the current version of the Maze Generator on .

