Maze Generator

Make a printable maze in four shapes and three difficulties. Every maze has a seed so you can reprint the same one, with an optional solution and an SVG download.


Download SVG
Grids run from 5 to 40 in each direction. The seed is what makes a maze repeatable: keep it and you get the same maze back, change it and you get a new one. Leave it blank for a random one.
Cells
400
Solution steps
97
Dead ends
34
Junctions
52

This is the 20 x 20 maze for seed 633232. Enter that seed again to print the identical maze, on this device or any other.

How the maze is built

The generator starts from a solid grid of walls and carves a path through it using a recursive backtracker. It walks to a random unvisited neighbour, knocking down the wall between them, and when it runs out of moves it reverses along its own trail until it finds a cell with somewhere new to go. Every cell gets visited exactly once, so every maze is fully connected and there is always a way through. The winding corridors this produces are what makes a backtracker maze feel like a maze rather than a lattice of short stubs.

What difficulty actually changes

Difficulty here is not a vague slider, it is the proportion of dead ends that get opened up. Hard leaves the maze exactly as carved, a perfect maze with one route and the most wrong turns to fall into. Medium reopens a quarter of the dead ends and easy reopens seventy per cent, which turns those blind corridors into loops you can pass straight through. On a 20 x 20 grid that works out at roughly 42 dead ends on hard, 32 on medium and 14 on easy, and the shortest route shortens from about 143 steps to 67. The counts for the maze on screen are shown above it, so you can see what you actually got.

Rectangles, circles, diamonds and triangles

The four shapes are outlines cut from the same square grid: any cell whose centre falls outside the outline is simply left out before carving begins. A 20 x 20 grid gives 400 cells as a rectangle, 316 as a circle, 220 as a diamond and 200 as a triangle, so a shaped maze is smaller and a little quicker than a rectangle of the same nominal size. Because cutting a shape can leave a cell or two marooned in a corner, the generator keeps only the largest connected group and carves that, which is why a shaped maze is never accidentally missing a piece.

Seeds and reprinting the same maze

Every maze is generated from a seed, and the seed is shown with the result. Type the same seed with the same size, shape and difficulty and you get exactly the same maze, today or next term, here or on another computer. That is what makes this practical for a classroom: hand out the maze, keep the seed, then print the solution later from the same settings with the solution box ticked. A seed can be a word rather than a number, so year4-monday works as well as 481029.

Worth knowing

  • The green dot is the entrance and the red dot the exit; the outer wall is opened at both.
  • The drawing is measured in millimetres, so printing at 100% gives a true size sheet.
  • The SVG download is a vector, so it stays sharp at any size and can be edited afterwards.
  • The solution shown is the shortest route, which matters on easy where loops give more than one way.
  • Nothing is stored. The maze is generated on our server and the result is discarded once it is sent.

Frequently asked questions

Press Print and everything except the maze is hidden, so the sheet comes out on its own with no menus or headings around it. The drawing is sized in millimetres, so as long as your printer is set to 100% and not to fit to page, the maze comes out at the size shown.

Yes, that is what the seed is for. Note the seed shown under the maze, then enter it again with the same size, shape and difficulty and you get an identical maze. Seeds can be words, so something like class-3b is easier to remember than a number.

Always. The carving algorithm visits every cell exactly once, so the whole maze is one connected region and a route from entrance to exit is guaranteed. Tick the solution box to see it drawn in red.

The number of dead ends. Hard leaves the maze perfect, meaning exactly one route and the most blind alleys. Medium opens up a quarter of the dead ends and easy opens seventy per cent, turning them into loops. Easy mazes are also shorter to walk, roughly 67 steps against 143 on a 20 x 20 grid.

Because the shape is cut out of the same grid. A circle inscribed in a 20 x 20 grid only covers about 316 of the 400 cells, a diamond 220 and a triangle 200. If you want a shaped maze with as many cells as a rectangle, ask for a larger grid.

For young children 10 x 10 is about a minute of work, around 39 steps. 20 x 20 is a comfortable puzzle at roughly 96 steps, and 40 x 40 is a long one at over 200. Grids run from 5 to 40 cells on each side, and the two sides do not have to match.

Yes, Download SVG saves the exact drawing you can see. SVG is a vector format, so it scales to any size without going blurry and can be opened in Inkscape, Illustrator or a browser if you want to recolour it or drop it into a worksheet.

Yes. The route is found by breadth first search, which finds the shortest path by construction. On a hard maze that is the only route anyway, but on easy the reopened dead ends create loops and several ways through, so showing the shortest one is the meaningful answer.

How do you make a printable maze?

Choose a grid from 5 to 40 cells a side, a shape and a difficulty, then print or download it as SVG. Mazes are carved with a recursive backtracker, so there is always a solution, and difficulty sets how many dead ends stay in. Every maze has a seed, so the same one can be printed again later.