Z

Binary Search Visualizer — Animated, Step-by-Step

Animated binary search over a sorted array with target input, step controls, speed, live comparison counter and pseudocode. Runs in your browser.

Free No signup Client-side Privacy friendly Updated
/
Comparisons: Swaps / writes: Array accesses:

Code examples

Ready-to-copy reference implementations. Free to use in your own projects and assignments.

How to use

  1. 1 Set a Target value (the array is kept sorted automatically for binary search).
  2. 2 Press Play to watch the search halve the range each step, or Step through it.
  3. 3 Type your own numbers into Custom input and press Apply — they will be sorted.
  4. 4 Follow the highlighted pseudocode and the lo / mid / hi range as it narrows.

Why use this tool

  • See how each comparison eliminates half of the remaining elements.
  • Understand why binary search is O(log n) — the range shrinks geometrically.
  • Watch the dimmed region grow as candidates are ruled out.
  • Runs entirely in your browser. No signup, no uploads.

Frequently asked questions

What is binary search?

Binary search finds a target in a sorted array by repeatedly comparing the middle element and discarding the half that cannot contain the target.

What is the time complexity of binary search?

O(log n) in the average and worst case because each comparison halves the search space. Best case is O(1) when the target is the first midpoint.

Does binary search need a sorted array?

Yes. Binary search only works on sorted data — that is why this visualizer sorts your input before searching. On unsorted data use linear search.

How is binary search different from linear search?

Linear search checks every element in order (O(n)); binary search jumps to the middle and halves the range (O(log n)), but it requires the data to be sorted first.

What is Binary Search Visualizer?

A Binary Search Visualizer animates how binary search locates a target in a sorted array by repeatedly comparing the middle element and discarding the half that cannot contain it. It shows the shrinking lo–hi range and the comparison count that make binary search O(log n).

Summary

Binary Search Visualizer is a free algorithm utility by Zerethon Tools. Animated binary search over a sorted array with target input, step controls, speed, live comparison counter and pseudocode. 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. Binary Search Visualizer runs entirely client-side — no server upload, no logging, no tracking of your input.

Related tools

Build, share, and grow on Zerethon Social

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

Sign up free