Maze Solver
Add a picture of a maze, check the start and end markers, and press Solve. Or draw your own maze.
This free Maze Solver finds the shortest route through a maze, whether you upload a picture of one or draw your own. It works as a maze solver online: you add a maze, and the tool draws the path from the start to the end on it, giving you a maze with solution in seconds.
Everything runs in your browser, so the picture never leaves your device. There is no sign-up. The tool has two modes. ‘Solve a picture’ works with a screenshot or a photo of a printed maze, and it can also solve the maze shown in a built-in example. ‘Draw your own’ lets you build a grid maze, solve it and count the steps of the shortest route.
How to use the Maze Solver
Solve a picture
- Select ‘Solve a picture’.
- Add your maze. Drop a PNG or JPG on the drop zone, click ‘Choose a picture’, or press Ctrl+V to paste a screenshot. To try the tool first, click ‘Try an example’.
- Check the start (green) and end (red) markers. The tool places them automatically by looking for gaps in the outer frame. To move them, tap the maze after clicking ‘Set start’ or ‘Set end’, then drag a marker where you need it.
- Click ‘Solve’. The shortest route is drawn on your picture.
- Click ‘Download solved PNG’ to save the result.
Draw your own
- Select ‘Draw your own’ and set ‘Grid size’ from 5 to 40.
- Tap or drag cells to draw walls, or click ‘Random walls’. Click ‘Clear walls’ to start over.
- Click ‘Place start’ and ‘Place end’, then tap a cell for each.
- Click ‘Solve’. The tool shows the shortest route and its number of steps, or says the walls block every way.
You can change the ‘Path colour’ (red, blue, green, orange, purple or black) and the ‘Path width’ before you download. ‘Wall thickening’ (0 to 6 px) and ‘Walls are light (white lines on dark)’ are also in the Solve a picture options, and both are explained below.
How does a maze solver work?
A maze solver treats the maze as a set of open spots and blocked spots, then finds the shortest path from the start to the end. This tool uses breadth-first search over the free pixels of your picture. Breadth-first search explores every position one step away from the start, then every position two steps away, and so on. The first time it reaches the end, it has found a shortest route.
Each position remembers the spot it was reached from, so the route can be traced back from the end to the start and drawn on the maze. If the search runs out of positions before it reaches the end, there is no route. For large pictures, the tool scales the image down to at most 800 px on the long side for the search, then draws the route on the original.
Can it solve a photo of a maze?
Yes. The tool first turns the picture black and white using an automatic threshold called Otsu’s method, then treats dark pixels as walls. A photo works best when the page is flat, the whole maze is in the frame, the light is even, and the lines are dark and thin. If your maze has white lines on a dark background, turn on ‘Walls are light (white lines on dark)’ so the walls are read correctly.
Blurry or uneven photos can produce broken walls, and a route can then slip through a gap that is not really there. Taking a sharper, flatter photo usually fixes this better than changing settings.
What if it says there is no path?
The message means the search found no open route between the two markers. Usually a narrow corridor was closed: ‘Wall thickening’ makes the walls thicker before the search so the route cannot slip through blurry gaps, but too much of it also seals real passages. Other causes are a picture whose walls are lighter than the paths, or a marker outside the maze.
If you see the message, try these in order:
- Lower ‘Wall thickening’, since high values can seal real paths shut.
- Turn on ‘Walls are light (white lines on dark)’ if the maze is light on a dark background.
- Crop the picture closer to the maze so there is less background.
- Move any marker that sits on a wall onto a corridor, then click ‘Solve’ again.
Frequently asked questions
Is my picture uploaded?
No. Everything runs in your browser, and the picture never leaves your device.
Can I solve a maze I draw myself?
Yes. Use ‘Draw your own’, set a ‘Grid size’ from 5 to 40, draw the walls, place the start and end, and click ‘Solve’. The tool shows the number of steps in the shortest route.
Why are the start and end markers in the wrong place?
The tool places them automatically by looking for gaps in the outer frame, so it can pick the wrong gap in some pictures, for example when the maze has a title or a picture around it. Click ‘Set start’ or ‘Set end’, tap the maze, and drag the marker to the correct corridor.
Can I save the solved maze?
Yes. After you click ‘Solve’, click ‘Download solved PNG’ to save the picture with the route. You can choose the ‘Path colour’ and ‘Path width’ first.
Does it work with circular or shaped mazes?
Yes. The search works on the pixels of the picture, not on a grid, so round and picture-shaped mazes solve the same way as square ones. If the markers are not found automatically, place them with ‘Set start’ and ‘Set end’.
Related tools
- Printable mazes : Print mazes with answer pages at six difficulty levels.
- Maze generator : Create a new maze, then use the solver to check its route.
- Easy mazes : Choose these for young children or first-time solvers.
- Hard mazes : Pick these when you want a longer, more challenging route.
- Maze worksheets : Use these in class or at home when you need a set of mazes on one page.
- Maze game online : Play through a maze yourself instead of watching the solver draw the route.
- Circular maze generator : Make a round maze when a standard square grid is not what you need.
- Christmas mazes : mazes shaped like a Christmas tree, star or snowman.
- Halloween mazes : pumpkin, ghost, bat and witch-hat mazes for October.
- Fall and Thanksgiving mazes : leaf, turkey and other seasonal shapes.
- Dinosaur and animal mazes : Choose animal-themed mazes for younger solvers.