GenerateRandomSearch

Maze Generator

Draws a maze in which every square can be reached and exactly one route joins any two points — no loops, no sealed-off pockets and no second way to the exit. That is a precise mathematical property rather than a description, and it is checked rather than assumed. Choose the size, choose how the maze should feel to solve, and print it with or without the answer.

What this generator does

Produces a rectangular maze with an entrance on the top edge, an exit on the bottom, and exactly one path between them. The three algorithms all produce a correct maze and differ in how the maze feels: one carves long winding corridors, one grows outwards and leaves many short dead ends, and one is fast and openly biased. The route can be revealed on screen and hidden again, so the same maze serves as both the puzzle and its answer.

How to use this tool

  1. Set how many rows and columns you want, from 4 up to 40 of each.
  2. Choose the texture: winding for long corridors, bushy for lots of short dead ends, or diagonal for a fast but visibly biased maze.
  3. Press Make maze.
  4. Print it, or reveal the route to check it.

Understanding the controls

Rows and columns
The size of the grid in cells. Small grids suit young children and fit several to a page; 30 by 30 and above takes an adult a good while. The two can differ, so a wide landscape maze or a tall narrow one are both available.
Texture
Winding carves as far as it can before turning back, giving long corridors and comparatively few dead ends — this is what a puzzle-book maze looks like. Bushy grows from a single point and takes a random frontier each step, producing many short dead ends and a more cluttered feel. Diagonal is included for honesty as much as speed: it is genuinely biased.
Seed
Makes the maze reproducible. The same seed, size and texture always give the identical maze, including where the entrance and exit fall, so a class set can be reprinted or a lost sheet replaced.

Worked examples

Winding, 20 by 20
Long snaking corridors with roughly 90 dead ends. Looks like a maze from a puzzle book and takes a few minutes.
Bushy, 20 by 20
The same size with far more dead ends, most only a cell or two deep. Fiddlier to solve and busier to look at.
Diagonal, any size
The top row and the left column are always one unbroken corridor and the whole maze leans towards the top-left. Fast to generate and obviously slanted.
8 by 8 for a young child
Sixty-four cells, a short route and a handful of dead ends. Big enough to feel like a maze and small enough to finish.

Common use cases

  • A printable early-finisher or wet-play activity
  • Fine motor practice for younger children at a small grid size
  • A puzzle page in a newsletter, party pack or activity sheet
  • Teaching what a spanning tree is, using something visible
  • A hard maze for an adult puzzler at 40 by 40

How this generator works

A maze where every cell is reachable and exactly one route joins any two points is, in graph terms, a spanning tree over the grid: connected, and with exactly one fewer passage than it has cells. Both halves matter and neither is sufficient alone — a maze with the right number of passages but a sealed-off pocket has a loop somewhere else, and a connected maze with one passage too many has a loop by definition. The tool checks both conditions on the finished grid rather than trusting the algorithm that built it, and walls are always cleared from both sides at once, because a wall recorded from one side only produces a maze that draws correctly and solves wrongly.

Randomness and fairness

The randomness decides which walls come down, and nothing else. Once the passages are carved, whether the maze is correct is not a matter of chance at all — it is checked. The default source is the browser's cryptographic random number generator. A seed switches to a reproducible, non-cryptographic generator so an identical maze can be printed again; that mode is deliberately not cryptographically secure, and nothing here requires it to be. The entrance and exit columns are drawn too, with the exit never placed directly below the entrance.

For how randomness is produced across the whole site, see how Generate Random works.

Assumptions this tool makes

  • You want a maze to print or copy rather than to solve on screen.
  • A single route from start to finish is what you want; that is the definition being used.

Limitations and good to know

  • The maze is always a rectangle on a square grid. Circular, hexagonal and picture-shaped mazes are genuinely different constructions rather than a setting on this one.
  • Difficulty is not tunable beyond size and texture — there is no control over how long the route is or how many false turns it passes.
  • There is exactly one route by design, so puzzles with several valid paths, or with loops to make the route ambiguous, are outside what this produces.
  • The entrance is always on the top edge and the exit on the bottom, which is the common convention but rules out a maze with the start in the middle.
  • At 40 by 40 the printed maze needs a full page to stay legible; a large maze on a small print area becomes a grey smudge rather than a puzzle.

Common mistakes

Assuming a bigger maze is automatically a harder maze
Size helps, but texture matters more. A bushy 15 by 15 with dozens of short dead ends is often more frustrating than a winding 25 by 25 with long clean corridors.
Choosing the diagonal texture because it sounds like a feature
It is included because it is fast and visibly flawed — the top row and left column are always wide open. Use winding or bushy for anything you are printing for somebody else.
Printing a 40 by 40 maze onto part of a page
Give it a full page in portrait or landscape as the shape suggests. Squeezed into a corner the walls merge and the maze becomes unreadable.

Practical tips

  • Generate two or three at different sizes and print them on one sheet as an easy-medium-hard set — it lets a mixed class all get something finishable.
  • Reveal the route before printing to sanity-check the difficulty; a route that crosses most of the grid is a good sign.
  • Note the seed if you want the same maze for a whole class next term. It is the only way to recover an identical grid.

Troubleshooting

The maze looks too easy
Increase the size, or switch texture. Winding produces long corridors that read as easy even when the route is long; bushy at the same size feels considerably harder.
The route seems very short
The entrance and exit are drawn at random along their edges, so occasionally they land close together. Generate again — or use a taller grid, which forces a longer route.

Privacy and your data

Nothing is entered and nothing is stored. The maze is generated in your browser, no maze is uploaded or written into the page address, and analytics records only that the tool was used along with the size and texture chosen — never a maze or a seed.

Frequently asked questions

Is there always exactly one way through?
Yes. The maze is built as a spanning tree, which means every cell is reachable and exactly one route joins any two points — including the entrance and the exit. That is checked on the finished maze rather than assumed from the method: the tool counts the passages and confirms the whole grid is connected, and those two facts together are equivalent to there being no loops.
What is the difference between the three textures?
All three produce a correct maze; they differ in feel. Winding carves as deep as it can before backtracking, giving long corridors. Bushy grows outwards from one point and produces many short dead ends. Diagonal decides each cell independently, which is fast but leaves the top row and left column permanently open and slants the whole maze.
Can I make a circular or shaped maze?
Not with this tool. Circular and picture-shaped mazes are built on a different grid geometry rather than being a display option, so supporting them properly would be a separate generator rather than a checkbox.
What size should I use for young children?
Eight by eight to twelve by twelve is a good range for early primary — enough to feel like a maze, small enough to finish, and large enough to print with wide corridors that a thick pencil can follow.
Can I use these in something I publish?
Yes. Each maze is generated fresh in your browser rather than taken from a collection, so there is nothing to license. Print, photocopy and share them freely.