Logarithm Calculator (log base b of x)

Calculate log base b of x for any positive value and base, including common (base 10), natural (base e), and binary (base 2) logs, with steps.

Loading calculator…

What a logarithm means

A logarithm answers a "what power?" question. logbx=y\log_b x = y means: raising the base bb to the power yy gives xx. It is written the other way in exponent form:

logbx=y    by=x\log_b x = y \iff b^y = x

For example, log28=3\log_2 8 = 3 because 23=82^3 = 8 — you have to multiply 22 by itself 33 times to reach 88. A logarithm and an exponent describe the exact same relationship between bb, xx, and yy; the logarithm just solves for the exponent instead of the result.

The logarithm is the inverse of exponentiation

Exponentiation and logarithms undo each other, the same way addition/subtraction and multiplication/division do:

QuestionOperationExample
What is bb raised to the yy?Exponentiation: solve for xx in by=xb^y = x23=82^3 = 8
What power gives xx?Logarithm: solve for yy in logbx=y\log_b x = ylog28=3\log_2 8 = 3

Because they are inverses, raising the base to a logarithm always returns the original value: blogbx=xb^{\log_b x} = x. This calculator's "The defining identity" section shows this plugged-in check for every result.

Tip: If you already know the Exponents calculator computes byb^y, think of this calculator as running that relationship backwards: given bb and xx, it solves for yy.

Three named logarithms

Any positive base (other than 1) is valid, but three bases show up so often they have their own names:

NameBaseNotationCommon use
Common logarithm1010log10x\log_{10} x or just logx\log xpH scale, decibels, orders of magnitude
Natural logarithme2.718281828e \approx 2.718281828lnx\ln xcalculus, continuous growth/decay
Binary logarithm22log2x\log_2 xcomputer science, bits, binary search

Type e in the base field for the natural logarithm — this calculator treats the literal letter e as Euler's number, computed to full precision.

Why x and the base have restrictions

A logarithm is only defined when x>0x > 0 and the base bb satisfies b>0b > 0 and b1b \neq 1:

  • x0x \leq 0 is invalid. A positive base raised to any real power always stays positive — there is no real yy with by0b^y \leq 0 when b>0b > 0.
  • b0b \leq 0 is invalid. Raising a negative base to a non-integer power (which almost every logarithm result is) is not a real number.
  • b=1b = 1 is invalid. 1y=11^y = 1 for every yy, so log1x\log_1 x has no single answer — it is left undefined rather than guessed at.

This calculator reports any of those combinations as out of range instead of returning a misleading number.

Exact results vs. decimal approximations

When xx is a perfect power of the base — like log28\log_2 8 or log101000\log_{10} 1000 — the result is a whole number, computed exactly. Most inputs are not perfect powers, so the result is an irrational decimal, which this calculator rounds to 6 decimal places: log1080.903090\log_{10} 8 \approx 0.903090, since no whole power of 10 lands exactly on 8.

Example 1 (exact, binary log): log28=3\log_2 8 = 3, since 23=82^3 = 8.

Example 2 (exact, common log): log101000=3\log_{10} 1000 = 3, since 103=100010^3 = 1000.

Example 3 (exact, natural log): lne=1\ln e = 1, since e1=ee^1 = e.

Example 4 (decimal approximation): log1080.903090\log_{10} 8 \approx 0.903090, since 100.903090810^{0.903090} \approx 8.

Where logarithms show up

Logarithms compress huge ranges of numbers into manageable scales — the Richter scale, the decibel scale, and pH are all logarithmic for exactly this reason. In finance, the natural log turns compound growth rates into something you can add and subtract. In computer science, binary logarithms measure how many times a problem can be split in half, which is why sorting and searching algorithms are described in terms of log2n\log_2 n. For the reverse question — solving an equation for an unknown exponent — see the related exponent calculators; for whole-number and fractional powers themselves, see the Exponents calculator and the Fractional Exponents calculator.

Frequently asked questions

What is a logarithm?
A logarithm answers the question "what power do I raise the base to, to get this number?" logbx=y\log_b x = y means the same thing as by=xb^y = x — the logarithm and the exponent are inverse operations. For example log28=3\log_2 8 = 3 because 23=82^3 = 8.
What is the difference between log and ln?
log10x\log_{10} x (often written just logx\log x) is the common logarithm, base 10. lnx\ln x is the natural logarithm, base e2.718281828e \approx 2.718281828. Both are logarithms — they only differ in which base is used. This calculator computes either (and any other positive base) depending on what you enter in the base field.
Why can't the base be 1, and why can't x be 0 or negative?
A logarithm is only defined for x>0x > 0 and a base b>0b > 0 with b1b \neq 1. If x0x \leq 0, no real power of a positive base ever produces xx (a positive base to any real power stays positive). If b=1b = 1, then 1y=11^y = 1 for every yy, so log1x\log_1 x could be any number — the equation has no unique answer, so it is left undefined.
What is a common logarithm?
A common logarithm is a logarithm with base 10: log10x\log_{10} x, often written without the subscript as just logx\log x. Before calculators, common logs were used to turn multiplication into addition (via log tables) and they still appear throughout science, e.g. the pH scale and the decibel scale are both base-10 logarithmic scales.
What is a natural logarithm?
A natural logarithm has base ee (Euler's number, approximately 2.718281828), written lnx\ln x. It shows up naturally in calculus, continuous compound growth and decay, and many formulas in physics and finance, because exe^x is its own derivative.
What is a binary logarithm used for?
A binary logarithm has base 2, written log2x\log_2 x. It answers "how many times do I need to double 1 to reach x?" and shows up constantly in computer science — the number of bits needed to represent a number, and the number of steps in a binary search or a balanced binary tree, both grow like log2n\log_2 n.
How is a logarithm the inverse of an exponent?
Exponentiation and logarithms undo each other, the same way multiplication and division do. by=xb^y = x and logbx=y\log_b x = y describe the same three numbers (bb, xx, yy) — exponentiation solves for xx given bb and yy, while the logarithm solves for yy given bb and xx. Raising the base to the log always gives back the original number: blogbx=xb^{\log_b x} = x.
Why is a logarithm sometimes a rounded decimal instead of a whole number?
Most values of x are not exact whole-number powers of the base, so yy is usually an irrational decimal. log1080.903090\log_{10} 8 \approx 0.903090 because no whole number of 10s multiplies together to give exactly 8 — this calculator shows the decimal approximation rounded to 6 places. When x IS a perfect power of the base (like log28=3\log_2 8 = 3), the result is exact.

Related calculators