Part of the Math & Statistics suite · 235 calculators

Log Base 2 Calculator

The binary logarithm — how many times you double from 1 to reach your number, and the bits it takes to store it.

log₂(x) answers "2 to what power gives x?".

Results update as you type
Results
log base b of x
10
log₁₀(x)
ln(x)
log₂(x)
Check: b raized to the result
Reviewed September 2026. Pure mathematics: the result does not depend on where you are. Terminology follows US usage (math, parentheses, decimal point).
No account required · Google Analytics off unless allowedCalculator arithmetic runs in your browserResults update as you type
All calculations run 100% in your browser. The calculator code does not submit your figures to GlobalCalc to obtain a result.
About log base 2

How the log base 2 calculator works

log₂(x) answers "2 to what power gives x?". It is the logarithm of computing: the number of bits needed to represent x distinct values is log₂(x) rounded up, and the number of halvings a binary search needs through n items is log₂(n). It is also the doubling count — anything growing by 100% each step reaches x after log₂(x) steps.

Formula: log_b(x) = ln(x) / ln(b)

Worked examples

Inputslog base b of xNote
log₂ 10241010 — ten doublings, and 10 bits
log₂ 25688 — one byte
log₂ 1,000,00019.931568569319.93 — so 20 bits

Frequently asked questions

What is log base 2?

The power you raize 2 to in order to get your number: log₂ 32 = 5.

How many bits do I need for n values?

log₂(n) rounded up — 1,000 values need 10 bits, since 2¹⁰ is 1,024.

Why does binary search take log₂ n steps?

Because each comparison halves what is left, so the count of halvings is the binary log.

What is log₂ of a million?

19.93, so a million values fit in 20 bits.

Is it related to doubling time?

Directly — anything that doubles each period reaches x after log₂(x) periods.

Where these figures come from

Last checked: September 2026. Formulas are fixed by mathematics and do not change with tax years or regulations.