Logarithm Calculator: Base 2, e, 10 or Custom
Find log_b(x) — the logarithm of any positive number to any valid base — with the exponential check and the change-of-base working shown step by step.
Formula
A logarithm answers one question: to what power must the base be raised to get the number? If by = x, then y = logb(x), where b is the base and x is the number. For example, log2(8) = 3 because 23 = 8.
Most calculators only carry buttons for base 10 (log) and base e (ln), so any other base is found with the change-of-base formula: logb(x) = ln(x) / ln(b). The logs on the right can use any base at all — this calculator works with the natural logarithm. For a full keypad with dedicated ln, log and power buttons to check a result by hand, try our scientific calculator.

Worked example
Find log2(1024). Ask: 2 to what power gives 1024? Since 210 = 1024, log2(1024) = 10. With the change of base: ln(1024) / ln(2) = 6.9315 / 0.6931 = 10.
Two more quick checks: ln(e3) = 3, because e raised to the 3rd power is e3 — the natural log simply hands back the exponent. And log10(1000) = 3, because 103 = 1000.
How to use the logarithm calculator
Enter the number (x), choose a base, and press Calculate. The number must be greater than zero; the base must be positive and cannot be 1. The calculator shows the result, the exponential check, and the change-of-base working.
Choose the base
- Binary — base 2: the logarithm of computer science, used for bits, doubling and algorithm complexity.
- Natural — base e (≈ 2.71828): written ln(x), the base of calculus and continuous growth.
- Common — base 10: the plain “log” button on most calculators, used across science and engineering.
- Custom: type any positive base except 1 — for example 5 or 7, or the letter e for the natural base.
What you get
- The logarithm: logb(x), rounded to a sensible number of decimals.
- The exponential check: the base raised to the result, which should equal your number — proof the answer is right.
- The working: ln(x) / ln(b) with both values shown, so you can follow the change of base.

Logarithm rules and properties
A handful of rules covers almost everything logarithms do. They all assume the same base b, with b > 0 and b ≠ 1, and positive arguments. The product, quotient and power rules come straight from the laws of exponents — a logarithm is the inverse of exponentiation, so multiplication becomes addition and powers become multiplication. The identities are derived in full in the logarithm article on Wikipedia.
| Rule | Formula | Example (base 10) |
|---|---|---|
| Product rule | logb(x × y) = logb(x) + logb(y) | log(2 × 5) = 0.301 + 0.699 = 1 |
| Quotient rule | logb(x / y) = logb(x) − logb(y) | log(10 / 2) = 1.000 − 0.301 = 0.699 |
| Power rule | logb(xn) = n × logb(x) | log(26) = 6 × 0.301 = 1.806 |
| Change of base | logb(x) = logk(x) / logk(b) | log2(8) = log10(8) / log10(2) = 3 |
| Log of 1 | logb(1) = 0 | log10(1) = 0 |
| Log of the base | logb(b) = 1 | log10(10) = 1 |
Two instant checks fall out of the definition itself: logb(1) = 0 because b0 = 1, and logb(b) = 1 because b1 = b.
Common, natural and binary logarithms
Three bases appear so often that they have their own names and shorthand:
| Base | Name | Written as | Where it is used |
|---|---|---|---|
| 10 | Common logarithm | log(x) | Science and engineering; pH, Richter scale, decibels |
| e (≈ 2.71828) | Natural logarithm | ln(x) | Mathematics and physics; calculus, continuous growth |
| 2 | Binary logarithm | log2(x) | Computer science; bits, algorithm complexity, doubling |
In the real world, logarithms compress enormous ranges into small, readable ones. The pH scale is −log10 of the hydrogen-ion concentration, so one pH unit means a tenfold change in acidity. Sound intensity in decibels is 10 × log10 of a power ratio, and earthquake magnitude works the same way.
Logarithms also run exponential growth backwards. If money grows at a fixed rate, the logarithm answers how long until it doubles — the same growth modeled by our compound interest calculator. In computing, binary logarithms measure how many times you can halve a problem, which is why efficient search algorithms are described as O(log n).
Why zero, negatives and base 1 are invalid
The domain rules are not arbitrary — they follow from what exponentiation can actually produce.
The number (x) must be positive
A positive base raised to any real power stays positive, so no exponent can ever produce zero or a negative number. That is why logb(0) and logb(−5) are undefined. As x slides toward zero from above, the logarithm dives toward negative infinity — it never lands.
The base must be positive and cannot be 1
A negative base would make by flip between positive and negative values in a way that breaks the definition for real numbers. And base 1 is useless: 1 raised to any power is 1, so “1 to what power equals x?” has no answer for any x except 1 (where every answer works). This calculator rejects both cases with a clear message instead of showing NaN.

Frequently asked questions
What is a logarithm in simple terms?
A logarithm answers the question: to what power must the base be raised to get this number? For example, logₒ(8) = 3 asks “2 to what power equals 8?” — and since 2³ = 8, the answer is 3. In symbols, y = log_b(x) means exactly the same as b^y = x.
What is the difference between log, ln and log₂?
They are the same idea with different bases. Log usually means the common logarithm with base 10, ln is the natural logarithm with base e (≈ 2.71828), and log₂ is the binary logarithm with base 2. This calculator lets you pick any of them, plus any custom base.
How do you find the log of a number with any base?
Use the change-of-base formula: log_b(x) = ln(x) / ln(b). Divide the natural log of the number by the natural log of the base. The calculator above does exactly this and shows both values so you can follow the working.
Why can’t the base of a logarithm be 1?
Because 1 raised to any power is always 1, so “1 to what power equals x?” has no answer for any x other than 1 — and for x = 1, every exponent works, which is equally useless. The base must be positive and different from 1.
Why is the logarithm of zero or a negative number undefined?
A positive base raised to any real power is always positive, so no exponent can produce zero or a negative result. As x approaches zero from above, log_b(x) slides toward negative infinity without ever reaching a value.
How do you check that a logarithm answer is correct?
Raise the base to the result and confirm you get the original number: if log₂(1024) = 10, then 2^10 must equal 1024, and it does. The calculator shows this exponential check with every answer, and you can repeat it with the power key on a scientific calculator.
Where are logarithms used in real life?
They compress huge ranges into small scales: pH measures acidity as −log₁₀ of ion concentration, decibels measure sound as 10 × log₁₀ of a power ratio, and earthquake magnitude is logarithmic too. They also invert exponential growth — for example, finding how long savings take to double — and binary logs describe efficient algorithms in computer science.
Related calculators
Scientific Calculator
Evaluate trig, logarithm, power and root expressions with a full scientific keypad. Free and instant.
Use calculatorRatio Calculator
Simplify ratios, scale them up or down, or split an amount by ratio.
Use calculatorQuadratic Equation Solver
Solve ax squared plus bx plus c equals zero, with full steps.
Use calculatorLCM & GCD Calculator
Find the LCM and GCD of any numbers, with step-by-step working.
Use calculatorPythagorean Theorem Calculator
Solve for the hypotenuse or either leg of a right triangle.
Use calculatorTriangle Calculator
Solve triangle sides, angles and area from what you know.
Use calculator