What is a logarithm?
A logarithm answers a simple question: to what power must a base b be raised to produce a number x? Written \(\log_b(x) = y\), it means \(b^y = x\). For example, \(\log_{10}(1000) = 3\) because \(10^3 = 1000\). This calculator computes the logarithm of any positive value x to any valid base b, and also shows the three most common logarithms automatically.
How to use this calculator
Enter the value x (must be greater than 0) and the base b (must be greater than 0 and not equal to 1). The result is \(\log_b(x)\). Use base 10 for the common logarithm, base 2 for the binary logarithm used in computing and information theory, or 2.718281828 (Euler's number e) for the natural logarithm. The table below the main result always lists \(\ln(x)\), \(\log_{10}(x)\) and \(\log_2(x)\) for quick reference.
The formula explained
Most computers can only evaluate the natural logarithm (ln) and base‑10 logarithm directly, so logarithms to an arbitrary base use the change‑of‑base rule:
$$\log_b(x) = \frac{\ln(x)}{\ln(b)}$$
Because the same ratio holds with any consistent base on top and bottom, you could equally write \(\log_b(x) = \frac{\log_{10}(x)}{\log_{10}(b)}\). Both give identical answers.
Worked example
Find \(\log_2(8)\). Using the change of base formula: \(\ln(8) \approx 2.079442\) and \(\ln(2) \approx 0.693147\). Dividing, $$\frac{2.079442}{0.693147} = 3.$$ This matches the definition since \(2^3 = 8\).
FAQ
Why must x be positive? The logarithm of zero or a negative number is undefined in the real numbers, since no real power of a positive base yields a non‑positive result.
Why can't the base be 1? 1 raised to any power is always 1, so log base 1 cannot distinguish different values of x — it is undefined.
What is the natural log? It is the logarithm to base \(e \approx 2.71828\), written \(\ln(x)\). It appears throughout calculus, growth and decay problems, and finance.