AnyTool
Your files never leave your device. All processing happens locally in your browser.

How do I generate a maze I can play or print?

Open AnyTool Maze Generator, pick a size (Small, Medium, Large or Huge) and an algorithm, then tap New Maze — a fresh maze is carved in your browser. Every maze is “perfect”: there is exactly one path from the green start (top-left) to the red finish (bottom-right), so it is always solvable. Play it right there with arrow keys, WASD or a finger-drag to trace your route, toggle Show Solution to reveal the gold path, or hit Print for a clean maze with the answer on a separate page. Nothing is uploaded.

  • Four sizes (Small 12×12 → Huge 45×45) — every maze is solvable with exactly one path
  • Two algorithms: recursive backtracker (long corridors) or randomized Prim’s (bushier)
  • Play in-browser: arrow keys / WASD / drag to trace, step back to undo, reach the finish to win
  • Show Solution overlays the unique shortest path (gold) from start to finish
  • Print a clean maze with an optional separate solution page · 100% in your browser, nothing uploaded

What is

Maze Generator

A maze generator creates a grid of cells joined by passages so that you can travel from an entrance to an exit. AnyTool generates a perfect maze — a spanning tree of the grid in which there is exactly one path between any two cells, with no loops and no isolated areas — so the maze is guaranteed solvable with a single unique route. Passages are carved by the recursive backtracker (randomized depth-first search) or randomized Prim’s algorithm, and the solution is found by breadth-first search.

Generators

Related terms

Perfect mazeSpanning treeRecursive backtrackerRandomized Prim’sBreadth-first search

Frequently Asked Questions

Yes. Each maze is a perfect maze — a spanning tree — so there is exactly one path from start to finish, guaranteed solvable and verified by the solver.

AnyTool carves passages until every cell is connected into a single spanning tree of the grid. In a spanning tree there are no loops and no cut-off regions, so there is exactly one path between any two cells — including from the green start at the top-left to the red finish at the bottom-right. That makes every maze guaranteed solvable by construction, and a breadth-first search confirms and draws the unique route. You will never get a broken, looping or unsolvable maze.

Size sets the grid (Small 12×12 to Huge 45×45) — bigger is harder. The algorithm changes the style: backtracker makes long corridors, Prim’s makes bushier short branches.

Four sizes scale the difficulty: Small (12×12) is quick, Medium (20×20) and Large (30×30) are meatier, and Huge (45×45) has many cells and a long winding solution. The algorithm changes the character of the maze rather than whether it is solvable. The recursive backtracker (randomized depth-first search) explores as far as possible before backtracking, producing long, river-like corridors with fewer junctions that tend to feel harder. Randomized Prim’s grows outward from a seed into random frontier cells, producing a bushier maze with many short dead ends. Both always yield a perfect, single-solution maze.

Both. Trace your route with arrow keys, WASD or a drag and reach the finish to win — or print a clean maze with the solution on its own page.

You can solve the maze interactively: use the arrow keys or WASD, or drag with a finger or mouse from the green start, to trace a path; stepping back undoes a move, walls simply block you, and reaching the red finish shows a win. Tap Show Solution to overlay the unique gold path whenever you are stuck. When you would rather solve on paper, Print opens a crisp, vector-sharp maze you can send to your printer, and a second option adds the solution on a separate page. For clean printed lines, print at 100% / actual size rather than “fit to page”.

Yes. It is free, needs no account, and runs entirely in your browser — nothing is uploaded, logged or stored, and it works offline once cached.

AnyTool Maze Generator is completely free with no sign-up. Every maze is carved, solved and printed locally using your browser and the Web Crypto API for randomness (never Math.random). Your mazes, your traced path and the solution never leave your device — they are not uploaded, logged or saved, so closing the tab discards everything. There is no tracking, and the page works offline after its first load.

Detailed Explanation

Methodology

How AnyTool Carves a Guaranteed-Solvable Maze

Generation runs entirely in the browser and always produces a perfect maze — a spanning tree of the grid in which exactly one path connects any two cells, with no loops and no isolated regions. Two algorithms are offered, both fed crypto-secure randomness from the Web Crypto API (crypto.getRandomValues via rejection sampling, never Math.random). The recursive backtracker is a randomized depth-first search implemented with an explicit stack (so it never overflows the call stack on large grids): from the current cell it shuffles the four directions, carves into the first unvisited neighbour and pushes it, backtracking when a cell has no unvisited neighbours — producing long, winding corridors with relatively few junctions. Randomized Prim’s instead grows the maze outward from a random seed by repeatedly picking a random frontier wall between an in-maze cell and an outside cell and carving through it, yielding a bushier maze with many short branches. Because both build a single spanning tree, the start (top-left) and finish (bottom-right) are always connected by exactly one route, which a breadth-first search then traces as the solution.

  • Every maze is a perfect maze — a spanning tree with exactly one path between any two cells
  • Recursive backtracker = iterative randomized DFS (explicit stack, safe on huge grids)
  • Randomized Prim’s grows from a seed into random frontier cells for a bushier look
  • All randomness from the Web Crypto API (crypto.getRandomValues), never Math.random
  • Guaranteed solvable; BFS finds the unique start-to-finish path; nothing is uploaded
How It Works

Sizes, Algorithms and What Makes a Maze Harder

AnyTool offers four sizes — Small (12×12), Medium (20×20), Large (30×30) and Huge (45×45). Larger grids hold more cells and a longer, more winding solution, so they are objectively harder to solve and to scan by eye. The algorithm changes the maze’s character rather than whether it is solvable: the recursive backtracker explores as far as possible before backtracking, so it carves long river-like corridors with fewer decision points and tends to feel tougher, while randomized Prim’s spreads outward and creates many short dead ends that read as a busier, branchier maze. Whichever you pick, the result is always a perfect single-solution maze with a guaranteed route from start to finish. The start is fixed at the top-left and the finish at the bottom-right so the maze prints and reads consistently.

  • Four sizes: Small 12×12, Medium 20×20, Large 30×30, Huge 45×45
  • Bigger grid = more cells and a longer winding solution = harder
  • Backtracker = long corridors (harder feel); Prim’s = bushy short branches
  • Algorithm changes style, not solvability — always exactly one solution
  • Start fixed top-left, finish fixed bottom-right for consistent play and print
Use Cases

Playing In-Browser and Printing for Offline Use

The maze is fully interactive: trace a route from the green start using the arrow keys or WASD, or drag with a finger or mouse cell by cell. Walls simply block movement, stepping back onto the previous cell undoes the last move, and reaching the red finish shows a win with your step count. A Show Solution toggle overlays the unique shortest path in gold whenever you are stuck, and Restart trace clears your path to start over. For offline solving, Print opens a clean, vector-sharp SVG maze, and a second option appends the solution on its own separate page; printing is done locally with no upload, and the tool works offline once cached. For crisp lines, print at 100% / actual size rather than “fit to page” scaling.

  • Play with arrow keys, WASD or a finger/mouse drag; step back to undo
  • Walls block movement; reach the red finish to win with your step count
  • Show Solution overlays the unique shortest path; Restart trace clears your route
  • Print a clean vector maze, optionally with the solution on a separate page
  • Your maze, traced path and solution stay in the browser — never uploaded or stored
Maze generator: in-browser (AnyTool) vs typical online maze tools
CapabilityAnyToolTypical online maze tools
SolvabilityPerfect maze — exactly one guaranteed path, BFS-verifiedUsually solvable, not always verified
RandomnessWeb Crypto CSPRNG (no modulo bias)Usually Math.random
ProcessingCarved and solved in your browserOften server-side or pre-baked
AlgorithmsRecursive backtracker and randomized Prim’sOften a single fixed method
SizesSmall 12×12 → Huge 45×45Varies
Interactive playArrow keys / WASD / drag to trace, undo, win detectionOften image-only / print-only
SolutionToggle on-screen overlay + separate printable pageSometimes, may be gated
PrintingClean vector maze + optional solution page, localSometimes raster only
PrivacyNever uploaded, not stored, works offlineMay transmit or log
Cost / signupFree, no signupOften ad-heavy or gated

AnyTool carves and solves every maze locally with crypto-secure randomness and uploads nothing.