Log Calculator (Logarithm)

Enter a number and a base to compute its logarithm log_b(x), along with the common log (base 10), natural log (base e), and binary log (base 2) in one pass.

Quick Facts

Change-of-base formula
log_b(x) = ln(x) / ln(b)
Lets you compute a logarithm in any base using only ln or log10.
Product & power rules
log(xy) = log(x)+log(y); log(x^k) = k·log(x)
Logs turn multiplication into addition and exponents into multiplication.
Valid domain
x > 0, b > 0, b ≠ 1
Logarithms of zero or negative numbers, or of any base ≤ 0 or equal to 1, are undefined.

Your Results

Calculated
log_b(x)
-
Logarithm in your chosen base
log10(x)
-
Common logarithm, base 10
ln(x)
-
Natural logarithm, base e
log2(x)
-
Binary logarithm, base 2

Ready

Enter a number and a base, then press Calculate.

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.

Frequently Asked Questions

What is a logarithm?
A logarithm is the inverse of exponentiation. log_b(x) = y means the same thing as b^y = x — it answers the question "what power must I raise the base b to, to get x?" For example, log_2(8) = 3 because 2^3 = 8.
How do you calculate a logarithm with any base on a calculator?
Most calculators only have buttons for log base 10 and natural log (base e), so you use the change-of-base formula: log_b(x) = ln(x) / ln(b), or equivalently log_b(x) = log10(x) / log10(b). Both give the same result.
Why must the base be positive and not equal to 1?
If b = 1, then b^y = 1 for every y, so the equation 1^y = x has no solution unless x = 1, and no unique solution even then — the function is not invertible. If b is negative or zero, b^y is not defined for most real y. So logarithm bases must satisfy b > 0 and b ≠ 1, and the argument x must satisfy x > 0.
What is the difference between log, ln, and log2?
"log" (or log10) means base-10, the common logarithm; "ln" means base-e (e ≈ 2.71828), the natural logarithm used throughout calculus and science; "log2" means base-2, the binary logarithm used in computer science for measuring bits and algorithmic complexity. All three are related by the change-of-base formula.