Advertisement

Free Online Logarithm Calculator

Calculate logarithms with any base and show the steps.

The argument must be greater than zero. The base must be greater than zero and not equal to one. Common bases are 10, 2 and e ≈ 2.718281828.

Result
—
log ₙ(x)
Natural log
—
ln(x)
Common log
—
log₁₀(x)
Binary log
—
log₂(x)
Base raised to result
—
Should return the argument
Base
—
Current logarithm base

Change-of-base working

  1. Enter an argument to see the calculation.
Advertisement

About the Logarithm Calculator

A logarithm answers the question “to what power must the base be raised to produce this number?” The logarithm of 1000 to base 10 is 3 because 10 cubed is 1000. This calculator computes logarithms with any valid base and also reports the natural log, common log and binary log of the same argument. It shows the change-of-base formula with real numbers, which is the method most calculators and programming languages use internally.

Change of base explained

Most systems provide only natural logarithms, so a logarithm in another base is calculated as logb(x) = ln(x) / ln(b). For example, log2(32) = ln(32) / ln(2) ≈ 3.4657 / 0.6931 = 5. The calculator prints the numerator, the denominator and the quotient, then verifies the answer by raising the base to that power. This verification is a useful check: if bresult does not return the original argument within rounding error, something is wrong with the inputs.

Valid domains

The argument must be positive. There is no real logarithm of zero or a negative number, because a positive base raised to any real power is always positive. The base must also be positive and cannot equal one. A base of one would require 1y = x, which has no solution unless x is also one, and even then the answer is undefined rather than unique. The calculator checks both conditions and explains the problem instead of returning NaN.

Choosing a base

Base 10 is common in science and engineering because it pairs with decimal notation and the pH, decibel and Richter scales. Base 2 dominates computer science because bits and binary trees grow by factors of two. Base e appears in calculus, compound interest, population models and continuous growth. The base you choose does not change the underlying relationship, only the scale on which it is measured. Converting between bases is exactly what the change-of-base formula does.

Numerical notes

JavaScript uses double-precision floating-point numbers, which are accurate to about 15 significant digits. Results near a power of the base may show tiny errors such as 2.9999999999999996 instead of 3. The display rounds these values, and the verification card makes the rounding visible. Logarithms of very large or very small arguments are shown in scientific notation when appropriate. For symbolic work or exact irrational results, use a computer algebra system rather than a floating-point calculator.

Frequently asked questions

What is the difference between ln and log?

In this tool, “ln” means base e and “log” with a subscript means the stated base. In some textbooks, “log” without a subscript means base 10, while in programming it often means base 2 or base e depending on the language. Always check the convention being used.

Why can't the base be negative?

A negative base raised to fractional powers produces complex values and alternates sign, so it does not define a real-valued logarithm. The calculator restricts the base to positive values other than one.

Can the result be negative?

Yes. If the argument is between zero and one, the logarithm is negative. For example, log10(0.01) = −2 because 10 raised to −2 is 0.01.

Sponsored
Find a bug? Report now