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. It need not be a rectangle of squares: the same maze can be laid out on hexagons, on triangles or on rings around a centre, and it can be cut out of the outline of a picture. All of those are the same maze on a different set of cells rather than different puzzles — which is why every one of them is checked for the same property.

What this generator does

Produces a maze and exactly one path between two of its cells. Left on the plain square grid the entrance sits on the top edge and the exit on the bottom; on hexagons, triangles, rings, or any grid cut to a picture outline, the entrance and exit are instead the two cells furthest apart by route, wherever the shape puts them. The three square textures all produce a correct maze and differ in how it 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. Leave Shape as squares for rows and columns from 4 up to 40 each, or choose hexagons, triangles or rings for a maze up to 26 across.
  2. Optionally cut the grid down to the outline of one of the drawing pictures.
  3. Choose the texture: winding for long corridors, bushy for lots of short dead ends, or — on squares only — diagonal for a fast but visibly biased maze.
  4. Press Make maze.
  5. Print it, or reveal the route to check it.

Understanding the controls

Shape
Squares is the familiar grid. Hexagons, triangles and rings lay the same maze onto a different lattice — more or fewer ways out of each cell, so the puzzle feels different even though the guarantee of exactly one route never changes.
Rows and columns, or how big
On squares, set rows and columns separately for a wide or tall maze, from 4 to 40 each. On any other shape, one size dial runs from 4 to 26 — smaller because those grids are built cell by cell rather than indexed as a table.
Cut it out of a picture
Masks the grid down to the outline of one of the site's drawing pictures — a cat, a house, a star — before carving. Cells outside the outline are dropped and the maze is carved only in what is left, so the printed shape really is the picture.
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 offered on squares only and is included for honesty as much as speed: it is genuinely biased.
Seed
Makes the maze reproducible. The same seed, shape, size, mask 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.
Hexagons, masked to the cat outline
The grid is dropped to whatever cells fall inside the cat figure, then carved — a maze shaped like the picture rather than a rectangle, with the same one-route guarantee.

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. On the plain square grid, the entrance and exit columns are drawn too, with the exit never placed directly below the entrance; on any other shape, or with a picture mask on, the entrance and exit are found afterwards, as the two cells furthest apart by route.

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 diagonal texture applies to the square grid only. It works by having every cell carve north or west, which builds a maze only because a square grid gives each cell exactly those two earlier neighbours — a hexagon has six neighbours and no north-or-west among them. The winding and bushy textures are statements about how a maze is grown rather than about squares, so they are offered on every shape.
  • Size and texture are the two dials, and between them they move the maze a long way: on the same grid the winding texture gives a route about three times the length of the bushy one and a third as many dead ends. What you cannot do is name a number — ask for a route of exactly ninety squares — because the route is whatever the carving produces and is reported afterwards rather than aimed at.
  • 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 and exit are not fixed the same way on every shape. On the plain square grid the entrance is always on the top edge and the exit on the bottom; choose a different shape, or cut the grid to a picture, and both move instead to whichever two cells the carved maze puts furthest apart, which will not always be at an edge.
  • Squares run up to 40 by 40; hexagons, triangles, rings and any picture-masked grid cap lower, at 26, because those cells are built and joined one at a time rather than addressed as rows and columns.
  • A picture mask that leaves fewer than twelve connected cells — a very small size on a thin picture like a kite — is refused rather than printed broken.
  • At the largest sizes 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
On the plain square grid the entrance and exit are drawn at random along their edges, so occasionally they land close together — generate again, or use a taller grid. On other shapes and masked grids they are already chosen as the two cells furthest apart, so a short route there means the shape itself is small or narrow.
Choosing a picture mask produced nothing
A mask that leaves fewer than twelve cells connected to each other is refused rather than carved into a broken maze. Pick a larger size, or a less narrow picture — a kite or a star loses more of its middle to a small grid than a house or a fish does.

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 how many cells the maze has — never the texture, 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?
Yes. Set Shape to hexagons, triangles or rings for the same maze on a different lattice, or leave it on squares and use "Cut it out of a picture" to mask the grid down to one of the site's drawing outlines. Both are the same spanning-tree maze on a different set of cells, checked the same way; the trade-off is size, which caps at 26 rather than 40 once you leave the plain square grid, and texture, which drops to winding or bushy only.
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.