Binary Search Visualizer
Visualize how binary search finds a target in a sorted list, showing each midpoint comparison and the number of steps it takes.
Last reviewed by the Radiatus Cloud team
Visualize binary search finding a target in a sorted list, step by step.
Need this done properly for your business?
Radiatus delivers secure cloud, DevOps & compliance engineering.
Visualize binary search
Binary search is a fast method for finding a value in a sorted list by repeatedly halving the search range. This visualizer takes a sorted list and a target, then shows each step: it checks the middle element, and if that is not the target, it discards the half that cannot contain it and searches the other half. The tool reports whether the target was found, how many steps it took, and the theoretical maximum. Finding a value in a ten-item list takes at most four comparisons.
The list is sorted automatically before searching, since binary search only works on sorted data.
Why binary search is fast
Because each step eliminates half of the remaining elements, binary search finds a target in a number of steps proportional to the logarithm of the list size, rather than checking every element. This means searching a million sorted items takes only about twenty comparisons. It is one of the most important algorithms in computer science and a cornerstone of efficient data handling, but it requires the data to be sorted first.
Seeing the midpoints and the shrinking range makes the logarithmic efficiency tangible. All calculation happens locally in your browser.
Related tools
- Data Collection Analysis — Analyze app description to infer data collection.
- Dark Pattern Detector — Scan UX text for manipulative patterns.
- AI Risk Disclosure — Generate disclosure text for AI features.
- Maturity Radar — Generate a radar chart of security maturity.
Frequently Asked Questions
How does binary search work?
It checks the middle of a sorted range, then discards the half that cannot contain the target and repeats on the other half until it finds the value or the range is empty.
Why must the list be sorted?
Binary search relies on knowing which half to discard based on the middle value, which only works if the data is in order.
How many steps does it take?
At most about the base-two logarithm of the list size, so a million items need only around twenty comparisons.
What if the target is not present?
The range shrinks to empty without a match, and the tool reports that the target was not found after the steps it took.
Privacy & Security
Everything runs in your browser; nothing is uploaded.
How to Use
Enter a sorted list of numbers and a target to find.
Disclaimer: This tool is provided "as is" without warranty of any kind. Results are for educational and utility purposes.