Logarithm Calculator

Calculate log₁₀, ln (natural log), log₂, or any custom base logarithm.

㏒ Logarithm Calculator
Number (x) - must be positive
Logarithm Base

What is a Logarithm?

A logarithm is the inverse of exponentiation. If you know that 10³ = 1000, then log₁₀(1000) = 3 - the logarithm tells you what exponent (3) you need to raise the base (10) to in order to get the result (1000). In general: if b^y = x, then log_b(x) = y.

Logarithms were invented in the early 17th century by John Napier as a way to transform multiplication into addition - which was far easier to do by hand for large numbers. Before electronic calculators, log tables were essential tools for astronomers, engineers, and navigators. Today, logarithms remain central to mathematics, science, and engineering.

The common logarithm (log₁₀) is used in chemistry for the pH scale (pH = −log₁₀[H⁺]), in seismology for the Richter scale (each unit represents a 10× increase in wave amplitude), in acoustics for decibels (dB = 10 × log₁₀(power ratio)), and in astronomy for the stellar magnitude scale. Because we count in base 10, log₁₀ is natural for expressing ratios involving powers of 10.

The natural logarithm (ln, base e where e ≈ 2.71828) arises naturally in calculus and differential equations. The derivative of ln(x) is 1/x - a remarkably simple result. It appears in compound interest (continuous compounding), radioactive decay, population growth, and information entropy. The number e itself emerges from the limit of (1 + 1/n)^n as n approaches infinity.

Log base 2 is the workhorse of computer science and information theory. Claude Shannon’s entropy formula uses log₂ to measure information in bits. Binary trees have height proportional to log₂(n). The number of digits needed to represent n in binary is ⌊log₂(n)⌋ + 1.

Formulas

Definition: log_b(x) = y  ⇔  b^y = x
b = base (b > 0, b ≠ 1)
x = argument (x > 0)
y = logarithm (the exponent)
Change of Base: log_b(x) = log(x) / log(b) = ln(x) / ln(b)
Product rule: log_b(xy) = log_b(x) + log_b(y)
Quotient rule: log_b(x/y) = log_b(x) − log_b(y)
Power rule: log_b(x^n) = n × log_b(x)
log_b(1) = 0  |  log_b(b) = 1  |  log_b(b^n) = n

How to Use This Calculator

Steps to Calculate a Logarithm

1
Enter the number (x) - must be positive. The calculator handles decimals and very large numbers.
2
Select the base: log₁₀ (common log), ln (natural log, base e), log₂ (binary log), or a Custom base.
3
Click Calculate to see the logarithm, anti-log, and the equivalent values in log₁₀, ln, and log₂ all at once.

Example Calculations

Example 1 - pH Calculation using log₁₀

A solution has [H⁺] = 0.001 mol/L. What is its pH?

1
pH = −log₁₀[H⁺] = −log₁₀(0.001)
2
log₁₀(0.001) = log₁₀(10^−3) = −3
3
pH = −(−3) = 3
pH = 3 (acidic solution)
Try this example →

Example 2 - Binary Storage using log₂

How many bits are needed to represent 4096 unique values?

1
Bits = log₂(4096)
2
4096 = 2^12, so log₂(4096) = 12
12 bits required (e.g. 12-bit colour depth = 4096 values per channel)
Try this example →

Example 3 - Continuous Compound Interest using ln

An investment doubles. With continuous compounding at 7% p.a., how long does it take?

1
A = Pe^(rt). For doubling: 2P = Pe^(0.07t), so 2 = e^(0.07t)
2
Take ln of both sides: ln(2) = 0.07t
3
t = ln(2) / 0.07 = 0.6931 / 0.07 ≈ 9.9 years
Doubling time ≈ 9.9 years (Rule of 70 approximation: 70/7 = 10 years)
Try this example →

Frequently Asked Questions

What is a logarithm?+
A logarithm answers the question: to what power must a base be raised to produce a given number? If log_b(x) = y, then b^y = x. For example, log₁₀(1000) = 3 because 10³ = 1000. The base-10 logarithm is called the common logarithm and the base-e logarithm (e ≈ 2.71828) is called the natural logarithm (ln).
What is the natural logarithm (ln)?+
The natural logarithm, written ln(x), is the logarithm with base e (Euler's number, approximately 2.71828). It appears naturally in calculus, compound interest, population growth, radioactive decay, and many physics equations. ln(e) = 1 and ln(1) = 0.
What is log base 2 used for?+
Log base 2 (log₂) is used extensively in computer science and information theory. The number of bits required to represent n items is log₂(n). For example, to store 256 values you need log₂(256) = 8 bits (one byte). Binary search complexity is O(log₂ n).
Why can't you take the log of zero or a negative number?+
Logarithms are only defined for positive real numbers. There is no real power to which any positive base can be raised to give 0 or a negative number. As x approaches 0 from the positive side, ln(x) approaches negative infinity. In complex number theory, logarithms of negative numbers are defined, but they involve imaginary components.
How do you convert between logarithm bases?+
Use the change of base formula: log_b(x) = log(x) / log(b), where log can be any common base (typically log₁₀ or ln). For example, log₂(50) = log₁₀(50) / log₁₀(2) = 1.69897 / 0.30103 ≈ 5.644.
What is the difference between log and ln?+
log (without a specified base) typically refers to log base 10 (common logarithm). ln refers to the natural logarithm, which uses base e (approximately 2.71828). log10(x) asks: 10 to what power gives x? ln(x) asks: e to what power gives x? Natural logarithm appears frequently in calculus, physics, and continuous growth/decay problems. Log base 10 is used in pH chemistry, decibels, and the Richter scale.
What are the logarithm laws?+
The four main logarithm laws: (1) Product rule: log(ab) = log(a) + log(b). (2) Quotient rule: log(a/b) = log(a) - log(b). (3) Power rule: log(a^n) = n x log(a). (4) Change of base: log_b(x) = log(x) / log(b) = ln(x) / ln(b). These rules apply to any consistent base. They allow simplification of complex logarithmic expressions and are the basis for solving exponential equations.
What is the logarithm of 0 or a negative number?+
The logarithm of 0 is undefined - no real number exponent makes a positive base equal to 0. As x approaches 0 from the positive side, log(x) approaches negative infinity. The logarithm of a negative number is also undefined in the real number system - no real exponent makes a positive base equal to a negative number. In complex number mathematics, logarithms of negative numbers exist but involve imaginary components.