Logarithms Explained: Bases, ln, Change of Base and Real Uses
What log_b(x) means, the three log laws, the change-of-base formula, when a log is an exact fraction, and logarithmic scales from pH to decibels to bits.
By Redbison Dev · · Updated · 9 min read

A logarithm is an exponent looked at from the other side. Ask "2 to what power is 1024?" and the answer, 10, is log₂ 1024. That one idea explains the notation, the rules and why logarithms keep turning up in chemistry, acoustics, computing and finance. This article covers what a logarithm is, the three laws, the change-of-base formula, when a logarithm comes out as an exact fraction, and the logarithmic scales you meet in everyday measurements. The Logarithm Calculator will check any of the examples.
What log_b(x) means
log_b(x) = y means exactly the same as bʸ = x
The base b must be positive and not 1, and x must be positive. Some quick values:
| Expression | Because | Value |
|---|---|---|
| log₁₀ 1000 | 10³ = 1000 | 3 |
| log₂ 1024 | 2¹⁰ = 1024 | 10 |
| log₁₀ 0.001 | 10⁻³ = 0.001 | −3 |
| log₅ 1 | 5⁰ = 1 | 0 |
| log₈ 32 | 8^(5/3) = 32 | 5/3 |
| ln e² | e² = e² | 2 |
Three bases have their own names. The common logarithm, log₁₀, is often written just log on calculators and in science. The natural logarithm, ln, has base e ≈ 2.718281828, the base that makes calculus tidiest because the slope of ln x is exactly 1/x. The binary logarithm, log₂, counts doublings and is everywhere in computing. A warning about notation: in pure mathematics and in most programming languages, log with no base means the natural log, not log₁₀. Python's math.log(100) is 4.605…, not 2.
Why x must be positive
A positive base raised to any real power gives a positive result. There is no real y with 10ʸ = 0 or 10ʸ = −5, so log₁₀ 0 and log₁₀(−5) are undefined over the real numbers. As x shrinks toward zero, log x falls without limit toward minus infinity, which you can see in the graph below. The base cannot be 1 because 1 to every power is 1, so log₁ 5 would have no answer and log₁ 1 would have every answer.
All logarithm curves pass through (1, 0) and (b, 1). Bigger bases give flatter curves, because it takes a smaller exponent of a big base to reach a given number.
The three laws
Because logarithms are exponents, the exponent rules translate directly:
log_b(xy) = log_b x + log_b y (product rule)
log_b(x/y) = log_b x − log_b y (quotient rule)
log_b(xⁿ) = n · log_b x (power rule)
The product rule is the reason logarithms were invented. John Napier published the first tables in 1614 and Henry Briggs produced base-10 tables soon after, because adding two numbers from a table is far easier than multiplying two eight-digit numbers by hand. The slide rule, which engineers carried until pocket calculators arrived in the 1970s, is the product rule made physical: two logarithmic scales slide against each other so that adding lengths multiplies numbers.
Common mistakes come from inventing rules that do not exist. log(x + y) is not log x + log y, and (log x)² is not 2 log x. Only products, quotients and powers inside the log simplify.
Change of base
Calculators usually have ln and log₁₀ buttons and nothing else. To get any other base, divide:
log_b(x) = ln x / ln b = log₁₀ x / log₁₀ b
The proof takes one line: if y = log_b x then bʸ = x, so taking natural logs of both sides gives y ln b = ln x, and y = ln x / ln b. For example, log₅ 100 = ln 100 / ln 5 = 4.605170 / 1.609438 = 2.861353. Two useful special cases are ln x = 2.302585… × log₁₀ x and log₂ x = 3.321928… × log₁₀ x.
The Logarithm Calculator accepts any base directly, works to 80 significant digits and shows 30, and prints the change-of-base working so you can follow it on paper.
When is a logarithm exact?
Most logarithms are irrational. log₁₀ 2 = 0.301029995663981195213738894724… never ends or repeats, and you can prove it: if log₁₀ 2 were p/q then 10ᵖ = 2^q, but 10ᵖ has a factor of 5 and 2^q does not.
The same reasoning tells you when a logarithm is a fraction. log_b x = p/q exactly when x^q = bᵖ. For log₈ 32, both numbers are powers of 2: 8 = 2³ and 32 = 2⁵, so 32³ = 2¹⁵ = 8⁵ and log₈ 32 = 5/3. Similarly log₄ 8 = 3/2 and log₂₇ 9 = 2/3. The calculator looks for such fractions by taking the high-precision decimal, finding the nearby fractions with small denominators by continued fractions, and confirming the winner with exact whole-number arithmetic. That last step matters: a decimal that looks like 1.6666666666 might not be 5/3, and only the integer check proves it.
Characteristic and mantissa
Before calculators, people looked up common logarithms in printed tables, and the tables listed only the fractional part. The reason is neat. log₁₀ 3.7 = 0.5682, log₁₀ 37 = 1.5682 and log₁₀ 3700 = 3.5682. Moving the decimal point only changes the integer part, called the characteristic, while the fractional part, the mantissa, depends only on the digits. One table of mantissas for 1.000 to 9.999 covered every number.
The characteristic still has a modern use: for x ≥ 1, the number of digits before the decimal point is the characteristic plus 1. log₁₀ 1024 = 3.0103, so 1024 has 4 digits. The same trick tells you that 2^1000 has floor(301.03) + 1 = 302 digits without computing it.
Logarithmic scales you already use
When a quantity ranges over many powers of ten, a logarithmic scale squeezes it into manageable numbers. Each step on the scale is a constant ratio, not a constant difference.
| Scale | Definition | One step means |
|---|---|---|
| pH | −log₁₀ of hydrogen-ion activity | 10 times more or less acidic |
| Decibels (power) | 10 log₁₀(P / P₀) | +10 dB = 10 times the power; +3 dB ≈ double |
| Decibels (amplitude) | 20 log₁₀(V / V₀) | +20 dB = 10 times the voltage or pressure |
| Earthquake magnitude | log₁₀ of wave amplitude, roughly | 10 times the amplitude, about 32 times the energy |
| Bits | log₂ of the number of values | Twice as many values |
| Musical octave | log₂ of frequency ratio | Double the frequency |
Going the other way is the antilog. If blood has a pH of 7.4, its hydrogen-ion activity is 10^−7.4 ≈ 3.98 × 10⁻⁸ mol/L. A pKa of 4.76 for acetic acid means Ka = 10^−4.76 ≈ 1.74 × 10⁻⁵. The Logarithm Calculator's antilog mode does this directly, and the pH Calculator and Decibel Calculator wrap the same arithmetic in their own units.
Logarithms in computing
Binary search halves the remaining range at each step, so finding one item among a million takes at most ceil(log₂ 1,000,000) = 20 comparisons. A number up to N needs floor(log₂ N) + 1 bits; log₂ 1000 = 9.97, so 1000 needs 10 bits. Information theory measures information in bits for the same reason: an event with probability p carries −log₂ p bits.
Logarithms in growth and decay
To find how long something takes to grow by a factor, solve bᵗ = factor for t, which is t = log(factor) / log(b). Money at 5% doubles in ln 2 / ln 1.05 = 14.2 years. A radioactive sample with a half-life of 5730 years (carbon-14) falls to 10% of its original amount after 5730 × log₂ 10 = 5730 × 3.3219 ≈ 19,035 years. The Half-Life Calculator uses exactly this.
Solving for the base
Sometimes you know the log and the number but not the base: log_b 81 = 4. Rewrite as b⁴ = 81 and take the fourth root: b = 81^(1/4) = 3. The base is always positive, so although (−3)⁴ = 81 too, −3 is not a valid base. The calculator's base mode does this and returns an exact answer whenever the root is exact, such as log_b 2 = 0.5 giving b = 4.
Summary
- log_b x is the exponent y with bʸ = x; x > 0, b > 0, b ≠ 1.
- Products become sums, quotients become differences, powers become multipliers.
- Change base with log_b x = ln x / ln b.
- A log is a fraction p/q exactly when x^q = bᵖ.
- Logarithmic scales count ratios: pH, decibels, magnitudes, bits and octaves.
Work through your own numbers in the Logarithm Calculator, and use the Exponent Calculator for the inverse direction.
Frequently asked questions
What are the product, quotient and power rules for logarithms?
The product rule is log_b(xy) = log_b x + log_b y, the quotient rule is log_b(x/y) = log_b x − log_b y, and the power rule is log_b(xⁿ) = n · log_b x. Only products, quotients and powers inside the log simplify: log(x + y) is not log x + log y, and (log x)² is not 2 log x.
Who invented logarithms?
John Napier published the first logarithm tables in 1614, and Henry Briggs produced base-10 tables soon after. They were invented because of the product rule: adding two numbers from a table is far easier than multiplying two eight-digit numbers by hand. The slide rule, used by engineers until the 1970s, is that rule made physical.
How many bits does it take to store a number?
A number up to N needs floor(log₂ N) + 1 bits. log₂ 1000 is 9.97, so 1000 needs 10 bits. The same base-2 logarithm explains binary search: finding one item among a million takes at most ceil(log₂ 1,000,000) = 20 comparisons, because each step halves the remaining range.
What are examples of logarithmic scales?
Common logarithmic scales include pH, where each unit is a tenfold change in hydrogen-ion activity; decibels, where +10 dB is ten times the power; earthquake magnitude, where each step is ten times the amplitude and about 32 times the energy; bits, where each one doubles the number of values; and musical octaves, which double the frequency.
How do you find the base of a logarithm?
Rewrite the logarithm as a power and take a root. For log_b 81 = 4, rewrite it as b⁴ = 81, so b = 81^(1/4) = 3. The base must be positive and not 1, so although (−3)⁴ is also 81, −3 is not a valid base. Similarly, log_b 2 = 0.5 gives b = 4.
Sources and further reading
- DLMF §4.2: Definitions of the logarithm, exponential and powers, NIST Digital Library of Mathematical Functions. Logarithms and change of base.
- John Napier (1550 - 1617): Biography, MacTutor History of Mathematics, University of St Andrews. Napier's 1614 tables and the invention of logarithms.
- Measurement of pH. Definition, standards, and procedures (IUPAC Recommendations 2002), Pure and Applied Chemistry. pH as the negative log of hydrogen-ion activity.
- Earthquake Magnitude, Energy Release, and Shaking Intensity, US Geological Survey. Why each magnitude step is a tenfold change in amplitude.
- John Napier, Mirifici Logarithmorum Canonis Descriptio (1614); Henry Briggs, Arithmetica Logarithmica (1624).
- IUPAC, Compendium of Chemical Terminology (Gold Book), entry on pH.
- USGS Earthquake Hazards Program, magnitude and energy: each whole-number step is about 32 times more energy.
More Math Calculators
Every tool in the Math Calculators section, free and in your browser.
- Percentage Calculator
- Fraction Calculator
- Ratio Calculator
- GCF and LCM Calculator
- Prime Factorization Calculator
- Quadratic Equation Solver
- Long Division Calculator
- Scientific Notation Calculator
- Number to Words Converter
- Roman Numeral Converter
- Percent Error Calculator
- Root Calculator
- Exponent Calculator
- Logarithm Calculator
- Rounding Calculator
- Weighted Average Calculator
- System of Equations Solver