Logarithm Calculator

Calculate log_b(x) for any base, common logs (base 10) and natural logs (ln), use the change-of-base formula, or solve bˣ = y and log_b(x) = y, with every step shown.

Positive, not 1: e.g. 2, 10, e or 0.5

Positive: e.g. 8, 0.5, 1e6 or 2^20

Try
log₂(8)= 3Because 2 raised to the power 3 is exactly 8.
Base (b)
2
Number (argument)
8
Exponential form
2^y = 8
Exact result
3
Decimal result
3

Step-by-step solution

  1. Step 1: Write the logarithm as an unknown

    log₂(8) = y

  2. Step 2: Convert to exponential form

    A logarithm asks: what power of the base gives the number? So log₂(8) = y means:

    2^y = 8

  3. Step 3: Find the exponent

    2³ = 8

    y = 3

  4. Step 4: Answer

    log₂(8) = 3

Graph of y = log₂(x)

x = 0 (asymptote)246810−3−2−10123(0.25, −2)(0.5, −1)(1, 0)(2, 1)(4, 2)(8, 3)
y = log₂(x), base 2Vertical asymptote x = 0Your result: (8, 3)

The same number in other bases

Base 2, base 10 and natural logarithms of the same number
LogarithmBaseValue
log₂(8)23
log₁₀(8)10≈ 0.903089986992
ln(8)e ≈ 2.718≈ 2.07944154168

All three are proportional: ln(x) = log₁₀(x) × ln(10) ≈ 2.3026 × log₁₀(x), and log₂(x) = log₁₀(x) ÷ log₁₀(2).

Logarithms undo powers: to go the other way, raise a number to a power with the Exponent Calculator. For very large or small numbers, see the Scientific Notation Calculator; for longer expressions, the Scientific Calculator.

A logarithm is the inverse of a power: log_b(x) is the exponent you raise b to in order to get x, so log₂(8) = 3 because 2³ = 8. This logarithm calculator works out logs in any valid base, the common logarithm (base 10) and the natural logarithm (ln, base e), and shows exact answers such as 3 or 2/3 when they exist and clearly rounded decimals when the result is irrational.

It also applies the change-of-base formula, solves exponential equations such as 2ˣ = 32 and logarithmic equations such as log₂(x) = 5, and graphs y = log_b(x). Every answer comes with a step-by-step solution that uses your numbers.

What Is a Logarithm?

A logarithm answers the question: what power do I raise the base to, to get this number? Since 2³ = 8, the logarithm of 8 with base 2 is 3, written log₂(8) = 3. Logarithms turn multiplication into addition and powers into multiplication, which is why they are used for quantities that span many orders of magnitude.

Logarithm Formula

log_b(x) = y means bʸ = x

b
the base: a positive number other than 1
x
the argument: the number you take the logarithm of, which must be positive
y
the logarithm: the exponent, which can be any real number (negative when 0 < x < 1 for b > 1)

The domain rules follow from the definition. A positive base raised to any power is positive, so x must be positive: log(0) and the logarithm of a negative number have no real value. A base of 1 is excluded because every power of 1 is 1, and negative bases are excluded because their powers are not defined for all real exponents.

Logarithm Rules

These properties hold for a valid base (b > 0, b ≠ 1) and positive arguments. They don’t apply to zero or negative values, because those logarithms don’t exist.

Product rule

log_b(xy) = log_b(x) + log_b(y)

log₂(8 × 4) = 3 + 2 = 5

Valid when: x > 0 and y > 0

Quotient rule

log_b(x/y) = log_b(x) − log_b(y)

log₁₀(1000/10) = 3 − 1 = 2

Valid when: x > 0 and y > 0

Power rule

log_b(xⁿ) = n · log_b(x)

log₂(8⁵) = 5 × 3 = 15

Valid when: x > 0; any real n

Change of base

log_b(x) = log_a(x) / log_a(b)

log₂(10) = ln 10 / ln 2 ≈ 3.3219

Valid when: a > 0, a ≠ 1

Identity

log_b(b) = 1

log₇(7) = 1

Valid when: because b¹ = b

Logarithm of 1

log_b(1) = 0

ln(1) = 0

Valid when: because b⁰ = 1

There is no rule for sums: log(x + y) is not log(x) + log(y). For example, log₁₀(10 + 10) = log₁₀(20) ≈ 1.301, but log₁₀(10) + log₁₀(10) = 2.

Common Log vs Natural Log

Common and natural logarithms compared
Common logarithmNatural logarithm
Base10e ≈ 2.718281828
Writtenlog(x) or log₁₀(x)ln(x) or logₑ(x)
Examplelog(1000) = 3ln(e²) = 2
Typical usesOrders of magnitude, pH, decibels, earthquake magnitudes, engineering scalesCalculus, continuous growth and decay, compound interest, statistics

They differ only by a constant factor, ln(x) ≈ 2.302585 × log₁₀(x), so neither is more “correct”; the choice depends on the field. Be aware that in some textbooks and programming languages, log(x) means the natural log. Check which convention your source uses.

Change of Base Formula

log_b(x) = log_a(x) / log_a(b) = ln(x) / ln(b) = log(x) / log(b)

Most calculators only have log and ln keys, so a logarithm in any other base is found by dividing two logarithms in a base you have. For log₂(10): log(10) ÷ log(2) = 1 ÷ 0.30103 ≈ 3.32193, and ln(10) ÷ ln(2) gives the same answer. The new base a can be any valid base.

Logarithms and Exponents

bˣ = y if and only if log_b(y) = x

Logarithms and exponentials are inverse functions: each undoes the other. 2³ = 8 is the same fact as log₂(8) = 3, and 10⁻² = 0.01 is the same fact as log₁₀(0.01) = −2. That gives two tools:

  • To solve for an exponent, take a logarithm: 2ˣ = 32 ⇒ x = log₂(32) = 5.
  • To solve for the argument, exponentiate: log₂(x) = 5 ⇒ x = 2⁵ = 32.

The graph of y = log_b(x) is the mirror image of y = bˣ across the line y = x. It passes through (1, 0) and (b, 1), and approaches the y-axis (x = 0) without touching it. For powers and roots, use the Exponent Calculator.

Logarithm Examples

Exponential equation

Solve 2ˣ = 64.

bˣ = y ⇔ x = log_b(y)

x = log₂(64)

2⁶ = 64

x = 6

x = 6

Taking the logarithm with the same base as the power undoes it, turning an unknown exponent into a number you can calculate.

pH of a solution

A solution has a hydrogen-ion concentration of 1 × 10⁻⁴ mol/L.

pH = −log₁₀[H⁺]

log₁₀(10⁻⁴) = −4

pH = −(−4) = 4

pH = 4

The pH scale is logarithmic: each step of 1 is a tenfold change in hydrogen-ion concentration, so pH 4 is ten times as acidic as pH 5. The pH Calculator covers the chemistry in more detail.

Sound level in decibels

A sound has 1,000 times the reference intensity I₀.

L = 10 · log₁₀(I / I₀) dB

log₁₀(1,000) = 3

L = 10 × 3 = 30 dB

30 dB

Decibels compress a huge range of intensities into manageable numbers. Doubling the intensity adds only 10 · log₁₀(2) ≈ 3 dB.

Doubling time

How long does 1,000 take to double at 5% growth per year?

1,000 × 1.05ᵗ = 2,000 ⇒ t = log(2) / log(1.05)

1.05ᵗ = 2

t = ln 2 ÷ ln 1.05

t = 0.693147 ÷ 0.048790 ≈ 14.21

About 14.2 years

Logarithms solve for time (the exponent) in growth problems. This assumes a constant 5% growth each year.

Earthquake magnitude

Compare a magnitude 6 and a magnitude 4 earthquake.

M = log₁₀(A / A₀), so the amplitude ratio is 10^(M₁ − M₂)

10^(6 − 4) = 10² = 100

100 times the ground-motion amplitude

On a logarithmic magnitude scale, each whole number means 10 times the measured amplitude (and roughly 32 times the energy released), so small differences in magnitude are large physical differences.

Related: the pH Calculator for acidity, the Half-Life Calculator for exponential decay, and the Compound Interest Calculator for growth with regular deposits.

Common Logarithm Mistakes

  • Confusing log and ln: log(100) = 2 but ln(100) ≈ 4.605. Check which base your calculator or formula expects.
  • Using base 1: log₁(10) has no value, because every power of 1 is 1.
  • Taking the log of zero: log(0) is undefined; no power of a positive base is 0.
  • Taking the log of a negative number: log₂(−4) is not a real number, since powers of 2 are always positive.
  • Misusing the product and quotient rules: log(x · y) = log x + log y, but log(x + y) can’t be split, and log(x) / log(y) is not log(x − y).
  • Swapping the base and the argument: log₂(8) = 3, but log₈(2) = 1/3. In fact log_b(x) = 1 / log_x(b).

How to Use the Logarithm Calculator

  1. Choose a mode: any base, common log (base 10), natural log (base e), change of base, solving bˣ = y, solving log_b(x) = y, or typing an expression.
  2. Enter the base and the number (argument). The number must be positive, and the base must be positive and not 1. You can type decimals, fractions (3/4), e, e^2, scientific notation (5e12) or powers such as 2^100.
  3. Read the result: exact answers such as 3 or 2/3 are shown when the logarithm is rational; otherwise the rounded decimal is labelled with ≈. Choose how many decimal places to display.
  4. Follow the step-by-step solution, which rewrites the logarithm in exponential form using your numbers, or uses the change-of-base formula when the answer is irrational.
  5. Use the graph to see y = log_b(x) for your base, with its key points and the vertical asymptote at x = 0, and compare log₂, log₁₀ and ln of the same number.

Frequently Asked Questions

What is a logarithm?

A logarithm is the exponent a base must be raised to in order to produce a number. log_b(x) = y means bʸ = x; for example log₂(8) = 3 because 2³ = 8.

How do you calculate a logarithm?

Rewrite it as a power: to find log₅(125), ask which power of 5 gives 125. Since 5³ = 125, the answer is 3. When no simple power works, use the change-of-base formula, such as log₂(10) = log(10) ÷ log(2) ≈ 3.3219.

What is the difference between log and ln?

log usually means the common logarithm with base 10, and ln is the natural logarithm with base e ≈ 2.71828. They differ by a constant factor: ln(x) ≈ 2.302585 × log(x). Some fields and programming languages use log for the natural log, so check the convention.

What is the base of a common logarithm?

The common logarithm has base 10: log(1000) = 3 because 10³ = 1000.

What is the base of a natural logarithm?

The natural logarithm has base e, an irrational constant approximately equal to 2.718281828. ln(e) = 1 and ln(1) = 0.

What is the change-of-base formula?

log_b(x) = log_a(x) ÷ log_a(b) for any valid base a. In practice, log_b(x) = ln(x) ÷ ln(b) or log(x) ÷ log(b); for example log₂(10) = log(10) ÷ log(2) ≈ 3.32193.

Can the base of a logarithm be 1?

No. Every power of 1 equals 1, so log₁(x) has no answer for x ≠ 1 and infinitely many for x = 1. The base must be positive and not equal to 1.

Can you take the logarithm of zero?

No. No power of a positive base equals 0, so log(0) is undefined. As x approaches 0 from above, log_b(x) decreases without limit (for b > 1).

Can you take the logarithm of a negative number?

Not in the real numbers. A positive base raised to any real power is positive, so it never equals a negative number. Logarithms of negative numbers exist only as complex numbers.

How are logarithms related to exponents?

They are inverses: bˣ = y if and only if log_b(y) = x. For example 10² = 100 and log₁₀(100) = 2 express the same fact.

How do you solve an exponential equation using logarithms?

Take the logarithm of both sides to bring the exponent down. For bˣ = y, x = log_b(y) = ln(y) ÷ ln(b); for example 2ˣ = 30 gives x = ln 30 ÷ ln 2 ≈ 4.9069, and 2ˣ = 32 gives exactly x = 5.

Last updated: September 29, 2026.