Log Calculator
Calculate the logarithm of a number in any base, along with its natural log (ln) and common log (base 10).
How It's Calculated
Formula
\log_b(x) = \frac{\ln(x)}{\ln(b)}A logarithm answers the question: to what power must the base be raised to produce this argument? log_b(x) = y means b^y = x. Since most calculators (including JavaScript's built-in Math library) only compute natural logarithms directly, log_b(x) is evaluated using the change-of-base identity: divide the natural log of x by the natural log of b. This calculator also reports ln(x) (natural log, base e) and log10(x) (common log, base 10) directly, since both are frequently needed on their own. The argument x must be strictly greater than zero, because logarithms of zero or negative numbers are undefined in the real numbers. The base must be strictly greater than zero and not equal to 1, since a base of 1 raised to any power always equals 1, making the logarithm undefined for any other argument.
Worked Examples
log base 2 of 8 (binary doubling)
- ln(8) ≈ 2.0794
- ln(2) ≈ 0.6931
- log_2(8) = 2.0794 / 0.6931 = 3 (since 2^3 = 8)
log base 10 of 1000 (common log)
- ln(1000) ≈ 6.9078
- ln(10) ≈ 2.3026
- log_10(1000) = 6.9078 / 2.3026 = 3 (since 10^3 = 1000)
Frequently Asked Questions
What is the change-of-base formula?
The change-of-base formula, log_b(x) = ln(x) / ln(b), lets you compute a logarithm in any base using only natural logarithms. It works because logarithms in different bases are always proportional to each other by a constant factor.
Why can't the argument be zero or negative?
A logarithm asks what power the base must be raised to in order to produce the argument. Since a positive base raised to any real power always produces a positive result, there is no real exponent that produces zero or a negative number, so those arguments are undefined.
Why can't the base be 1?
Raising 1 to any power always equals 1. So log base 1 of anything other than 1 has no solution, and log base 1 of 1 has infinitely many solutions — either way the logarithm is undefined for a base of exactly 1.
What's the difference between natural log and common log?
Natural log (ln) uses base e (approximately 2.71828) and appears throughout calculus and continuous growth/decay formulas. Common log (log10) uses base 10 and is convenient for orders-of-magnitude comparisons, like the Richter scale or pH.