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
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
- Enter a positive number.
- Choose or type the base you want.
- The gauge shows the logarithm in your chosen base.
- 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
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
| x | log₁₀ | log₂ | ln (base e) | Digits in base 10 |
|---|---|---|---|---|
| 2 | 0.3010 | 1.0000 | 0.6931 | 1 |
| 10 | 1.0000 | 3.3219 | 2.3026 | 2 |
| 100 | 2.0000 | 6.6439 | 4.6052 | 3 |
| 256 | 2.4082 | 8.0000 | 5.5452 | 3 |
| 1,000 | 3.0000 | 9.9658 | 6.9078 | 4 |
| 1,024 | 3.0103 | 10.0000 | 6.9315 | 4 |
| 1,000,000 | 6.0000 | 19.9316 | 13.8155 | 7 |
Where x is an exact power of the base, the logarithm is a whole number.