Binary Search Visualizer

Step through binary search on a sorted array, inspect low, high, and mid indexes, and compare exact search with lower bound search.

Values
8
Low
0
High
7
Mid
-

Array input

The tool sorts numeric input before running binary search.

Step controls

Step 1 of 5: Start exact search for 11.

Search range

Start exact search for 11.

Range Mid Result
0
1
1
3
2
5
3
7
4
9
5
11
6
13
7
15

Current comparison

Target
11
Mode
Exact
Mid value
-
Result
-

Result

target = 11
result = not available in this step

What is a Binary Search Visualizer?

A binary search visualizer shows how an algorithm repeatedly cuts a sorted search range in half. The range starts with a low index and a high index, then each step checks the middle value.

This tool supports exact target search and lower bound search. It is useful for understanding sorted array problems, boundary updates, and common coding interview patterns.

For the full cluster of related tools, browse the Data Structure Visualizers hub.

How to use this binary search visualizer

  • Paste an array such as [1, 3, 5, 7, 9, 11, 13].
  • Choose exact search or lower bound mode.
  • Enter the target value.
  • Step through each low, high, and mid update.
  • Compare the highlighted range with the current comparison and final result.

Exact search vs lower bound

Exact binary search stops when the middle value equals the target. If the target is not found, the algorithm returns no matching index.

Lower bound binary search finds the first index whose value is greater than or equal to the target. This pattern is useful for insertion positions, threshold problems, and “first valid answer” searches.

Compare this page with the Two Pointers Visualizer, Sliding Window Visualizer, and Sorting Algorithm Visualizer.

Frequently Asked Questions

What input format does this binary search visualizer use?
Paste an array, comma-separated list, or space-separated list of numbers.
Does the tool sort my input?
Yes. Binary search needs sorted values, so the tool sorts numeric input before generating the steps.
What does lower bound mean?
Lower bound means the first index where the value is greater than or equal to the target.
Can binary search work with duplicate values?
Exact search may stop at any matching value. Lower bound is the better mode when you need the first matching or greater index.

Related tools