Logarithm Calculator
Work out a logarithm in any base, or the antilogarithm, with the change-of-base working shown and floating-point rounding called out.
🔒 This tool runs entirely in your browser. Your files are never uploaded to a server.
—
The same number in the three standard bases
How to use it
- Enter the number, and the base — or press e, 10 or 2.
- Read the result, with the change-of-base working shown underneath.
- Switch to antilogarithm to go the other way, from an exponent back to a number.
- Use ln(1 + x) when x is small enough that the ordinary form would lose it.
A logarithm is an exponent read backwards
10³ = 1000 → log₁₀(1000) = 3
2¹⁰ = 1024 → log₂(1024) = 10
e¹ = 2.71828… → ln(2.71828…) = 1
Every logarithm question is that same swap. The base is what is being raised; the answer is the power. Which is also why the base cannot be 1: one raised to anything is one, so there is no power to recover.
Change of base, and why it is not used everywhere
Any logarithm can be written in terms of any other, which is the identity every calculator relies on:
log_b(x) = ln(x) / ln(b)
It is exactly true in mathematics and slightly lossy in binary, because ln(x) and ln(b) are each rounded before the division. For base 10 and base 2 there are dedicated functions that are correctly rounded, and the difference shows up on ordinary inputs:
log₁₀(1000) ratio → 2.9999999999999996 direct → 3
log₁₀(1000000) ratio → 5.999999999999999 direct → 6
log₁₀(10²¹) ratio → 20.999999999999996 direct → 21
So this calculator uses the dedicated function whenever the base is e, 10 or 2, and tells you when the generic ratio would have given something uglier. For any other base there is no dedicated function to reach for — log₅(125) really does come out as 3.0000000000000004 — so instead it notices that the result is within a hair of a whole number, checks whether 5³ is exactly 125, and says the exact answer is 3.
Why ln(1 + x) has its own mode
For small x the obvious spelling destroys the answer, and not by a little:
x = 10⁻¹⁰ log(1 + x) → 1.000000082690371e-10
log1p(x) → 9.999999999500001e-11
x = 10⁻¹⁶ log(1 + x) → 0 ← the answer is gone
log1p(x) → 1e-16
The problem is the addition, not the logarithm. A double has about sixteen significant digits, so 1 + 10⁻¹⁶ rounds back to exactly 1 before the logarithm is ever taken, and the answer is 100% wrong. log1p computes the whole thing as one operation and keeps every digit. It matters for continuously compounded rates, log-likelihoods and anything accumulating many small increments.
The laws, in one place
| Law | Why |
|---|---|
| log(xy) = log x + log y | Multiplying numbers adds their exponents |
| log(x/y) = log x − log y | Dividing subtracts them |
| log(xⁿ) = n · log x | A power multiplies the exponent |
| log_b(b) = 1 | The base to the first power is itself |
| log_b(1) = 0 | Anything to the power zero is one |
| log_b(x) = ln x / ln b | Change of base — any base in terms of any other |
The first three are the reason logarithms exist at all: before calculators they turned multiplication into addition, which is what slide rules and log tables were for.
FAQ
What does a logarithm actually tell me?
It answers "what power do I raise the base to, to get this number". log₁₀(1000) is 3 because 10³ is 1000. That is the whole idea — a logarithm is an exponent, read backwards.
Which base should I use?
Base 10 for orders of magnitude, decibels and pH. Base 2 for anything to do with doubling, bytes or algorithm complexity. Base e for growth, decay and calculus — its derivative is the reason it turns up everywhere in physics and finance. Write "log" and most mathematicians read base e while most engineers read base 10, which is why "ln" and "log₁₀" are worth being explicit about.
Why does log base 5 of 125 come out as 3.0000000000000004?
Because there is no dedicated base-5 logarithm, so it has to be computed as ln(125)/ln(5), and neither of those two logarithms is exact in binary. The tool spots that the answer is a whisker from 3, checks that 5³ really is 125, and tells you the exact answer is 3.
Why is the logarithm of zero undefined?
Because no power of a positive base ever reaches zero. Raise 10 to −100 and you get a very small number, not zero, and going further only gets smaller. The logarithm heads to negative infinity as the input approaches zero, which is a limit rather than a value.
What about negative numbers?
There is no real answer. A positive base raised to any real power is positive, so nothing you can do to 10 will produce −5. There is a complex answer involving iπ, which this calculator deliberately does not cover rather than presenting it as if it were a normal result.
When would I need the ln(1 + x) mode?
When x is very small — continuously compounded interest on a tiny rate, log-likelihoods, that sort of thing. Computing log(1 + x) directly loses the answer: at x = 10⁻¹⁶ adding it to 1 rounds straight back to 1, and you get exactly zero. log1p is built to avoid that step.
How we compare
| Feature | Online Tool Store | Phone or web calculator | Wolfram Alpha |
|---|---|---|---|
| Any base, with the working shown | ✓ | Base 10 and e only | ✓ |
| Uses the correctly rounded function per base | ✓ | Usually not | ✓ |
| Flags a whole-number answer nudged by rounding | ✓ | ✗ | ✓ |
| A dedicated ln(1 + x) for tiny inputs | ✓ | ✗ | ✓ |
| Works offline, nothing sent anywhere | ✓ | ✓ | ✗ |
| Arbitrary precision beyond a double | ✗ | ✗ | ✓ |
| Complex logarithms of negative numbers | ✗ | ✗ | ✓ |
A logarithm in any base, with the arithmetic on show and the floating-point traps called out rather than hidden. It is limited to double precision and to real answers — for arbitrary precision or the complex plane, a computer algebra system is the right tool.