EditSafely

Generate a Maze

Create mazes of any complexity. Runs entirely in your browser, so your data never leaves your device.

Output

The result appears here as you type.

Options

How to use Generate a Maze

  1. 1. Set the maze's grid size. Enter Rows and Columns for how many cells the maze contains. A 15x15 grid is a good balance between solvable in a minute and interesting enough to require real navigation.
  2. 2. Size the drawing. Set Width (px) and Height (px) to fit the grid at a comfortable cell size. Larger canvases keep corridors wide enough to trace by hand or with a pencil.
  3. 3. Pick colors and line width. Choose Line color, Background color and Line width for the corridor walls, balancing legibility against how the maze will be printed or displayed.
  4. 4. Review the rendered maze. The tool generates a perfect maze, with exactly one path between any two cells, entering at the top left and exiting at the bottom right, drawn as an SVG.

When to use Generate a Maze

Generate a Maze builds a perfect maze using recursive backtracking, meaning every cell is reachable and there is exactly one path between the entrance and exit. It is for puzzle sheets, game levels and algorithm demonstrations that need a fresh, correctly generated labyrinth on demand.

  • Printing a puzzle page for kids. A 15x15 maze at a comfortable line width prints cleanly on a single sheet for a classroom activity or a puzzle book page, with a clear entrance and exit.
  • Teaching recursive backtracking algorithms. Computer science courses covering maze generation algorithms can show a live example of recursive backtracking output, then discuss how the algorithm guarantees a perfect maze with no loops.
  • Prototyping a game level layout. A roguelike or puzzle game prototype needs a quick maze layout to test pathfinding or line-of-sight code before investing in hand-designed levels.
  • Generating varied difficulty puzzles. Increasing Rows and Columns produces a larger, more challenging maze for advanced puzzle solvers, while a small grid suits younger children or a quick warm-up activity.

Examples

A 15×15 maze

Output

An SVG maze with an entrance at the top left and an exit at the bottom right.

About the Generate a Maze tool

Generate a Maze does its work locally, right in the browser. Create mazes of any complexity. There is no upload step, no queue and no account, and your data never travels over the network.

It belongs to the Math Tools collection on EditSafely, a set of 234 small, focused Math utilities that share the same instant, private workspace.

You can shape the output with 7 settings, including Rows, Columns, Width (px) and Height (px), and the result refreshes the moment you change one. A worked example further down the page shows exactly what the tool produces for a real input.

Running locally also makes the tool fast and dependable: results appear as you type or drop a file, there is no server outage that can take it down mid-task, and confidential data can be processed without a second thought.

Frequently asked questions

Does Generate a Maze cost anything?

Yes, it is completely free. All 2,658 tools on EditSafely work without an account, a subscription or usage limits.

Does the generator send anything to a server?

No data leaves your device. The whole tool is JavaScript that runs inside your browser tab, so there is no upload, no server-side processing and no log of what you did. If you disconnect from the internet after the page loads, it keeps working.

How do I get a different result?

Run the generator again. Each run is computed fresh on your device, and any options you change are applied to the next result immediately.

Do I need to sign up or install anything?

Nothing to install and no account needed. Open the page in any up-to-date browser, including on a phone or tablet, and the tool is ready.

Can I save what the tool produces?

Yes. Use the download or copy controls in the output panel to keep the rendered result once it looks the way you want.

Related tools

All Math Tools