Logarithm Calculator

The number and base must be positive; the base cannot equal 1. Use 10 for common logarithms, 2 for binary, or 2.718281828459045 for natural logarithms.

Logarithm

Logarithm
log⁡b(x)=ln⁡(x)ln⁡(b)\log_b(x)=\frac{\ln(x)}{\ln(b)}

About this tool

This calculator finds the logarithm of a positive number in any valid base, including common (base 10), natural (base ee) and binary (base 2) logarithms. Students, scientists and programmers use it for exponential growth, decibels, pH and algorithm complexity. The logarithm answers the question "to what power must the base be raised to get this number?": log⁡b(x)=y\log_b(x) = y means by=xb^y = x.

How it works

Enter a positive number and a positive base other than one. The change-of-base formula computes the real logarithm. Bases between zero and one are also supported.

For a common logarithm enter 10 as the base, for a binary logarithm enter 2, and for a natural logarithm enter 2.718281828459045. The result is the exponent y that satisfies by=xb^y = x, so you can check it by raising the base to that power. With a base greater than 1, numbers between 0 and 1 give negative logarithms; a base between 0 and 1 reverses the sign.

Example

The base-10 logarithm of 100 is 2, because 10 squared is 100. The base-2 logarithm of 8 is 3.

A few more cases show the pattern. The base-10 logarithm of 0.01 is −2, because 10−2=0.0110^{-2} = 0.01, and the natural logarithm of 10 is about 2.302585. The base-2 logarithm of 1,000,000 is about 19.93, which tells you that about 20 doublings take 1 past a million. With a base of 0.5, the logarithm of 8 is −3.

Assumptions and limits

The number and base must be positive, and the base cannot be 1. Only real logarithms are returned; complex logarithms of negative numbers are not computed. There is no dedicated natural-log option, so enter ee as 2.718281828459045. Results use double-precision floating point and show up to 12 significant digits.

Frequently asked questions

Can I take the logarithm of zero or a negative number?

Not as a finite real number. This calculator rejects zero and negative arguments and does not compute complex logarithms. As the number approaches zero from above, a logarithm with a base greater than 1 falls without limit, so there is no finite value at zero itself.

Why is base one not allowed?

Every power of one is one, so there is no unique inverse. Bases close to one can also magnify floating-point rounding, because ln⁡(b)\ln(b) in the denominator of the change-of-base formula becomes very small.

What is the difference between log and ln?

In most school and engineering contexts, log means the base-10 logarithm and ln means the natural logarithm with base e≈2.71828e \approx 2.71828. In some mathematics and programming contexts, log means the natural logarithm, so check the convention being used.

How do I convert a logarithm to a different base?

Use the change-of-base formula log⁡b(x)=ln⁡(x)ln⁡(b)\log_b(x) = \frac{\ln(x)}{\ln(b)}, which this calculator applies. Any base works in the numerator and denominator as long as both use the same one.

What is the logarithm of 1?

The logarithm of 1 is 0 in every valid base, because b0=1b^0 = 1. The logarithm of the base itself is always 1.

Link with your values

Add these parameters to this page’s address to open it with the values filled in, for example to share a calculation or to link to it from an AI assistant. The result is calculated in the browser: the page HTML shows an example for the default values, and the tool sets the data-url-params attribute once the link’s values are applied.

ParameterValueIf omitted
valueNumbernumber; allowed > 0required
baseBasenumber; allowed > 0required

Examples

  • ?value=1024&base=2
  • ?value=0.001&base=10

Write decimals with a point. Encode a space as %20, + as %2B, # as %23 and & as %26.

Result elements: [data-result-block="log_calculator"]