Logarithm Calculator

Updated July 2026

Compute the logarithm of any number to any base. Pick a preset for log base 10, natural log (ln) or log base 2, or type your own base — and see log10, ln and log2 side by side. Everything runs privately in your browser.

A logarithm is the exponent you raise the base to in order to get a number: if by = x then logb(x) = y. To compute any base, use the change-of-base formula logb(x) = ln(x) / ln(b). For example, log2(8) = 3 because 2³ = 8.
Must be greater than 0.
Must be greater than 0 and not equal to 1.
Result
log₁₀(x)
ln(x)
log₂(x)

How this logarithm calculator works

A logarithm is the inverse of raising a base to a power. The base b is the number being multiplied, and the logarithm tells you the exponent. Formally, if by = x, then logb(x) = y. So the log answers "what power turns the base into x?".

To compute a logarithm in any base, this tool uses the change-of-base formula: logb(x) = ln(x) / ln(b). Natural logs are used internally because every JavaScript engine provides Math.log (base e); dividing by ln(b) rescales the result to your chosen base. The convenience table always shows the three most common logs — base 10 (log), base e (ln) and base 2 (log2) — for the number you entered.

Worked example: log2(8) = 3 because 2³ = 8. Likewise log10(1000) = 3 because 10³ = 1000, and ln(e) = 1 because e¹ = e. Using change-of-base: log2(8) = ln(8) / ln(2) ≈ 2.07944 / 0.69315 = 3.

Reference note: the number x must be greater than 0, and the base b must be greater than 0 and not equal to 1. The logarithm of a zero or negative number is undefined over the real numbers, and base 1 has no valid logarithm because 1 raised to any power is always 1.

Frequently asked questions

What is a logarithm?
A logarithm answers the question: to what power must I raise the base to get this number? If b raised to the power y equals x, then log base b of x equals y. For example, because 10³ = 1000, log base 10 of 1000 is 3.
What is the difference between log and ln?
Both are logarithms; they differ only in the base. "log" usually means the common logarithm, base 10, while "ln" is the natural logarithm, base e (about 2.71828). So log of 1000 is 3, while ln of e is 1.
What is the change-of-base formula?
It lets you compute a logarithm in any base using natural logs: log base b of x equals ln(x) divided by ln(b). It works with base 10 too: log base b of x equals log10(x) divided by log10(b). This is exactly how the calculator handles custom bases.
What is log base 2?
Log base 2 of x, sometimes written lb(x) or log2(x), is the exponent you raise 2 to in order to get x. For example, log base 2 of 8 is 3 because 2³ = 8. It is widely used in computing and information theory.
Why can't you take the log of a negative number?
For a positive base, raising the base to any real power always gives a positive result, so there is no real exponent that produces a negative number or zero. That is why the log of zero or a negative number is undefined over the real numbers.
What is the log of 1?
The logarithm of 1 is 0 in every valid base, because any non-zero base raised to the power 0 equals 1. So log10(1), ln(1) and log2(1) are all 0.
⚡ Logarithm Calculator — by larely ↗

Related tools

Factorial Calculator

Calculate n! exactly for any non-negative integer, including huge values.

Fibonacci Calculator

Generate the Fibonacci sequence and find the Nth Fibonacci number.

Molarity Calculator

Solve molarity = moles / liters, including from mass and molar mass.

Modulo Calculator

Calculate a mod n with quotient, remainder and negative-number handling.

Percent Error Calculator

Calculate percent error between an experimental and a true value.

Z-Score Calculator

Find a z-score and its percentile from a value, mean and standard deviation.

Cylinder Volume Calculator

Find a cylinder's volume, surface area and capacity in liters or gallons.

Half-Life Calculator

Calculate remaining quantity, decay constant and half-lives elapsed.

Percent Yield Calculator

Calculate reaction percent yield from actual and theoretical yield.

Trigonometry Calculator

Calculate sin, cos, tan and their inverses in degrees or radians.

Ideal Gas Law Calculator

Solve PV = nRT for pressure, volume, moles or temperature.

Weighted Average Calculator

Calculate a weighted average from value and weight pairs.

Browse all 251 free tools →