DFS Visualizer — Interactive Depth-First Search
Interactive depth-first search on a grid — draw walls, move start/goal, generate mazes, step through the deep-dive exploration. Runs in your browser.
Click & drag on the grid to draw walls · drag the green and red squares to move start / goal · then press Play.
Pseudocode
Time · Space
How to use
- 1 Draw walls by clicking and dragging; drag the green start or red goal to move them.
- 2 Press Play to watch DFS dive deep down one path before backtracking.
- 3 Use Maze for instant obstacles, or Step one node at a time.
- 4 The path DFS finds reaches the goal but is usually not the shortest.
Why use this tool
- See DFS commit to a single direction and backtrack only when it gets stuck.
- Understand why DFS does not guarantee the shortest path.
- Compare its deep dives with the even rings of BFS and the goal-seeking of A*.
- Runs entirely in your browser. No signup, no uploads.
Frequently asked questions
What is depth-first search?
DFS explores a graph by going as deep as possible along each branch before backtracking, typically using a stack (or recursion).
What is the time complexity of DFS?
O(V + E) — like BFS, it examines each vertex and edge once.
Does DFS find the shortest path?
No. DFS finds a path if one exists, but it follows whichever branch it enters first, so the result is usually longer than the shortest path. Use BFS, Dijkstra, or A* for shortest paths.
What is DFS good for?
Topological sorting, cycle detection, connected components, maze generation, and any problem where you need to fully explore structure rather than find the closest target.
What is Depth-First Search (DFS) Visualizer?
A Depth-First Search (DFS) Visualizer animates how DFS explores a grid by diving as deep as possible along one branch before backtracking, using a stack. It finds a path to the goal but, unlike BFS, the path is usually not the shortest.
Depth-First Search (DFS) Visualizer is a free algorithm utility by Zerethon Tools. Interactive depth-first search on a grid — draw walls, move start/goal, generate mazes, step through the deep-dive exploration. Runs in your browser. Runs entirely in the browser — no signup, no upload.
- Category
- Algorithm
- Pricing
- Free
- Privacy
- Browser-based
- Signup
- Not required
Privacy
Your data never leaves your browser unless explicitly stated. Depth-First Search (DFS) Visualizer runs entirely client-side — no server upload, no logging, no tracking of your input.
Related tools
Dijkstra's Algorithm Visualizer
Interactive Dijkstra pathfinding on a grid — draw walls, move start/goal, generate mazes, step through the search. Runs in your browser.
Open toolA* Pathfinding Visualizer
Interactive A* pathfinding on a grid with a Manhattan heuristic — draw walls, move start/goal, generate mazes, step through the search. Runs in your browser.
Open toolBreadth-First Search (BFS) Visualizer
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.
Open toolBubble Sort Visualizer
Animated bubble sort with step controls, speed, custom input, live comparison/swap counters and pseudocode. Runs entirely in your browser.
Open toolBuild, share, and grow on Zerethon Social
Free signup. Earn points, collect achievements, and connect with creators worldwide.