Statistics
A* (A-Star)
A* combines Dijkstra's guaranteed shortest path with a heuristic that guides the search toward the goal, making it faster while maintaining optimality.
Draw walls, place start and end points, and watch algorithms find the shortest path
Draw walls on the grid, place start and end points, and watch pathfinding algorithms explore and find the optimal route in real-time. Compare A*, Dijkstra, BFS, DFS, and Greedy Best-First Search.
A* combines Dijkstra's guaranteed shortest path with a heuristic that guides the search toward the goal, making it faster while maintaining optimality.
A* is an informed search algorithm that uses both the cost to reach a node (g) and an estimated cost to the goal (h, the heuristic). It evaluates nodes using f = g + h and always expands the node with the lowest f value. With an admissible heuristic like Manhattan distance, A* guarantees the shortest path while exploring fewer nodes than Dijkstra.
Dijkstra's algorithm is a classic graph traversal method that explores nodes in order of their distance from the start. It uses a priority queue to always process the closest unvisited node next. While it guarantees the shortest path, it explores in all directions equally without considering the goal location, making it slower than A* for single-target searches.
BFS explores all nodes at distance d from the start before exploring nodes at distance d+1, using a queue (FIFO). On unweighted grids, BFS guarantees the shortest path because it finds the goal at the shallowest depth first. It's simple and complete but doesn't use edge weights or heuristics.
DFS explores as far as possible along each branch before backtracking, using a stack (LIFO). It does not guarantee the shortest path and can get stuck exploring long paths before finding the goal. However, it uses less memory than BFS and can be useful for maze generation or exploring all possible paths.
Greedy BFS uses only the heuristic (h) to prioritize nodes, always moving toward the node that appears closest to the goal. While very fast in simple cases, it does not guarantee the shortest path and can be misled by obstacles, exploring suboptimal routes before finding the goal.
| Algorithm | Weighted? | Shortest Path? | Time Complexity | Space Complexity |
|---|---|---|---|---|
| A* | Yes | Yes (with admissible heuristic) | O(b^d) |
O(b^d) |
| Dijkstra | Yes | Yes | O((V + E) log V) |
O(V) |
| BFS | No | Yes (unweighted) | O(V + E) |
O(V) |
| DFS | No | No | O(V + E) |
O(h) (h = height) |
| Greedy BFS | No | No | O(b^m) |
O(b^m) |
V = vertices, E = edges, b = branching factor, d = depth of solution, m = maximum depth, h = height of tree
This pathfinding visualizer runs entirely in your browser using JavaScript. No grid configurations, algorithms, or any data are transmitted to our servers or any third party. Your learning and experimentation remain completely private.
Check if a number is prime and see a quick reason
Visualize a fraction and see the simplified form
Generate a multiplication table up to any size
Common unit circle angles with sine and cosine values
Calculate GPA from course grades and credit hours
Calculate required final exam score for target grade
Pathfinding Algorithm Visualizer is a free education tool that helps you Watch A*, Dijkstra, BFS, DFS, and Greedy BFS find paths on an interactive grid.
Enter your input values, review the calculated output, and adjust inputs until you reach the result you need. The result updates in your browser.
Yes. Calculations run locally in your browser. Inputs are not uploaded to a server by default, and refreshing the page clears session data.
No. You can use this tool directly in your browser without sign-up or software installation.
This tool applies standard formulas or deterministic processing logic for estimates. For medical, legal, tax, or investment decisions, verify with a qualified professional.
You can bookmark this page and copy outputs manually. Results are not persisted in your account and are typically not embedded in the URL.
We review all requests and regularly add new tools based on your suggestions.
Suggest a feature, UI change, or variation for this tool.