What a logarithm is
A logarithm answers one very specific question: what exponent do I raise the base to in order to get this number? When we write log_b(x) = y, it means b raised to y equals x. For instance, log₁₀(1000) = 3 because 10³ = 1000. In other words, the logarithm is the inverse of raising to a power, just as subtraction is the inverse of addition.
Three logarithms show up so often they have their own names. The common logarithm (base 10, written log) appears in decibels and the pH scale. The natural logarithm (ln), with base e ≈ 2.71828, rules calculus, continuous interest and radioactive decay. And the custom-base logarithm, which in computer science is usually base 2 for counting bits or levels of a tree. This calculator shows all three at once, entirely inside your browser.
How to use the calculator
- Type the number (x). It must be greater than 0: the logarithm does not exist for 0 or for negative numbers.
- If you need a logarithm in another base, type the base (b). It must be greater than 0 and different from 1.
- Read
log₁₀(x),ln(x)andlog_b(x)instantly. They update as you type. - Press Copy results to send all three values to your notes.
The formula and the change of base
The common and natural logarithms are computed directly. For any other base we use the change-of-base formula, which expresses any logarithm using the ones we already have:
log_b(x) = ln(x) / ln(b) = log(x) / log(b)
It makes no difference whether you divide two natural logs or two common logs: the answer is the same. The calculator uses the natural logarithm internally. The base must differ from 1 because ln(1) = 0 and you cannot divide by zero.
| Expression | Meaning | Result |
|---|---|---|
log₁₀(1000) | 10 raised to 3 = 1000 | 3 |
ln(e) | e raised to 1 = e | 1 |
log₂(8) | 2 raised to 3 = 8 | 3 |
log₅(125) | 5 raised to 3 = 125 | 3 |
log₁₀(2) | 10 raised to 0.30103 ≈ 2 | 0.30103 |
Worked example
Let’s compute the logarithms of x = 32 with custom base b = 2.
- log₁₀(32): we look for the exponent of 10 that gives 32. Since 32 sits between 10 (10¹) and 100 (10²), the result is between 1 and 2:
log₁₀(32) = 1.50515. - ln(32): the exponent of
ethat gives 32 is3.46574, becausee³·⁴⁶⁵⁷⁴ ≈ 32. - log₂(32): here the result is exact. Because
2⁵ = 32, we getlog₂(32) = 5. With the change-of-base formula:ln(32) / ln(2) = 3.46574 / 0.693147 = 5.
Quick check: 2 multiplied by itself five times (2·2·2·2·2) is 32, so the 5 fits. And since 32 is a power of 2, its base-2 logarithm is a clean whole number.
Frequently asked questions
Why can’t I take the logarithm of a negative number or zero?
Because no real exponent applied to a positive base can produce a negative result or zero. 10 raised to any number always gives a positive value and never reaches 0. That is why the calculator asks for an x greater than 0 and warns you if you type anything else.
What is the difference between log and ln?
Only the base. log without a subscript usually means the common logarithm (base 10), widely used in engineering and physical scales. ln is the natural logarithm, base e ≈ 2.71828, which turns up naturally in continuous growth, statistics and calculus. Both measure the same thing; they just use a different reference unit.
What is the change-of-base formula for?
Calculators and programming languages only ship with log and ln. The formula log_b(x) = ln(x) / ln(b) lets you get any other base by dividing two logarithms you can already compute. That is exactly what this tool does when you type a custom base.
Why can’t the base be 1?
Because 1 raised to any exponent is always 1, never another number, so log₁(x) would be meaningless except for x = 1. In the change-of-base formula you would get ln(1) = 0 in the denominator, and dividing by zero is not allowed. The calculator flags this with a message.
How many decimals does it show?
It rounds to 6 significant figures so the number stays readable without losing useful precision. Internally it computes with your device’s full precision, so you can trust the value for homework, exams or quick checks.