Maze Puzzle Generator

Pick a size and a seed. The same seed always makes the same maze, and every maze has a solution.

Press Generate maze.
Recent mazes

    What makes a good maze puzzle?

    A good maze is not just a tangle of walls. It has exactly one satisfying quality: a solver who keeps trying will eventually reach the exit, and a solver who thinks ahead will find a shorter route than someone who wanders. The mazes on this page are perfect mazes, which means every cell is reachable from every other cell and there is exactly one path between any two cells without backtracking through walls. That property is what makes them fair puzzles: there are no sealed-off sections, no impossible corners, and no need to guess. If you follow a wall, you will eventually arrive, and if you plan a route, you can measure how good it was.

    MazeGen builds its mazes with a classic algorithm called depth-first search carving. Imagine a grid of rooms, each separated by walls. The generator starts in one room, knocks down a wall into a neighbouring room it has not visited, and keeps going, backtracking only when it reaches a dead end. When every room has been visited, the result is a single connected maze with no loops and no isolated areas. A seeded random number generator decides the order in which neighbours are tried, so changing the seed changes the maze, while reusing the same seed reproduces exactly the same maze. That is useful for classrooms, puzzle books, and competitions, where everyone should solve the identical puzzle.

    How to use this generator

    Choose a width and height in cells. Small mazes of 8 by 6 cells suit young children and quick warm-ups, medium mazes of about 14 by 10 cells suit most adults, and large mazes of 22 by 16 cells or more are a serious challenge. Enter a seed, which is simply a whole number that controls the maze layout. Press Generate maze, and the maze appears as a text grid: the start is marked S in the top-left cell and the exit is marked E in the bottom-right cell. You can solve it on screen by tracing with your finger, copy it as text to print or share, or generate a new maze by changing the seed. The solution length shown beneath the maze tells you the shortest possible route in steps, which is a handy way to compare difficulty.

    Maze sizes and who they suit

    SizeCellsShortest path (typical)Best for
    Easy8 × 615–30 stepsChildren, quick puzzles, classroom warm-ups
    Medium14 × 1040–90 stepsMost adults, puzzle pages, daily challenges
    Hard22 × 16100–250 stepsEnthusiasts, competitions, printed puzzle books
    Expert30 × 30300+ stepsPatient solvers, posters, long activities

    Size is not the only measure of difficulty. A maze with many long corridors and few branches feels different from a maze with constant choices, even at the same size. The shortest path length is a better difficulty signal than size alone, because it measures how much of the maze a solver must actually traverse. Two mazes of the same size can have very different shortest paths, which is why the generator reports that number. If you are building a puzzle book, aim for a spread of path lengths rather than a spread of sizes alone, so solvers meet both quick wins and long journeys.

    How to solve a maze well

    Beginners usually solve mazes by following one wall. The right-hand rule, keeping your right hand on the wall as you walk, guarantees that you will reach the exit in a perfect maze, because there are no loops to trap you forever. It is reliable, but it is not fast: it explores every dead end along the chosen wall. A stronger approach is to look ahead at junctions and avoid entering a corridor that clearly ends in a dead end a few cells away. Mark dead ends mentally as you go, so you never re-enter them, and at each junction choose the corridor that heads most directly toward the exit while keeping an alternative in mind.

    Experienced solvers also use the structure of the maze. Long corridors usually lead somewhere important, while short spurs are usually dead ends. If you find yourself backtracking over ground you have already covered, you have learned something: that whole branch is exhausted and can be ignored. In a printed maze, lightly shading dead ends as you discover them turns the puzzle into a process of elimination, and the true path emerges as the only unshaded route. Children benefit from this approach too, because it teaches planning, patience, and the idea that a wrong turn is information, not failure.

    Why seeded mazes matter

    A seeded generator solves a practical problem for teachers and puzzle makers. Without a seed, every maze is a one-off: you cannot reprint the same puzzle, you cannot give the same puzzle to two classes on different days, and you cannot verify that a solver faced the maze you intended. With a seed, the maze becomes a reproducible object, like a page number in a book. Write down the seed and the size, and anyone can regenerate the identical maze anywhere, at any time. That makes seeded mazes ideal for homework, timed challenges, and puzzle competitions where fairness depends on everyone solving the same problem.

    Seeds also make difficulty testing possible. A puzzle maker can generate dozens of mazes from different seeds at the same size, record their shortest path lengths, and pick the ones that fit the intended difficulty band. That is far better than publishing the first maze the generator produces, which might be unusually easy or unusually hard. If you are making a puzzle book, generate a batch, sort by solution length, and select a smooth progression from easy to hard. Your solvers will feel the difference, even if they never see the numbers behind it.

    Using mazes in teaching and play

    Common maze-making mistakes

    The most common mistake in hand-drawn mazes is accidentally sealing off a section, creating a region that cannot be reached. Computer-generated perfect mazes avoid this by construction, which is one reason to generate rather than draw when fairness matters. Another mistake is making the start and exit ambiguous: always mark them clearly, as this generator does with S and E. A third mistake is printing a maze too small, so walls blur together; for paper, keep cells at least a centimetre wide for children and at least half a centimetre for adults. Finally, remember that a maze with many loops is a different kind of puzzle: loops allow shortcuts and multiple routes, which can be fun, but they break the guarantee of a single solution path, so use them deliberately rather than by accident.

    From mazes to problem solving

    Mazes are a gentle introduction to ideas that appear throughout computing and mathematics. Finding a shortest path is the same problem as routing a delivery van, planning a robot's journey, or finding the quickest route on a map. The wall-following rule is an example of an algorithm: a precise recipe that always works, even if it is not the fastest recipe. The depth-first carving used here is related to the search strategies that explore a problem space systematically. When a child learns to shade dead ends and backtrack, they are practising the same thinking that programmers use when they search for a solution. A maze is therefore more than a pastime; it is a small, friendly model of problem solving itself, which is why it has survived as a puzzle for centuries and why it still belongs in classrooms today.

    Printing and sharing tips

    For printing, copy the maze as text and paste it into a document with a monospace font, so the walls line up. Increase the font size for younger solvers, and add a title line with the seed and size so the maze can be regenerated later. If you share a maze online, share the seed and size rather than a screenshot, so others can generate a crisp copy themselves. And if you run a competition, keep the solution length private until after solving, so competitors cannot judge difficulty in advance; reveal it afterwards as a score to beat.

    Frequently asked questions

    Is every maze from this generator solvable?

    Yes. Every maze is a perfect maze, so there is exactly one path from the start to the exit and every cell is reachable.

    What does the seed do?

    The seed controls the random choices made while carving the maze. The same seed and size always produce the same maze; a different seed produces a different maze.

    What do S and E mean?

    S marks the start cell in the top-left corner and E marks the exit cell in the bottom-right corner.

    What is the solution length?

    It is the number of steps in the shortest possible route from start to exit, found by searching the maze. It is a useful measure of difficulty.

    Can I print the maze?

    Yes. Use the copy button to copy the maze as text, then paste it into a document using a monospace font so the walls align.

    What size maze should I choose for children?

    Start with 8 by 6 cells. Increase the size gradually as confidence grows, rather than jumping straight to a large maze.

    Does the wall-following rule always work?

    In a perfect maze, yes. Keeping one hand on the wall will eventually lead you to the exit, though it may not be the shortest route.

    Can two people solve the same maze?

    Yes. Share the seed and the size, and both people can generate the identical maze on their own devices.