What Is Maze Generator & Solver?
A free online maze generator and solver. Generate random mazes using Depth-First Search or Prim's algorithm, then find the shortest path with BFS pathfinding. Watch the solution light up from start (green) to finish (red). Perfect for game developers, puzzle enthusiasts, and algorithm learners.
Mazes have fascinated humans for thousands of years — from the mythological Labyrinth of Crete to modern puzzle books and video games. Maze Generator & Solver creates random mazes using two different algorithms and then finds the shortest path through them, turning algorithmic concepts into a visual and interactive experience.
Two generation algorithms offer different maze styles: DFS (Depth-First Search) creates long, winding corridors with few dead ends, resulting in a maze that feels more like a single winding path. Prim's algorithm creates shorter, more branching passages with more dead ends, producing a maze that is more challenging to solve with its many branches.
The generated maze appears as a grid of cells with walls between them. The start cell is marked green (top-left), and the finish cell is marked red (bottom-right). Click Solve to find the shortest path from start to finish using BFS (Breadth-First Search). The solution path lights up in amber, clearly showing the route through the maze.
Click Generate to create a new random maze — each generation is unique. The underlying algorithm ensures every generated maze is solvable (there is always a path from start to finish) and has only one solution (no loops that create alternative paths). The grid size is optimized for visual clarity on screen.