Logarithm Calculator

Find a logarithm in any base and read it as the number of digits or doublings involved.

Logarithm
Adjust the inputs

Your result updates live as you type.

A logarithm answers the question "what power do I need?". If 10³ = 1000, then log₁₀(1000) = 3. It is the inverse of exponentiation, and it turns multiplication into addition — the property that made slide rules and log tables the calculating tools of three centuries.

Three bases dominate. Base 10 counts orders of magnitude, so its integer part is one less than the number of digits. Base 2 counts doublings, which is why it appears throughout computing and in the depth of binary search. Base e, the natural logarithm, is the one that comes out of calculus, since the derivative of ln(x) is simply 1/x. Any base converts to any other by dividing by the log of the new base, and this page shows that step rather than hiding it.

The formula

logb(x) = ln(x) ÷ ln(b)
x
The number whose logarithm you want; it must be positive
b
The base of the logarithm
ln
The natural logarithm, base e ≈ 2.718282
log₂
The base-2 logarithm, which counts doublings

How it works, step by step

  1. Enter a positive number.
  2. Choose or type the base you want.
  3. The gauge shows the logarithm in your chosen base.
  4. The other common bases and the digit count appear below.

Worked examples

log₁₀(1000)

1000 is 10³, so the logarithm is exactly 3. Via change of base that is ln(1000) ÷ ln(10) = 6.9078 ÷ 2.3026 = 3.0. The integer part plus one gives the digit count, which is 4.

Doublings to reach a million

log₂(1,000,000) = 19.9316, so twenty doublings from one gets you to 1,048,576 — just past a million. That is the reason binary search over a million records needs only about twenty comparisons.

How to read your score

—–0NegativeThe number is below one, so its logarithm is negative.
0–3SmallUp to about a thousand in base 10.
3–8ModerateThousands to hundreds of millions in base 10.
8–—LargeA very big number, or a base close to one.

Frequently asked questions

Why can I not take the log of zero or a negative number?

Because no power of a positive base produces them. As the input approaches zero the logarithm falls without limit, so there is no value to assign. Negative inputs need complex logarithms.

What is the change-of-base formula for?

It lets one implementation serve every base. log_b(x) = ln(x) ÷ ln(b), so a calculator with only natural logs can produce any base you like.

Why is base e called natural?

Because it falls out of calculus without being chosen. The derivative of ln(x) is 1/x with no constant attached, and e is the only base for which that is true.

How does a logarithm give the number of digits?

Take the floor of the base-10 logarithm and add one. For 1000 that is 3 + 1 = 4 digits. The same trick in base 2 gives the number of bits.

Logarithms in three bases

The same numbers across common bases
xlog₁₀log₂ln (base e)Digits in base 10
20.30101.00000.69311
101.00003.32192.30262
1002.00006.64394.60523
2562.40828.00005.54523
1,0003.00009.96586.90784
1,0243.010310.00006.93154
1,000,0006.000019.931613.81557

Where x is an exact power of the base, the logarithm is a whole number.

Related calculators