How the Log Calculator (Logarithm) works
A logarithm answers the question "what exponent do I raise the base to, in order to get this number?" Formally, log_b(x) = y is defined to mean b^y = x, for a base b > 0 (b ≠ 1) and a positive number x. This calculator computes log_b(x) for any base you enter, along with the three most commonly used logarithms — base 10, base e, and base 2 — so you can see them side by side.
The change-of-base formula
Calculators and programming languages typically only implement two logarithm functions directly: the natural log ln(x) (base e) and sometimes log10(x) (base 10). To get a logarithm in any other base b, this tool uses the change-of-base formula: log_b(x) = ln(x) / ln(b). This works because both the numerator and denominator scale by the same factor when you switch reference bases, so the ratio stays correct regardless of which log function you start from — log_b(x) = ln(x)/ln(b) = log10(x)/log10(b) always give the same answer.
Log rules and common mistakes
- Domain errors: the argument x must be strictly greater than 0 — log(0) and log(negative number) are undefined in the real numbers.
- Invalid base: the base b must be positive and cannot equal 1 (since 1 raised to any power is always 1, it can never equal x unless x is also 1, so the function isn't invertible).
- Confusing log rules with exponent rules: log(x) + log(y) = log(xy), NOT log(x)·log(y). Likewise log(x) − log(y) = log(x/y), and k·log(x) = log(x^k).
- Mixing up "log" conventions: in most math and calculator contexts "log" alone means base 10, but in computer science it sometimes means base 2, and in pure math or calculus it can mean the natural log — always confirm which base is intended.
Applications
Logarithms compress data that spans many orders of magnitude (earthquake magnitude on the Richter scale, sound intensity in decibels, pH in chemistry, and the loudness of the human ear all use log scales). In computer science, log2(n) measures the number of times a value can be halved, which is why algorithms like binary search run in O(log n) time. In finance, natural logs are used to model continuously compounded growth and to convert compound growth rates into additive log-returns for analysis.