A logarithm answers the question “what power do I raise the base to, to get this number?” Enter a number and pick base 10, base e, base 2 or any other base. You also get the natural, common and binary logs side by side, and the change-of-base working for custom bases.
For example, log₁₀ 1,000 = 3 because 10³ = 1,000. Logs turn multiplication into addition, which is why they sit behind pH, decibels, earthquake magnitudes and compound-interest time calculations.
What is a logarithm?
A logarithm is the inverse of an exponent. log_b(x) is the power you raise the base b to in order to get x: log₂(8) = 3 because 2³ = 8. Logarithms turn multiplication into addition — log(a × b) = log a + log b — which is why they were used for centuries to simplify hard calculations.
Three bases are common. The common logarithm (base 10) underlies scientific scales such as pH, decibels and the Richter scale. The natural logarithm ln (base e ≈ 2.71828) appears in continuous growth and decay, calculus and statistics. The binary logarithm (base 2) counts doublings and bits in computer science.
Any logarithm can be calculated from another with the change-of-base formula log_b(x) = ln(x) ÷ ln(b). Logarithms are only defined for positive x, and the base must be positive and not equal to 1.
How to use the log calculator
- Enter the number you want the logarithm of.
- Choose base 10, base e (ln), base 2 or a custom base.
- Read the logarithm and check it with the power shown.
Formula
y = log_b(x) ⇔ bʸ = x; log_b(x) = ln(x) ÷ ln(b)
log₁₀(1000) = 3 because 10³ = 1000. The natural log ln uses the base e ≈ 2.71828, and the binary log uses base 2.
Any logarithm can be found from natural logs with the change-of-base rule. x must be positive, and the base must be positive and not equal to 1.
Worked examples
pH of a solution
- Number (x)
- 0.00032
- Base
- 10 (common log)
- log(0.00032)
- -3.4948500217
- Check
- 10^-3.49485 = 0.00032
- Natural log, ln(x)
- -8.0471895622
pH = −log₁₀[H⁺]. For a hydrogen-ion concentration of 0.00032 mol/L, log₁₀(0.00032) = -3.4949, so the pH is about 3.49.
How long to double at 7% a year
- Number (x)
- 2
- Base
- Other base
- Base (b)
- 1.07
- log_1.07(2)
- 10.2447683511
- Check
- 1.07^10.244768 = 2
- Natural log, ln(x)
- 0.6931471806
Money growing 7% a year doubles when 1.07ⁿ = 2, so n = log₁.₀₇(2) = ln 2 ÷ ln 1.07 = 10.24 years.
Bits needed for a number of values
- Number (x)
- 1,000
- Base
- 2 (binary log)
- log_2(1,000)
- 9.9657842847
- Check
- 2^9.9657843 = 1,000
- Natural log, ln(x)
- 6.907755279
log₂(1000) = 9.9658, so 10 bits (2¹⁰ = 1,024 values) are needed to give each of 1,000 items its own code.
Logarithms of common values
| x | log₁₀(x) | ln(x) | log₂(x) |
|---|---|---|---|
| 0.1 | -1 | -2.30259 | -3.32193 |
| 0.5 | -0.30103 | -0.693147 | -1 |
| 1 | 0 | 0 | 0 |
| 2 | 0.30103 | 0.693147 | 1 |
| 10 | 1 | 2.30259 | 3.32193 |
| 100 | 2 | 4.60517 | 6.64386 |
| 1,024 | 3.0103 | 6.93147 | 10 |
| 1,000,000 | 6 | 13.8155 | 19.9316 |
Logarithmic scales you already use
On a log scale, each step multiplies rather than adds. A sound 10 dB louder carries 10 times the intensity; a solution one pH unit lower has 10 times the hydrogen ions; an earthquake one magnitude higher releases about 32 times the energy. That is how one scale can cover a whisper and a jet engine.
Common mistakes
- Assuming log(a + b) = log a + log b. The product rule is log(a × b) = log a + log b; there is no simple rule for a sum.
- Taking the log of zero or a negative number — it is undefined for real numbers.
- Mixing up log and ln on a calculator or in a spreadsheet, where LOG may mean base 10 and LN the natural log.
- Dividing in the wrong order in the change-of-base formula: it is ln(x) ÷ ln(base), not ln(base) ÷ ln(x).
- Using ln when a formula means log₁₀, or the reverse. ln 100 is about 4.61; log₁₀ 100 is 2.
Frequently asked questions
What is the difference between log and ln?
log usually means the common logarithm, base 10, while ln is the natural logarithm, base e ≈ 2.71828. In some maths and programming contexts log means ln, so check the convention you are working with.
Why can’t I take the log of 0 or a negative number?
A positive base raised to any real power is always positive, so no exponent gives 0 or a negative result. As x approaches 0, log(x) heads towards minus infinity.
What is log of 1?
Zero in every base, because any base to the power 0 equals 1.
How do I calculate a log in a different base?
Use the change-of-base rule: log_b x = ln x ÷ ln b. log₂ 1,000 = ln 1,000 ÷ ln 2 ≈ 9.97, so 2 must be raised to about 9.97 to reach 1,000.
Sources
- NIST Digital Library of Mathematical Functions, §4.2 Logarithm, Exponential, Powers: Definitions, National Institute of Standards and Technology (NIST)
- College Algebra 2e, 6.3: Logarithmic Functions, OpenStax, Rice University
- College Algebra 2e, 6.5: Logarithmic Properties, OpenStax, Rice University
Last updated · Calculations checked by automated tests· Editorial policy