Skip to content
CalcTide logo
Education & Math

Log Base 2 Calculator

Log base 2 of 8 is 3, because 2 x 2 x 2 = 8. This log base 2 calculator finds the binary logarithm of any positive number, the exponent you raise 2 to in order to get your value. It also shows log base 10 and the natural log for comparison, and flags exact powers of two, the numbers computer science cares about most.

Education & MathBy

Quick answer

Log base 2 of a number asks, 2 raised to what power gives this number?

Log base 2

3

Log base 10

0.90309

Natural log (ln)

2.079442

Exact power of two

Yes

What this tells you

  • Log base 2 of a number asks, 2 raised to what power gives this number?
  • For exact powers of two the answer is a whole number. Log2 of 1024 is exactly 10.
  • For everything else it is a decimal. Log2 of 10 is about 3.32.
  • Binary logs show up anywhere things double or halve, like binary search steps, bits of information, and memory sizes.

How to Use

  1. 1Enter any positive number.
  2. 2Read the base-2 logarithm as the main result.
  3. 3Compare against log base 10 and the natural log below it.
  4. 4A note tells you when your input is an exact power of two.

How It Works

Formula

log2(x) = ln(x) / ln(2)

Any logarithm can be computed from another base by division, and the natural log is the usual bridge. Log2 of 10 is ln(10) / ln(2), which is 2.3026 / 0.6931, about 3.3219. The result is the power of 2 that produces your number, so 2 raised to 3.3219 is 10.

Calculation note: values are processed in the order shown above, using the current input units.

Worked Examples

Log base 2 of 8

Value8
Result3

2 to the power 3 is 8, so the binary log is exactly 3.

Log base 2 of 1,000,000

Value1000000
ResultAbout 19.93

A binary search over a million sorted items needs at most 20 comparisons.

Log base 2 of 0.5

Value0.5
Result-1

One half is 2 to the power -1, so logs of values below 1 are negative.

Log Base 2 of Common Values

Binary logarithms for values you meet in computing and math.

xlog2(x)
10
21
83
103.3219
1006.6439
2568
102410
104857620

Common mistakes

  • Taking the log of zero or a negative number. The logarithm is only defined for positive values.
  • Mixing up log2 and log10 on a calculator. Most calculators' log key is base 10, so log(8) shows 0.903, not 3.
  • Rounding too early in change-of-base division. Keep full precision in ln(x) and ln(2) until the final answer.

Frequently Asked Questions

3. Two multiplied by itself three times equals 8, so the exponent is 3.
Divide the natural log or base-10 log of your number by the same log of 2. For 10 that is 1 / 0.30103, about 3.3219.
About 3.3219. It means 2 raised to the power 3.3219 equals 10.
Because computers work in binary. Each doubling adds one bit, and each halving removes one, so binary search over n items takes about log2(n) steps.
Yes. Any input between 0 and 1 has a negative binary log. Log2 of 0.25 is -2.
Undefined. No power of 2 gives zero. As the input approaches zero the log heads toward negative infinity.
It estimates log base 2 calculator outputs using the visible inputs and formula assumptions on this page.

Explore More in Education & Math