Log base 2
"How many times must 1 double to reach x?"
MATH TOOL
Compute log₂(x) for any positive number — exact for powers of two, with the change-of-base steps and the plain-English “how many doublings” reading.
"How many times must 1 double to reach x?"
That question is log base 2. Doubling 1 ten times gives 1,024 — so log₂(1,024) = 10. The calculator above answers it for any positive number: exact integers when x is a power of two, a clean approximation otherwise, plus the change-of-base arithmetic (log₂(x) = ln(x) ÷ ln(2)) that every scientific calculator uses under the hood.
Take x = 100. It is not a power of two — it sits between 2^6 (64) and 2^7 (128). Change of base: ln(100) = 4.6052, ln(2) = 0.6931, so log₂(100) = 4.6052 ÷ 0.6931 = 6.6439. Meaning: starting from 1, about 6.64 doublings reach 100 — six full doublings land at 64, and roughly two-thirds of a seventh doubling covers the rest.
| Output | Formula | What it means |
|---|---|---|
| log₂(x) | ln(x) ÷ ln(2) | The exponent n with 2^n = x. Exact integer for powers of two. |
| Precision | |computed − round| < 10⁻⁹ | “Exact” means x is a genuine power of two within double precision. |
| ln(x), log₁₀(x) | log₂(x) × 0.6931 / 2.3026 | The same number in the other two common bases, for cross-checking. |
| Doublings | n doublings from 1 | The plain-English reading: how many times 1 must double to reach x. |
Computing: bits, bytes, and binary search — searching a million sorted items takes about log₂(1,000,000) ≈ 20 comparisons. Music: each octave doubles frequency, so log₂ maps pitch exactly. Photography: f-stops and "stops" of exposure are doublings of light. Biology and finance: doubling time — at r% growth per period, it takes log₂(2)… rather: ln(2)÷ln(1+r) periods to double (the rule of 72 is this formula, rounded for mental math).
Results are accurate to full double precision (about 15 significant digits); the “exact” flag fires only when the computed value lands within 10⁻⁹ of an integer, which happens exactly for powers of two representable as doubles (2^⁻¹⁰⁷⁴ through 2^¹⁰²³). Logarithms are undefined for zero and negatives — the calculator refuses those with an explanation instead of a NaN.
Working the other direction? The binary, hex & decimal chart converts between bases, and the significant figures calculator keeps your precision honest.
Bright Side Kit. "Log Base 2 Calculator." https://brightoolbox.com/log-2-calculator/ Accessed October 22, 2026.10, exactly — 2^10 = 1,024. That is why a kilobyte is 1,024 bytes and old-timers still say ‘a K is 1,024.’ Try it on the log base 2 calculator above.
0 — because 2^0 = 1. More generally, log₂ of any number between 1 and 2 is a fraction between 0 and 1: log₂(1.5) ≈ 0.585.
Use change of base: log₂(x) = log₁₀(x) ÷ 0.3010, or ln(x) ÷ 0.6931. For powers of two, just count the doublings: 8 = 2^3, so log₂(8) = 3.
Because computers are binary: one bit doubles the number of representable values, so information, search depth, and tree height all grow in doublings. Saying an algorithm is O(log n) almost always means O(log₂ n).
Undefined in the reals — no real exponent makes 2^n negative. (Complex analysis extends it, but that is a different subject.) The calculator explains this instead of erroring silently.
They are the same idea: if something grows by a factor of 2 each period, log₂ tells you how many periods reach a target. For r% growth, doubling takes ln(2)÷ln(1+r) periods — the rule of 72 is this, rounded for mental math.
Undefined — 2^n is positive for every real n, so no exponent reaches 0. As x approaches 0 from above, log₂(x) dives toward negative infinity.