Skip to content
1001 Tools
sr
Math & education

Logarithm Calculator

Enter a number and a base to find its logarithm — the power the base must be raised to in order to reach that number. The base defaults to 10, and every result also shows the natural log (base e), common log (base 10) and binary log (base 2) so you have the usual three at a glance.

Defaults to 10. The natural log (base e) is shown below.

Enter a positive number and a base.

How it works

A logarithm answers the question "to what power?". log_b(x) = y means bʸ = x, so log₂(8) = 3 because 2³ = 8. It is the inverse of raising to a power: logs undo exponents, which is why they turn multiplication into addition and huge ranges into manageable scales.

The tool computes any base using the change-of-base formula, log_b(x) = ln(x) ÷ ln(b), which is how calculators handle bases other than e or 10. The input must be positive — the log of zero or a negative number is undefined for real results — and the base must be positive and not equal to 1, since base 1 never reaches any other number.

Practical examples

How many digits a number has

The base-10 log of 8,500,000 is about 6.93, and adding 1 then rounding down gives 7 — the number of digits. Logs measure order of magnitude directly.

Doubling steps in binary

log₂(1024) = 10, meaning it takes 10 doublings to reach 1024. That is why 2¹⁰ bytes make a kibibyte and why binary logs describe algorithm depth.

A decibel-style ratio

A sound ten times more intense adds log₁₀(10) = 1 to the exponent, i.e. 10 dB. Logarithmic scales like decibels and pH compress wide ranges into readable numbers.

Frequently asked questions

What is a logarithm?

It is the exponent you need. log_b(x) is the power to which the base b must be raised to get x. Because 10² = 100, log₁₀(100) = 2. Logs are the inverse operation of exponentiation.

What do ln, log and lg mean?

ln is the natural logarithm, base e (about 2.71828). "log" on its own usually means base 10 (the common log), though in some texts it means base e. "lg" typically means base 2. This tool shows all three alongside your chosen base.

Why must the number be positive?

Because a positive base raised to any real power is always positive, so it can never equal zero or a negative number. The logarithm of a non-positive value has no real result, and the tool reports it as an error.

Why can’t the base be 1 or negative?

1 raised to any power is always 1, so log base 1 can only ever reach 1 and is undefined otherwise. A negative or zero base doesn’t give a consistent real logarithm either, so bases must be positive and not equal to 1.

What is the change-of-base formula?

log_b(x) = log_k(x) ÷ log_k(b) for any valid base k. Using the natural log gives log_b(x) = ln(x) ÷ ln(b). It lets you compute a logarithm in any base from logs you already have.

How are logarithms related to exponents?

They are inverses. If bʸ = x then log_b(x) = y. So this calculator undoes what an exponent calculator does: enter 2 and 10 in an exponent tool to get 1024, then take log₂(1024) here to get back 10.

Why does log(1) always equal 0?

Because any non-zero base raised to the power 0 equals 1 (b⁰ = 1). So no matter the base, the logarithm of 1 is 0. Likewise log_b(b) is always 1.

What are logarithms used for?

They turn multiplicative growth into straight lines and compress huge ranges: decibels for sound, the Richter scale for earthquakes, pH in chemistry, and the running time of divide-and-conquer algorithms are all logarithmic.

How precise is the result?

It uses the browser’s double-precision math, accurate to roughly 15 significant figures, and is displayed to several decimals. Irrational results like log₁₀(2) are shown rounded, not exact.

Is anything sent to a server?

No. The logarithm is computed locally in your browser. The number and base you enter are never uploaded.

Related tools