Logarithm Calculator
Calculate log base b of x, natural log, and see the change-of-base formula.
Reviewed by the ToolNestr Editorial Team — July 2026
Enter base b and argument x, then click Calculate.
What is a logarithm?
A logarithm answers the question: to what exponent must a given base be raised to produce a specific number? If by = x, then logb(x) = y. The base b must be positive and not equal to 1, and the argument x must be positive. Logarithms are the inverse operation of exponentiation, just as subtraction is the inverse of addition and division is the inverse of multiplication.
logb(x) = y ⇔ by = x
For example, log₁₀(1000) = 3 because 10³ = 10 × 10 × 10 = 1000. Similarly, log₂(32) = 5 because 2⁵ = 32. The number 2 raised to the power of 5 equals 32, so the logarithm (the exponent we need) is 5.
Common bases
Base 10 (common log)
log₁₀ or simply log. Used in pH chemistry, the Richter scale for earthquakes, decibels for sound intensity, and the belief network in astronomy. It is the default base in many scientific fields and on most standard calculators.
Base e (natural log)
ln(x) = loge(x) where e ≈ 2.71828. The natural log is fundamental in calculus — the derivative of ln(x) is 1/x, and it appears in formulas for compound interest, population growth, radioactive decay, and many differential equations describing natural phenomena.
Base 2 (binary log)
log₂ is central to computer science — the number of bits needed to represent n values is ⌈log₂(n)⌉. It also describes doubling time in exponential growth, the binary search algorithm's efficiency (log₂(n) comparisons), and information entropy in communication theory.
The change-of-base formula
Most calculators only have keys for log₁₀ (log) and ln (natural log). To compute logarithms with an arbitrary base, use the change-of-base formula:
logb(x) = logc(x) / logc(b)
The formula works for any positive base c ≠ 1, but we typically choose c = 10 or c = e since those are available on every calculator. This tool uses the natural log internally: logb(x) = ln(x) / ln(b). The result is the same regardless of which intermediate base c you pick.
For example, to compute log₂(32): log₂(32) = ln(32) / ln(2) = 3.4657 / 0.6931 = 5.000. And indeed 2⁵ = 32. The formula is derived from the relationship by = x. Take logc of both sides: y · logc(b) = logc(x), then solve for y to get y = logc(x) / logc(b).
Worked examples
Example 1: log₂(32)
Since 2⁵ = 32, the exponent needed is 5. Therefore log₂(32) = 5. Using the change-of-base formula: ln(32) ÷ ln(2) = 3.4657 ÷ 0.6931 = 5.
Example 2: log₁₀(1000)
10³ = 1000, so log₁₀(1000) = 3. The common log of 1000 is exactly 3 because the base and argument share a convenient power relationship. This is why log₁₀ is intuitive — each integer increase corresponds to multiplying by 10.
Example 3: log₃(81)
3⁴ = 81, so log₃(81) = 4. Using the change-of-base formula with natural logs: ln(81) ÷ ln(3) = 4.3944 ÷ 1.0986 = 4. Notice that 81 = 3⁴, so the logarithm is simply 4.
Real-world use cases
pH chemistry
The pH of a solution is defined as pH = −log₁₀[H⁺], where [H⁺] is the concentration of hydrogen ions in moles per litre. A pH of 3 has ten times the hydrogen ion concentration of pH 4. The logarithmic scale compresses a huge range of concentrations (10⁻¹ to 10⁻¹⁴ M) into a simple 0–14 scale.
Doubling time
If a population grows at rate r per period, the doubling time is t = ln(2) / ln(1 + r). Base-2 logs naturally express how many doublings have occurred. For example, if bacteria double every hour, after t hours the population is 2t times the original; log₂ tells you the exponent directly.
Decibels
Sound intensity level in decibels is L = 10 · log₁₀(I / I₀), where I₀ is the reference threshold of hearing. A 20 dB increase represents 100× more intense sound (since 10·log₁₀(100) = 20). The logarithmic ear perceives ratios, not linear differences.
Richter scale
Each whole number on the Richter scale represents a tenfold increase in measured amplitude and roughly 31.6 times more energy release. A magnitude 6 earthquake releases about 1000× the energy of a magnitude 4 (since 31.6² ≈ 1000). The logarithmic scale condenses a vast energy range.
Tips for working with logarithms
The argument must be positive
Logarithms are only defined for positive arguments. You cannot take the log of zero or a negative number. As x approaches 0 from the positive side, log(x) approaches negative infinity. The domain of logb(x) is x > 0.
The base must be positive and not equal to 1
If the base is 1, then 1y = 1 for all y, so log₁(x) is undefined for any x ≠ 1. If the base is less than or equal to 0, the function becomes discontinuous and non-real for most inputs. Valid bases are in the range (0, 1) ∪ (1, ∞).
Logarithms turn multiplication into addition
The fundamental property logb(x · y) = logb(x) + logb(y) made logarithms invaluable before electronic calculators — slide rules and logarithm tables let engineers multiply large numbers by adding their logarithms. This property also underlies logarithmic scale graphs.
Power and root rules
logb(xp) = p · logb(x) and logb(ⁿ√x) = (1/n) · logb(x). These are useful for simplifying equations involving exponents and roots. For example, log₂(√8) = (1/2) · log₂(8) = (1/2) · 3 = 1.5, which checks out since √8 ≈ 2.828 and 21.5 ≈ 2.828.
Related tools
- Quadratic Equation Solver — solve ax² + bx + c = 0 with step-by-step work.
- GCD and LCM Calculator — find greatest common divisor and least common multiple of two numbers.
- Scientific Calculator — perform advanced mathematical operations.
Frequently asked questions
What is a logarithm?
log_b(x) = y means b^y = x. It answers "to what power must b be raised to get x?"
What is the natural log?
ln(x) = log_e(x), where e ≈ 2.71828. It is used extensively in calculus and science.
What is the change of base formula?
log_b(x) = log_c(x) / log_c(b). This lets you compute any log using log_10 or ln.
What is log(0)?
Log(0) is undefined — there is no power that gives 0. As x → 0+, log(x) → −∞.