A* Pathfinder

Oliver Geer, 2021. Source

- Upload your own maze and let your computer solve it!

This pathfinder uses the A* Algorithm to solve a maze in a PNG file. Each pixel is interpreted as a node, and the algorithm works by repeatedly calculating the overall costs of the neighbours of the node with the smallest cost so far. To make it quicker, a heuristic is used, where the node costs are weighted using the taxicab distance to the end. This makes it quicker, but makes it less certain that the shortest path has been found.

If you'd like to learn more about the A* shortest path algorithm, please see the (open source, AGPL) source code of this project, commented to show how it can be implemented in JS, and Isaac Computer Science, which explains it thoroughly.

Upload a maze

Upload an image file of your maze here. Pixel-art-style images with sizes around 150px × 150px work best. You can use a pixel-art editor like Piskel to create them. The algorithm will attempt to find a path from the top-left corner to the bottom-right corner. Use black pixels (i.e. rgb(0, 0, 0)) to represent barriers, and any other colour to represent walkable space.

Solving the Maze

Now, all you need to do is let your computer solve the maze!


Click a button to start.