Log Calculator: Logarithm to Any Base
Enter a number and a base. You will see the logarithm, the natural, common and binary logs of the number, and a check that the base raised to the answer gives the number back.
Last reviewed
log₁₀(1000)
3
exact: 10 to the power 3 is 1000
- Natural log, ln x
- 6.90775527898
- Common log, log₁₀ x
- 3
- Binary log, log₂ x
- 9.96578428466
- Check: 10 to the power 3
- 1000
log_b(x) = ln(x) ÷ ln(b). It asks: what power of b gives x? It is defined only for x greater than 0, and the base must be greater than 0 and not 1.
What a logarithm is
A logarithm asks a question: what power must I raise the base to, to get this number? If 10³ = 1,000, then the logarithm of 1,000 to the base 10 is 3, written log₁₀(1000) = 3. In general, log_b(x) = y means b^y = x. The logarithm is the reverse of an exponent, in the way that division is the reverse of multiplication.
MathWorld defines the logarithm of x to the base b as the power to which b must be raised to give x. The base must be positive and not 1, and x must be positive.
Three bases you will meet
| Name | Base | Written | Typical use |
|---|---|---|---|
| Common logarithm | 10 | log x or log₁₀ x | orders of magnitude, pH, decibels |
| Natural logarithm | e ≈ 2.71828 | ln x | growth and decay, calculus |
| Binary logarithm | 2 | log₂ x | computing, information, doubling |
The page shows all three for your number, whichever base you chose, so you can read the one you need.
The change of base rule
Most calculators have keys only for log₁₀ and ln. A logarithm to any other base comes from the change of base rule:
log_b(x) = ln(x) ÷ ln(b)
(or the same with log₁₀ in both places). For log₃(10): ln 10 = 2.302585 and ln 3 = 1.098612, so log₃(10) = 2.302585 ÷ 1.098612 = 2.0959. This page applies the rule in 40-digit arithmetic and shows 12 significant digits.
Worked examples
| Expression | Value | Because |
|---|---|---|
| log₁₀(1000) | 3 | 10³ = 1,000 |
| log₁₀(2) | 0.301029995664 | 10^0.30103 ≈ 2 |
| ln(10) | 2.30258509299 | e^2.30259 ≈ 10 |
| log₂(8) | 3 | 2³ = 8 |
| log₂(10) | 3.32192809489 | 2^3.3219 ≈ 10 |
| log₅(125) | 3 | 5³ = 125 |
| log₀.₅(8) | −3 | 0.5⁻³ = 8 |
| log₁₀(0.001) | −3 | 10⁻³ = 0.001 |
| log(1) | 0 | any base to the power 0 is 1 |
When x is an exact whole power of the base the page returns the exact whole number (3, not 2.9999999). Otherwise it is rounded, and the check line shows that raising the base to the answer gives your number back to 12 digits.
The rules of logarithms
Logarithms turn multiplication into addition, which is why they were invented.
- Product: log(xy) = log x + log y. log₁₀(20) = log₁₀(2) + log₁₀(10) = 0.30103 + 1 = 1.30103.
- Quotient: log(x ÷ y) = log x − log y.
- Power: log(xⁿ) = n log x. log₁₀(2¹⁰) = 10 × 0.30103 = 3.0103, so 2¹⁰ has 4 digits (it is 1,024).
- Log of the base: log_b(b) = 1.
- Log of 1: log_b(1) = 0.
The power rule gives a quick way to count digits: the number of digits in a positive whole number is the whole part of log₁₀ plus 1.
What cannot be done
- x ≤ 0: no power of a positive base is zero or negative, so log(0) and log(−5) have no answer. The values just get smaller without ever reaching zero.
- A base of 1: every power of 1 is 1, so no exponent turns 1 into anything else.
- A base of 0 or below: the base must be positive.
The page stops with a message in each case, rather than showing an error symbol or a wrong number.
Where logarithms are used
- Growth and doubling time: how long compound growth takes to reach a target is a logarithm. With 7% growth, the time to double is ln 2 ÷ ln 1.07 = 10.24 years. The compound interest calculator works forward from that.
- Decibels, pH and the Richter scale: these use base 10, so each step of 1 is a tenfold change.
- Data and computing: log₂ tells you how many bits are needed for a number of choices. 1,000 choices need log₂(1000) = 9.97, so 10 bits.
- Scientific notation: log₁₀ of a number is its power of ten plus a fraction. See the scientific notation calculator.
Common mistakes
- Treating log(x + y) as log x + log y. The sum rule is for products: log(xy) = log x + log y.
- Forgetting which base is meant. “log” on its own is base 10 on most calculators and base e in many textbooks and programming languages. Check, or use “ln” for the natural log.
- Rounding the answer and reusing it. log₁₀(2) is 0.30103, not exactly 0.3, and the difference grows when multiplied.
- Expecting a negative answer for a number above 1. A number above 1 has a positive log to a base above 1. A base below 1 flips the sign.
Related calculators
- Exponent calculator, the reverse operation.
- Root calculator.
- Scientific notation calculator and scientific calculator.
- Compound interest calculator, where logarithms give doubling times.
How it is calculated
The number and base are read as exact decimals. The natural logarithms of both are worked in 40-digit arithmetic, and log_b(x) is ln(x) ÷ ln(b). If the answer rounded to the nearest whole number n gives b^n equal to x exactly, that whole number is the exact answer. The natural, common and binary logs of x are worked the same way, and the check raises b to the answer. Values are shown to 12 significant digits.
Frequently asked questions
What is a logarithm?
The power you raise the base to in order to get a number. log₁₀(1000) = 3 because 10³ = 1000. A logarithm answers "what exponent?", the reverse of raising to a power.
What is the difference between log, ln and log2?
They use different bases. log or log₁₀ is base 10, ln is base e (about 2.71828) and log₂ is base 2. The page shows all three for your number, whatever base you choose.
How do I calculate a log to any base?
Use the change of base rule: log_b(x) = ln(x) ÷ ln(b), or log₁₀(x) ÷ log₁₀(b). For log₃(10), ln 10 ÷ ln 3 = 2.302585 ÷ 1.098612 = 2.0959.
Why can you not take the log of zero or a negative number?
No power of a positive base gives zero or a negative number, so there is no answer. Powers of 10 get as small as you like (10⁻³⁰⁰) but never reach 0.
Why can the base not be 1?
Every power of 1 is 1, so 1 raised to any exponent never gives any other number. There is no y with 1^y = 8, so a base of 1 has no logarithms.
What is the log of 1?
Zero, for every base, because any base to the power 0 is 1. log₁₀(1) = 0 and ln(1) = 0.
Related calculators
- Exponent CalculatorEnter a base and an exponent.
- Root CalculatorEnter a number and a root index.
- Scientific CalculatorType an expression or use the keys.
- Scientific Notation CalculatorType a number such as 12345.
- Compound Interest CalculatorEnter what you have, what you add each month, and the return you expect.
- Basic CalculatorType a calculation or use the keys.