Part of the Math & Statistics suite · 235 calculators

Log Base 2 Calculator

The binary logarithm — how many doublings a number represents, and the unit behind bits, octaves and algorithmic complexity.

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

Results update as you type
Results
log₂ x
10
Natural log (ln x)
Log base 10
Is it an exact power of 2?
Next power of 2 at or above it
Bits needed to represent it
2 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 computed as ln x ÷ ln 2, since JavaScript's Math.log is natural.

It is the natural scale for anything that doubles: bits of information, octaves in music, levels in a binary tree, and the running time of a binary search on n items.

Formula: log₂ x = ln x / ln 2

Worked examples

Inputslog₂ xNote
102410exactly 10
1,000,00019.9315685719.93 — a million is just under 2²⁰
31.58496251.585

Frequently asked questions

What is log base 2 used for?

Anything that doubles: bits of information, octaves, binary tree depth, and the O(log n) running time of divide-and-conquer algorithms.

How many bits store a number?

⌈log₂(n+1)⌉. A million needs 20 bits.

Why is a million about 2²⁰?

Because 2¹⁰ = 1,024 ≈ 1,000, so 2²⁰ ≈ 1,048,576. That approximation is why a "megabyte" has two different meanings.

Can I take log₂ of a negative number?

Not in the reals. Logarithms of negatives are complex.

What is log₂ of 3?

1.585 — 3 sits between 2 and 4, closer to the upper end than a linear reading suggests.

Where these figures come from

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