Logarithm Calculator
Calculate logarithms to any base.
What is the Logarithm Calculator?
A logarithm calculator finds logₐ(n) — the power you'd need to raise a given base to in order to produce a given number — for any base and any positive number. It works using the change-of-base formula, logₐ(n) = ln(n) ÷ ln(a), calculating the natural logarithm of both the number and the base and dividing one by the other, since this lets it compute a logarithm to any arbitrary base using the same underlying natural log function. To calculate a logarithm manually without a scientific calculator, use the same change-of-base approach: find ln(n) and ln(a) from log tables or a calculator's ln function, then divide — log base 10 works the same way but is common enough that most calculators have a dedicated button for it.
How it works
A logarithm answers the question "what power do I need to raise this base to, to get this number?" — log base 10 of 100 is 2, because 10² = 100. Since most calculators (and JavaScript's built-in Math functions) only compute natural logarithm directly, converting to any other base uses the change-of-base formula: log_base(n) = ln(n) / ln(base).
UK context
Different bases are conventional in different fields — base 10 (common logarithm) is intuitive for everyday scale comparisons, base e (natural logarithm, roughly 2.71828) is standard in calculus and continuous growth/decay contexts, and base 2 is fundamental in computer science, since it directly relates to binary and doubling.
Tips
- Logarithms are only defined for positive numbers — you can't take the logarithm of zero or a negative number in standard real-number mathematics.
- The base itself must be positive and can't equal 1 (since any power of 1 is always 1, making the question "what power gives this number" unanswerable except when the number is also 1).
Frequently asked questions
What does a logarithm actually calculate?
It answers "what power do I need to raise the base to, in order to get this number?" For example, log base 2 of 8 is 3, because 2³ = 8.
Why can't I take the logarithm of a negative number?
In standard real-number mathematics, no real power of a positive base produces a negative result, so logarithms of negative numbers (and zero) are undefined without extending into complex numbers.
What's the difference between log and ln?
"log" conventionally refers to base-10 logarithm (or sometimes a generic base), while "ln" specifically means natural logarithm — logarithm to the base e (approximately 2.71828), which is standard in calculus.
A quick note
This page explains the logarithm and change-of-base formula used in the calculator above.