What is a logarithm?
A logarithm is the inverse of exponentiation. If exponentiation asks "what do I get when I multiply b by itself y times?", logarithm asks the reverse: "what y do I need so that bʸ equals x?" Formally:
If bʸ = x, then log_b(x) = y
Examples:
- log₁₀(1000) = 3, because 10³ = 1000.
- log₂(8) = 3, because 2³ = 8.
- log₂(1024) = 10, because 2¹⁰ = 1024.
- ln(e) = 1, because e¹ = e.
- log_5(125) = 3, because 5³ = 125.
Logarithms are powerful because they convert multiplication to addition (log(ab) = log(a) + log(b)) and exponentiation to multiplication (log(aᵇ) = b × log(a)). Before electronic calculators, slide rules and log tables made tedious multiplications and root extractions tractable. Today, logs underpin almost every "scale" you've heard of: pH, decibels, the Richter scale, star magnitudes, algorithm complexity.
How to use the log calculator
- Pick the base from the dropdown — natural (e), common (10), binary (2), or "Custom" to enter any other positive number ≠ 1.
- If you chose Custom, enter your base in the second field.
- Enter the argument x — the number you want the log of. Must be positive.
- The result appears with a verification: bʸ should equal x. The verification is a sanity check that the answer is right.
The three "famous" logs
Natural log (ln, base e)
e ≈ 2.71828 is Euler's constant — a number that emerges naturally from continuous-growth processes. ln(x) is the integral of 1/t from 1 to x, and it's the inverse of the exponential function eˣ. Used in:
- Compound interest formulas (continuous compounding: A = Pe^(rt))
- Population growth and radioactive decay
- Calculus (the derivative of ln(x) is 1/x — exceptionally clean)
- Information theory (entropy in nats vs bits depends on base)
- Differential equations of all kinds
Common log (log, base 10)
log(x) on a regular calculator means log₁₀(x). It tells you "how many digits" the number has, roughly: log₁₀(1000) = 3 means 1000 has about 3 zeros. Used in:
- pH: pH = -log₁₀(H+ concentration in mol/L). pH 3 has 10× the acidity of pH 4, 100× of pH 5.
- Decibels (dB): 10 × log₁₀(power ratio). Each +10 dB is 10× the sound power; each +20 dB is 100×.
- Richter scale: each whole number is 10× the seismic wave amplitude. A magnitude 7 quake has 10× the amplitude of a 6, 100× of a 5.
- Star brightness: each magnitude is ~2.512× brighter (the 5th root of 100). A magnitude 1 star is 100× as bright as a magnitude 6 star.
Binary log (log₂, base 2)
log₂(x) is the number of times you'd halve x before reaching 1. log₂(8) = 3, log₂(1024) = 10. Used everywhere in computer science:
- Bit count: log₂(N) = number of bits to represent N values. log₂(256) = 8 means a byte (8 bits) holds 256 values. log₂(2³²) = 32, etc.
- Algorithm complexity: O(log n) algorithms (binary search, balanced trees) make problems with billions of inputs feasible.
- Tree depth: a balanced binary tree with N leaves has depth log₂(N).
- Information content: log₂(p) measures bits of information per symbol.
Worked examples
Example 1 — log₁₀(1000) = 3
Verification: 10³ = 1000. ✓ One of the cleanest log values: 1000 is exactly 10 to the third power, so the log is exactly 3.
Example 2 — ln(2) ≈ 0.6931
Verification: e^0.6931 ≈ 2.0001. Used heavily in finance: the "rule of 72" (72 / interest rate = doubling years) is derived from ln(2) ≈ 0.693 — at continuous compounding, your money doubles when rt = 0.693, so t = 0.693 / r ≈ 0.72 / r when expressed as a percent.
Example 3 — log₂(1024) = 10
Verification: 2¹⁰ = 1024. This is why "1K" of memory historically meant 1024 bytes, not 1000 — power-of-2 conventions in binary computers.
Example 4 — log₂(1,000,000,000) ≈ 29.9
It takes about 30 binary halvings to reduce a billion to 1. This is why binary search through 1 billion sorted items takes only 30 comparisons — log₂(1B) ≈ 30.
Example 5 — log_5(625) = 4
Verification: 5⁴ = 625. Custom base 5; the calculator handles arbitrary positive bases via the change-of-base formula.
The change-of-base formula
Most calculators only have ln and log₁₀ buttons — no log₃ or log_7 button. To compute logs in any base, use:
log_b(x) = log_a(x) / log_a(b)
Pick any base a you have. For example, log_5(125) = ln(125) / ln(5) = 4.828 / 1.609 = 3. Or log_5(125) = log₁₀(125) / log₁₀(5) = 2.097 / 0.699 = 3. Same answer, either way.
This calculator uses the natural-log version internally, so it handles any positive base ≠ 1 without you having to convert.
Why can't you log zero or negatives?
Because no real exponent gives zero or a negative result when raised to a positive base. b^y is always positive for any real y when b > 0. So:
- log_b(0) → no real solution. As x approaches 0 from above, log(x) approaches negative infinity.
- log_b(-1) → no real solution. To define logs of negatives, you need complex numbers (e.g., ln(-1) = iπ in complex analysis).
The calculator restricts to positive arguments to avoid undefined results. If you really need complex logs, use a CAS like Wolfram Alpha or SageMath.
Logarithm rules
The three most-used identities (all hold for any valid base b):
log(ab) = log(a) + log(b) — multiplication becomes addition
log(a/b) = log(a) − log(b) — division becomes subtraction
log(aⁿ) = n × log(a) — exponentiation becomes multiplication
These are why logs were so important historically: a slide rule computes the log of two numbers, adds the lengths, and reads back the antilog — turning multiplication into a single sliding motion. Engineers used slide rules through the 1970s for exactly this trick.
Real-world log scales
The Richter scale
Earthquake magnitudes are log₁₀ of amplitude. A magnitude 7 quake doesn't feel "a bit worse" than a 6 — it has 10× the seismic wave amplitude and roughly 32× the energy release (because energy scales with the 1.5 power of amplitude). The 2011 Tohoku quake (magnitude 9.0) released about 1000× the energy of the 1989 Loma Prieta (6.9).
Decibels
Sound levels in dB are 10 × log₁₀(P/P_ref). Conversation: ~60 dB. Lawnmower: ~90 dB (1000× the power of conversation). Jet engine at 30 m: ~140 dB (10 million× the power of conversation). Each +10 dB is roughly twice as loud subjectively, but actually 10× the power.
pH
pH = -log₁₀(H+ concentration in mol/L). Pure water: pH 7 (10⁻⁷ mol/L). Vinegar: pH 3 (10⁻³, ten thousand times more acidic than water). Battery acid: pH 0 (1 mol/L of H+). The negative sign means lower pH = more acidic; each pH unit is 10× the H+ concentration.
Star magnitudes
Astronomers use a logarithmic scale where each magnitude unit is the fifth root of 100 ≈ 2.512. Sirius (mag -1.46) is about 25× brighter than the Sun-relative reference. Faintest star you can see with naked eye: mag +6, about 100× dimmer than mag 1.
Algorithm complexity
O(log n) is the most desirable non-constant complexity in computer science. A binary search on a sorted list of 1 billion items takes about 30 comparisons (log₂(1B) ≈ 30). The same search done linearly would take up to 1 billion comparisons — about 30 million times slower. Logs are why "logarithmic time" is the gold standard for fast algorithms.
Common mistakes
- Confusing ln with log. On most calculators, "log" means log₁₀ and "ln" means log_e. They differ by a factor of about 2.303 (since ln(10) ≈ 2.303). Always check what your calculator/textbook means.
- Trying to take log of zero or a negative. Undefined for real numbers. The calculator returns an error if you try.
- Using base 1. log_1(x) is undefined because 1 raised to any power is still 1.
- Forgetting the change-of-base formula. If your calculator only has ln, you can still get log₂(x) = ln(x) / ln(2). Don't get stuck because the button you want isn't there.
- Misreading log scales. "Mag 5 vs mag 6" earthquakes sound like a small difference; they're 10× the wave amplitude apart. Linear intuition fails on log scales.
What the calculator gives you, summarized
- Three preset bases — ln (e), log₁₀, log₂ — with one click.
- Custom base — for any positive number ≠ 1.
- Verification — bʸ shown alongside the result, so you can confirm at a glance that the answer is right.
- Helpful error message — if you enter zero or a negative, the calculator explains why no answer exists.
Two inputs (base and argument), one verified output. The simplest way to invert exponentiation in any base.