Logarithm Calculator

Three ways to work with logarithms in one place: calculate the logarithm of a value in any base, compare the most common logarithms (base 10, natural, and base 2) of the same number, or calculate pH from H+ concentration using the logarithmic scale. No sign-up, instant results.

Logarithm calculator

result 0

Compare common logarithms

log₁₀ (base 10) 0
ln (base e) 0
log₂ (base 2) 0

pH calculator

pH 0
H+ concentration (mol/L) 0

What a logarithm is

A logarithm is the inverse operation of exponentiation. The logarithm of a number x in base b, written as logₜ(x), is the exponent that b needs to be raised to in order to produce x. For example, log₁₀(1000) = 3, because 10³ = 1000. If exponentiation answers "what is the result of raising a base to an exponent," the logarithm answers the reverse question: "what exponent do I need to raise this base to, to get this result."

The change-of-base formula

Since calculators and most programming languages only implement the natural logarithm (ln) natively, a logarithm in any other base is calculated using the change-of-base formula: logₜ(x) = ln(x) / ln(b). That's how this calculator produces a result for any custom base you enter.

Log, ln, and log2: the most common bases

Common logarithm (base 10): usually just written as "log", widely used in engineering, scales like pH and decibels, and scientific notation.

Natural logarithm (base e): written as "ln", where e is Euler's number (approximately 2.71828). It shows up naturally in calculus, continuous exponential growth, and continuously compounded interest.

Binary logarithm (base 2): written as "log2", widely used in computer science, since it describes how many times a value can be divided in half, directly related to data structures and algorithms.

Worked example

If an investment doubles in value every year, the base-2 logarithm of the total growth factor tells you how many years that took. For example, if the investment multiplied by 8, log₂(8) = 3, so the doubling happened 3 times, meaning 3 years.

Logarithms and the pH scale

The pH of a solution is defined as the negative base-10 logarithm of the molar concentration of hydrogen ions (H+): pH = −log₁₀[H+]. This logarithmic scale is used because the H+ concentration can vary by many orders of magnitude between acidic and basic solutions, and the logarithm compresses that enormous range into a more practical scale from 0 to 14. A difference of just 1 in pH represents a 10-fold difference in actual H+ concentration.

Frequently asked questions

What is a logarithm?

It's the exponent a base needs to be raised to in order to produce a number. The logarithm of 1000 in base 10 is 3, because 10³ = 1000.

What is the difference between log and ln?

"log" is usually the base-10 logarithm, and "ln" is the natural logarithm, base e (approximately 2.71828).

How is the logarithm used to calculate pH?

pH is the negative base-10 logarithm of H+ concentration. A concentration of 10⁻⁷ mol/L results in a pH of 7 (neutral).