A logarithm answers the question "what power do I raise this base to, to get this number?" The log base 2 of 8 is 3, because 2³ = 8.
In this article log_b(x) means "log base b of x". Specific bases are written as log₂ or log₁₀.
Logs undo exponents
Taking a logarithm is the inverse of raising to a power, just as division is the inverse of multiplication.
| Exponential form | Logarithmic form |
|---|---|
| 2³ = 8 | log₂(8) = 3 |
| 10² = 100 | log₁₀(100) = 2 |
| 3⁴ = 81 | log₃(81) = 4 |
| 10⁻³ = 0.001 | log₁₀(0.001) = −3 |
| 5⁰ = 1 | log₅(1) = 0 |
The base must be positive and not equal to 1, and you can only take the log of a positive number. No power of a positive base gives zero or a negative result, so log(0) and log(−5) are undefined in real numbers.
Common, natural and binary logs
- Common log, base 10, written log(x) on calculators. It roughly counts digits: log(1,000) = 3 and log(1,000,000) = 6.
- Natural log, base e ≈ 2.71828, written ln(x). It appears wherever growth or decay is continuous, such as compound interest, population growth and radioactive decay.
- Binary log, base 2, written log₂(x). It is common in computing: log₂(1,024) = 10, so 1,024 values need 10 bits.
Be aware that in advanced mathematics and many programming languages, "log" with no base means the natural log. On most calculators it means base 10. The logarithm calculator lets you set any base explicitly.
The log rules
These hold for any valid base b and positive x and y.
| Rule | Formula | Example |
|---|---|---|
| Product | log_b(x × y) = log_b(x) + log_b(y) | log(2) + log(50) = log(100) = 2 |
| Quotient | log_b(x ÷ y) = log_b(x) − log_b(y) | log₂(32) − log₂(4) = log₂(8) = 3 |
| Power | log_b(x to the power n) = n × log_b(x) | log(1,000²) = 2 × 3 = 6 |
| Log of 1 | log_b(1) = 0 | ln(1) = 0 |
| Log of the base | log_b(b) = 1 | log(10) = 1 |
The rules mirror the exponent rules. Multiplying powers of the same base adds exponents, so the log of a product is a sum of logs. The power rule is the most useful one in practice, because it brings an unknown exponent down to where you can solve for it.
Change of base
Most calculators have only log and ln keys. To find a log in any other base, divide two logs of the same base:
Example 1. Find log₂(50).
- log(50) ≈ 1.69897
- log(2) ≈ 0.30103
- 1.69897 ÷ 0.30103 ≈ 5.644
This is sensible: 2⁵ = 32 and 2⁶ = 64, and 50 lies between them.
Example 2. Find log₅(200) using natural logs. ln(200) ≈ 5.2983 and ln(5) ≈ 1.6094, so log₅(200) ≈ 5.2983 ÷ 1.6094 ≈ 3.292. Check: 5³ = 125 and 5⁴ = 625.
Solving equations with logs
When the unknown is an exponent, take the log of both sides and use the power rule.
Example 3. Solve 3 to the power x = 20.
- Take logs: x × log(3) = log(20).
- Divide: x = log(20) ÷ log(3) ≈ 1.30103 ÷ 0.47712 ≈ 2.727.
Example 4: doubling time. How long does money take to double at 5% annual growth? You need 1.05 to the power t = 2.
- Take natural logs: t × ln(1.05) = ln(2).
- Divide: t ≈ 0.693147 ÷ 0.048790 ≈ 14.2 years.
Where logs show up
Logarithmic scales compress huge ranges into manageable numbers. Each step of 1 on a base-10 log scale is a factor of 10.
- pH is −log of the hydrogen ion concentration. A concentration of 1 × 10⁻³ moles per litre gives pH 3. This links logs to scientific notation: the common log of a power of ten is just its exponent.
- Earthquake magnitude. A magnitude 7 quake has 100 times the measured wave amplitude of a magnitude 5, since 10² = 100.
Common mistakes
- Splitting the log of a sum. log(x + y) is not log(x) + log(y). The product rule covers multiplication only. For instance log(10 + 90) = 2, while log(10) + log(90) ≈ 2.954.
- Confusing log and ln. log(100) = 2, but ln(100) ≈ 4.605.
- Misplacing powers. log(x²) = 2 × log(x), but (log x)² is a different quantity. With x = 1,000 they are 6 and 9.
- Dividing logs instead of subtracting. log(x ÷ y) is log(x) − log(y). The quotient log(x) ÷ log(y) is the change of base formula, a different thing.
- Taking the log of zero or a negative. A calculator error here usually means an earlier step went wrong.
Run the numbers yourself
Common questions
What is a logarithm in simple terms?
A logarithm is an exponent. The log base b of x is the power you raise b to in order to get x, so log base 2 of 8 is 3 because 2³ = 8.
What is the difference between log and ln?
On most calculators log means base 10 and ln means base e, about 2.71828. They differ by a constant factor: ln(x) ≈ 2.3026 × log(x).
How do I calculate a log with a different base?
Use the change of base formula: divide the log of the number by the log of the base. For example, log base 2 of 50 is log(50) ÷ log(2) ≈ 5.644.