A Star Pathfinding Visualizer

Paste a wall grid, choose a heuristic, then step through the A* open set, closed set, and reconstructed shortest path.

Cells
40
Open
1
Step
1/48
Cost
0

Grid input

Use S=start, G=goal, #=wall, and .=open. The parser keeps the first 12 rows and 14 columns.

Step controls

Start at (0, 0). g=0, h=9, f=9.

A* search grid

Blue is open, gray is closed, amber is current, and green is the best path.

Open Closed Path
S
#
#
#
#
#
#
#
#
#
#
#
G
#

Open set

Cellghf
(0, 0)099

Path output

heuristic = Manhattan
closed = 0
cost = 0
path = 1 cells

(0, 0)

What is an A Star Pathfinding Visualizer?

An A Star pathfinding visualizer shows how A* searches a grid by combining the known travel cost from the start with a heuristic estimate to the goal. It is useful for learning pathfinding, game AI, robotics maps, route planning, and shortest-path interview problems.

This tool lets you paste a grid, choose a heuristic, allow or disable diagonal movement, then step through the open set, closed set, and current best path.

For the full graph and data structure set, browse the Data Structure Visualizers hub.

How to use this A Star visualizer

  • Use S for the start cell and G for the goal cell.
  • Use # for walls and . for open cells.
  • Choose Manhattan, Euclidean, Chebyshev, or zero heuristic.
  • Click Run A* to jump to the final path, or step through the search manually.
  • Watch open cells, closed cells, and the reconstructed path update after each relaxation.

A Star vs Dijkstra

Abecomes Dijkstra’s algorithm when the heuristic is zero. With a useful heuristic, A usually expands fewer cells because it prioritizes nodes that look closer to the target.

Compare this page with the Dijkstra Algorithm Visualizer to see how a grid heuristic changes shortest-path search. For unweighted traversal without a target heuristic, use the Graph BFS DFS Visualizer or Matrix Traversal Visualizer.

Frequently Asked Questions

What input format does this A Star visualizer use?
Paste a grid with one row per line. Use S for start, G for goal, # for walls, and . for open cells.
What heuristic should I choose for A*?
Manhattan distance is a good default for four-direction grid movement. Chebyshev or Euclidean can make sense when diagonal movement is allowed.
Does A* always find the shortest path?
Yes, when the heuristic never overestimates the remaining cost. Manhattan distance is admissible for four-direction movement on a uniform grid.
How is A* different from Dijkstra?
A* ranks candidates by g + h, where g is known cost from the start and h is an estimate to the goal. Dijkstra only uses g.

Related tools