Skip to main content
Z

BFS Visualizer — Interactive Breadth-First Search

Interactive breadth-first search on a grid — draw walls, move start/goal, generate mazes, step through the level-by-level expansion. Runs in your browser.

Free No signup Client-side Privacy friendly Updated

Move the indigo token with / WASD (or tap an adjacent cell) from the green start to the red goal. Walls block you.

Moves: Time: 🎉 Reached the goal!
/

Pseudocode

How to use

  1. 1 Draw walls by clicking and dragging; drag the green start or red goal to move them.
  2. 2 Press Play to watch BFS expand level by level from the start.
  3. 3 Use Maze for instant obstacles, or Step one node at a time.
  4. 4 On an unweighted grid the path BFS finds is guaranteed shortest (fewest cells).

Why use this tool

  • See the frontier grow outward in expanding rings — the signature of BFS.
  • Understand why BFS finds the shortest path on unweighted graphs.
  • Compare its even expansion with DFS (which dives deep) and A* (which aims at the goal).
  • Runs entirely in your browser. No signup, no uploads.

Frequently asked questions

What is breadth-first search?

BFS explores a graph level by level using a queue: it visits all neighbors of a node before moving on to their neighbors. On an unweighted graph it finds the shortest path.

What is the time complexity of BFS?

O(V + E) — every vertex and edge is examined once, where V is vertices and E is edges.

Does BFS always find the shortest path?

On unweighted graphs, yes. For weighted graphs use Dijkstra or A*, which account for edge costs.

How is BFS different from DFS?

BFS uses a queue and expands outward in rings (shortest path on unweighted graphs); DFS uses a stack and dives as deep as possible before backtracking (no shortest-path guarantee).

What is Breadth-First Search (BFS) Visualizer?

A Breadth-First Search (BFS) Visualizer animates how BFS explores a grid level by level using a queue, expanding outward in rings from the start. On an unweighted grid it finds the shortest path, which is highlighted when the goal is reached.

Features

Step-by-step animation

Watch the queue expand the frontier one level at a time.

Complexity

Time: O(V + E). Space: O(V). Finds shortest paths in unweighted graphs.

100% private

Runs entirely in your browser — nothing is uploaded.

Example

Input

graph 1–2, 1–3, 2–4, 3–4; start 1

Output

visit order: 1 → 2 → 3 → 4 (level by level)

Common use cases

  1. 1

    Shortest path (unweighted)

    See why BFS gives the fewest-edges path from a source.

  2. 2

    Level-order traversal

    Explore a graph or tree layer by layer.

  3. 3

    Connectivity & reachability

    Find which nodes are reachable from a start.

Summary

Zerethon's BFS visualizer animates breadth-first search on a graph in your browser, exploring level by level from a source using a queue. BFS runs in O(V + E) time with O(V) space, and finds the shortest path (fewest edges) in an unweighted graph.

Category
Algorithm
Pricing
Free
Privacy
Browser-based
Signup
Not required

References

Privacy

Your data never leaves your browser unless explicitly stated. Breadth-First Search (BFS) Visualizer runs entirely client-side — no server upload, no logging, no tracking of your input.

New to this? Read the step-by-step explanation with Big-O analysis: Learn Graph Algorithms →

Compare

Related tools

Build, share, and grow on Zerethon Social

Free signup. Earn points, collect achievements, and connect with creators worldwide.

Sign up free