A logarithm answers a simple but powerful question: to what power must we raise a fixed base number to get another number? This logarithm calculator takes any positive number x and any positive base b (not equal to 1) and instantly returns log_b(x), alongside the three special logarithms you actually meet on exams and in real life — the natural logarithm ln(x), the common logarithm log₁₀(x), and the binary logarithm log₂(x) — plus an antilog check that confirms your result by raising the base back to your answer.
Whether you are solving a pH problem, sizing a Richter-scale earthquake, converting decibels on a sound mix, or figuring out how many years it takes a $10,000 investment to double at 7% annual growth, the logarithm is the operation that turns messy exponents into clean, workable numbers. Type your values and read the result card below.
How to Use
- Enter the Number (x) — the positive value you want to take the logarithm of. It must be greater than 0; logarithms of zero or negative numbers do not exist in the real numbers.
- Set the Logarithm Base (b). Leave it at the default
10for the common log, typee(≈ 2.71828) for the natural log, or type2for the binary log used in computer science. You can also type any other base — for example3or1.5. - Read the highlighted log base b of x result — that is the exponent
ysuch thatb^y = x. - Compare it with Natural Log ln(x), Common Log log₁₀(x), and Binary Log log₂(x). The change-of-base rule guarantees that all four are proportional to one another.
- Check the Antilog line. Raising the base to your result (
b^y) should give you back the originalx(within rounding). If it does, your computation is internally consistent. - If the calculator returns an error, you either entered
x ≤ 0or a base that is≤ 0or equal to1. Fix that input and the result will appear.
The Logarithm Formula (Change of Base)
By definition, y = log_b(x) means exactly that b^y = x. Calculators almost never have a dedicated button for arbitrary bases, so they use the change-of-base identity, which holds for any positive x and any positive base b ≠ 1:
log_b(x) = ln(x) / ln(b) = log₁₀(x) / log₁₀(b)
This is why the result card always computes four related values at once. The three classic bases come straight from the standard library:
- Natural logarithm
ln(x)uses Euler's numbere ≈ 2.71828as the base. It appears everywhere in calculus, exponential growth/decay, and physics. - Common logarithm
log₁₀(x)uses base 10. It is the basis of the pH scale, the Richter magnitude scale, decibels, and scientific notation. - Binary logarithm
log₂(x)uses base 2. It counts how many times you can halve a number, and it is the language of bits, bytes, algorithm complexity, and information theory.
Worked example: log₁₀(1000) = 3 because 10³ = 1000. The same 1000 has ln(1000) ≈ 6.908 and log₂(1000) ≈ 9.966. Notice how 6.908 / ln(10) ≈ 3.0 — the ratio between natural and common log is always 1 / ln(10) ≈ 0.4343.
Why Logarithms Show Up Everywhere
Many real-world scales are logarithmic, which means each unit jump is a multiplication rather than an addition:
- Decibels (dB) — sound intensity grows by 10× for every 10 dB. A 60 dB conversation and a 90 dB lawnmower differ by 30 dB, which is a 1000× louder ratio, not 1.5×.
- pH — a drop of 1 pH unit means a 10× increase in acidity.
- Richter scale — magnitude 7 releases roughly 32× more energy than magnitude 6.
- Compound growth — doubling time for an investment growing at annual rate
risln(2) / ln(1 + r) ≈ 72 / (100·r)in years, which is where the Rule of 72 comes from.
That last use is worth pausing on. If you put $10,000 into an account earning 7% per year, the doubling time is ln(2) / ln(1.07) ≈ 10.24 years — your money becomes $20,000, then $40,000 another 10.24 years later. Without logarithms, estimating that horizon would be guesswork.
Examples
Example 1 — Common log of 1,000. Set x = 1000 and base = 10. The result is exactly 3, because 10³ = 1000. The card also shows ln(1000) ≈ 6.9078, log₁₀(1000) = 3, and log₂(1000) ≈ 9.9658. The antilog 10³ returns 1000, confirming the result.
Example 2 — Binary log, computer-science style. Set x = 8 and base = 2. The result is 3, because 2³ = 8. This is the same as saying 8 bytes occupy exactly 3 bits of address range (2^3 = 8). Swap in x = 1024 and you get log₂(1024) = 10, which is why a 10-bit memory address holds 1024 slots.
Example 3 — A seven-figure number. Set x = 1,500,000 and base = 10. The result is ≈ 6.1761. That tells you 1.5 million is six orders of magnitude plus a bit — useful when reading population tables, file sizes, or revenue figures on a log axis.
Example 4 — Doubling time on a 7% return. Set x = 2 and base = 1.07. The result is ≈ 10.24, meaning at 7% annual growth your money (whether $500 or $5,000,000) doubles in about 10.24 years. This is the logarithm doing the work behind the Rule of 72.
Example 5 — The log of 1. Set x = 1 and any base. The result is exactly 0, because any number raised to the power 0 equals 1. This is one of the fundamental logarithm identities worth memorizing.
FAQ
What is a logarithm?
A logarithm is the inverse of exponentiation. If y = log_b(x), then by definition b^y = x. In plain language, the logarithm of x in base b is the power you need to raise b to in order to get x. For example, log₂(8) = 3 because 2³ = 8.
What is the difference between log, ln, and log₁₀?
log without a subscript is ambiguous: in algebra it often means base 10, and in higher mathematics it usually means the natural log base e. ln always means the natural logarithm (base e ≈ 2.71828). log₁₀ is the common logarithm, used in chemistry (pH), seismology (Richter), and engineering (decibels). This calculator shows all three side by side so you never have to guess.
How do I calculate a logarithm with a custom base?
Use the change-of-base formula: log_b(x) = ln(x) / ln(b). For example, log₅(100) equals ln(100) / ln(5) ≈ 4.6052 / 1.6094 ≈ 2.861. Type x = 100 and base = 5 into the calculator and you will see the same number instantly.
Why can't I take the log of 0 or a negative number?
Raising a positive base to any real power always gives a positive result — 10^(-3) is 0.001, never zero, never negative. So there is no exponent y for which 10^y = 0 or 10^y = -5. Logarithms of zero or negative numbers are undefined in the real numbers, which is why this calculator returns an error instead of a nonsense answer.
What is an antilogarithm?
The antilog is the reverse operation: given a result y, it asks "what number has logarithm y in base b?" Mathematically, antilog_b(y) = b^y. On this page the antilog line computes b^(log_b(x)) and should return your original x, which is a built-in correctness check.
How do logarithms apply to real life?
They underpin decibels (sound), pH (chemistry), the Richter scale (earthquakes), star magnitude (astronomy), and — most usefully for personal finance — doubling time. At a 5% annual return, money doubles about every ln(2)/ln(1.05) ≈ 14.2 years; at 10% it doubles every ≈ 7.3 years. Type those values into the calculator and watch the number move.
Disclaimer
This logarithm calculator is provided for informational purposes only and does not constitute mathematical, financial, educational, or other professional advice. Results are computed using the standard change-of-base identity log_b(x) = ln(x)/ln(b) and the correctly-rounded routines in the CPython math library; they may be rounded for display. Always verify critical calculations independently before relying on them for academic, engineering, or investment decisions.