All toolsPathfinding Visualizer

Developer tool

Pathfinding & Search Algorithm Visualizer

Watch BFS, DFS, Dijkstra's, A*, and Greedy Best-First explore a grid and find a path. Everything runs in your browser.

Search
Board
Speed
Edit grid

About this tool

See how search algorithms explore

Graph search algorithms power routing, games, and network analysis, but their behavior is hard to picture from pseudocode alone. This visualizer runs BFS, DFS, Dijkstra's, A*, and Greedy Best-First on a grid so you can watch each one expand its frontier, discover the goal, and trace a path in real time.

Draw walls to block cells and weights to make cells costly to cross, then compare algorithms on the same map. Breadth-First Search and Dijkstra's guarantee the shortest and lowest-cost path respectively, A* reaches that same optimal path while exploring far fewer nodes, and Depth-First and Greedy Best-First trade optimality for speed. Movement is four-directional and A* and Greedy use the Manhattan-distance heuristic.

How it works

Visualize a search in three steps

  1. 1Build the grid

    Drag to draw walls and weighted cells, or move the start and goal nodes anywhere.

  2. 2Pick an algorithm

    Choose BFS, DFS, Dijkstra's, A*, or Greedy Best-First and set the animation speed.

  3. 3Press Visualize

    Watch the frontier expand, then see the discovered path, nodes explored, length, and cost.

Common questions

Search algorithm FAQ

Which algorithm finds the shortest path?

On an unweighted grid, BFS finds a path with the fewest steps. When cells have different costs, Dijkstra's and A* find the lowest-cost path. DFS and Greedy Best-First are fast but are not guaranteed to find the shortest path.

What is the difference between Dijkstra's and A*?

Both find the lowest-cost path. Dijkstra's expands outward purely by accumulated cost, while A* adds a Manhattan-distance heuristic that steers the search toward the goal. A* usually explores far fewer nodes to reach the same optimal path.

What do the weighted cells mean?

A weighted cell costs more to move into than a normal cell. Dijkstra's and A* account for that cost and will detour around heavy regions, while BFS and DFS treat every open cell the same, so they may cross expensive cells.

Why does BFS guarantee the shortest path but DFS does not?

BFS explores the grid in expanding layers, so the first time it reaches the goal it has used the fewest possible steps. DFS follows one branch as deep as it can before backtracking, so it often reaches the goal by a long, winding route.

Does this run on my device?

Yes. Every algorithm runs entirely in your browser. Nothing about the grid you draw is uploaded or stored by UtilityBase.