Understanding the logarithm calculator — concept and principle
A logarithm answers the question "to what power must the base be raised to get this number?" Since 10³ = 1,000, the base-10 logarithm of 1,000 is 3. This calculator finds the logarithm of a positive number x in any base you choose and also shows the three standard logarithms: natural (ln, base e), common (log₁₀) and binary (log₂). Logarithms appear in pH, decibels, earthquake magnitudes, compound-interest time, algorithm complexity and any scale that spans many orders of magnitude.
How it is calculated
- Any base: log_b(x) = ln x ÷ ln b (the change-of-base formula).
- Natural log: ln x, where e ≈ 2.718281828.
- Common log: log₁₀ x. Binary log: log₂ x.
The number x must be greater than 0, and the base b must be positive and not equal to 1. Both are pure numbers without units.
The principle
By definition, y = log_b(x) means bʸ = x, so the logarithm is the inverse of the exponential function. Because exponents add when powers are multiplied, logarithms turn multiplication into addition: log(xy) = log x + log y. This is why slide rules and log tables made heavy calculation easy before electronic calculators. The change-of-base formula follows directly: if bʸ = x, take the natural log of both sides to get y ln b = ln x, so y = ln x ÷ ln b. Any base works in place of e, which is why a calculator only needs one built-in logarithm.
Worked example
- Inputs: x = 1,000, base b = 10.
- ln 1,000 ≈ 6.907755279 and ln 10 ≈ 2.302585093.
- log₁₀(1,000) = 6.907755279 ÷ 2.302585093 = 3, because 10³ = 1,000.
- The other outputs: ln x ≈ 6.907755279, log₁₀ x = 3, log₂ x ≈ 9.965784285 (2¹⁰ = 1,024 is just above 1,000, so the answer is just under 10).
| Base | log_b(x) |
|---|---|
| 2.5 | 7.538824784 |
| 5 | 4.292029674 |
| 7.5 | 3.428331393 |
| 10 | 3 |
| 12.5 | 2.734955433 |
| 15 | 2.550822461 |
| 20 | 2.305865361 |
How to read the result
The integer part of log₁₀ x tells you the order of magnitude: a result of 3.something means a number in the thousands. A difference of 1 in log₁₀ is a factor of 10; a difference of 1 in log₂ is a doubling. The logarithm is negative for 0 < x < 1, zero at x = 1, and grows slowly for large x.
Common mistakes
- Taking the log of zero or a negative number, which has no real value.
- Confusing "log" on different devices: many calculators mean base 10, while many programming languages and higher mathematics mean base e.
- Writing log(x + y) = log x + log y; the product rule applies to xy, not x + y.
- Using base 1, for which every power equals 1 and no logarithm exists.
Frequently asked questions
What is the difference between ln and log?
ln is always the natural logarithm (base e). "log" usually means base 10 in school and on calculators, but base e in many programming languages, such as Math.log in JavaScript.
How do I solve 2ˣ = 50?
Take a logarithm of both sides: x = log₂ 50 = ln 50 ÷ ln 2 ≈ 5.644.
Why is log₁₀ 2 about 0.301 useful?
It tells you that doubling adds about 0.301 to the common log, so 2¹⁰ ≈ 10³, a handy rule of thumb for powers of two.
Sources: John Napier, Mirifici Logarithmorum Canonis Descriptio (1614) · NIST Digital Library of Mathematical Functions, Chapter 4: Elementary Functions (§4.2, logarithms)