A logarithm answers the question “what exponent do I need?”: logb(x) = y means by = x. So log₂(8) = 3 because 2³ = 8. The core logarithm rules are the product rule (log xy = log x + log y), the quotient rule (log x/y = log x − log y), the power rule (log xⁿ = n log x) and the change-of-base rule (logb x = ln x ÷ ln b). Each one is an exponent rule written in reverse.
The definition and the basic identities
Three examples make the definition concrete: log₁₀(1,000) = 3, log₂(32) = 5 and ln(e⁴) = 4. The common log (log, base 10) and the natural log (ln, base e ≈ 2.71828) are the two bases on every scientific calculator.
| Identity | Why it is true | Example |
|---|---|---|
| logb(1) = 0 | b⁰ = 1 | log 1 = 0 |
| logb(b) = 1 | b¹ = b | ln e = 1 |
| logb(bˣ) = x | Log undoes the exponential | log₂(2⁷) = 7 |
| blogb(x) = x | Exponential undoes the log | 10log 5 = 5 |
| logb(1/x) = −logb(x) | b⁻ʸ = 1/bʸ | log(0.01) = −2 |
The three main rules
Product rule
Multiplying numbers adds their exponents (bm × bn = bm+n), so the log of a product is the sum of the logs. Example: log 2 + log 50 = log 100 = 2.
Quotient rule
Dividing subtracts exponents, so the log of a quotient is a difference. Example: log₂(48) − log₂(3) = log₂(16) = 4.
Power rule
An exponent inside a log becomes a multiplier in front. This is the rule that lets you solve for an unknown exponent. Example: log(10⁶) = 6 log 10 = 6. Roots are fractional powers, so log √x = ½ log x.
Change of base
Calculators only have log and ln buttons. To evaluate a log in any other base, convert:
log₃(50) = ln 50 ÷ ln 3 = 3.9120 ÷ 1.0986 ≈ 3.5609
Check: 33.5609 ≈ 50.0 ✓
Either log or ln works, as long as you use the same one on top and bottom. The logarithm calculator evaluates any base directly.
Expanding and condensing logarithms
Expanding splits one log into several simpler ones:
log(100x³ ÷ y) = log 100 + log x³ − log y = 2 + 3 log x − log y
Condensing runs the rules backward, power rule first:
2 ln 3 + ln 4 − ln 6 = ln 9 + ln 4 − ln 6 = ln(9 × 4 ÷ 6) = ln 6
Solving exponential equations
When the unknown is in an exponent, take the log of both sides and use the power rule to bring it down.
5ˣ = 200
ln(5ˣ) = ln 200 → x ln 5 = ln 200
x = ln 200 ÷ ln 5 ≈ 5.2983 ÷ 1.6094 ≈ 3.292
A growth example: how long does money take to double at 6% per year, compounded annually? Solve 1.06ᵗ = 2: t = ln 2 ÷ ln 1.06 ≈ 11.9 years. The familiar rule of 72 (72 ÷ 6 = 12) is a mental shortcut for this exact calculation. The solve for exponent calculator handles any equation of the form aˣ = b.
Solving logarithmic equations
Condense to a single log, rewrite in exponential form, solve, then check every answer, because the log of a zero or negative number is undefined.
log₂(x) + log₂(x − 2) = 3
Condense: log₂(x(x − 2)) = 3 → x(x − 2) = 2³ = 8
x² − 2x − 8 = 0 → (x − 4)(x + 2) = 0 → x = 4 or x = −2
x = −2 makes log₂(x) undefined, so the only solution is x = 4
Extraneous solutions like x = −2 appear often, so the checking step is not optional. The logarithm equation calculator flags them automatically.
Common mistakes
| Wrong | Right |
|---|---|
| log(a + b) = log a + log b | log a + log b = log(ab); log(a + b) has no simple rule |
| log a ÷ log b = log(a − b) | log a − log b = log(a ÷ b) |
| (log x)² = 2 log x | log(x²) = 2 log x; (log x)² is different |
| log(−4) = −log 4 | log(−4) is undefined in the reals |
Logarithms in spreadsheets and code
Spreadsheets save you the change-of-base step. In Excel and Google Sheets, =LOG(50,3) returns log₃(50) ≈ 3.5609, =LOG10(1000) returns 3 and =LN(EXP(4)) returns 4. Leaving out the base, as in =LOG(100), defaults to base 10.
Programming languages differ, which trips up many people. In Python, JavaScript and C, the function named log is the natural logarithm, so Math.log(100) in JavaScript returns 4.605, not 2. Use log10 for base 10, log2 for base 2, or divide two logs for any other base.
A useful mental anchor: log 2 ≈ 0.301, log 3 ≈ 0.477 and log 5 ≈ 0.699. With the product and power rules, those three values give you the common log of many numbers without a calculator. For example, log 6 = log 2 + log 3 ≈ 0.778, and log 8 = 3 log 2 ≈ 0.903.
Where logarithms show up
Logarithmic scales compress huge ranges into manageable numbers, so each step of 1 means a tenfold change.
- pH is −log₁₀ of the hydrogen ion concentration. Lemon juice at pH 2 is about 100,000 times more acidic than pure water at pH 7. See how to calculate pH or the pH calculator.
- Decibels measure sound intensity as 10 log₁₀(I/I₀). Doubling the intensity adds 10 log 2 ≈ 3 dB. The decibel calculator does the conversions.
- Earthquake magnitude is logarithmic too: each whole step is ten times the measured amplitude and roughly 101.5 ≈ 32 times the energy released.
Because logarithms are the inverse of exponentials, every rule above pairs with one of the exponent rules. If one set feels unfamiliar, the other usually explains it.
Frequently asked questions
What are the three main logarithm rules?
The product rule, log(xy) = log x + log y; the quotient rule, log(x/y) = log x − log y; and the power rule, log(xⁿ) = n log x. They hold for any valid base, as long as x and y are positive.
How do you change the base of a logarithm?
Divide the log of the number by the log of the new base, using any base your calculator has: log_b(x) = ln x ÷ ln b = log x ÷ log b. For example, log₃(50) = ln 50 ÷ ln 3 ≈ 3.5609.
What is the difference between log and ln?
Both are logarithms with different bases. 'log' usually means base 10 (the common logarithm) and 'ln' means base e ≈ 2.71828 (the natural logarithm). In some advanced math and programming languages, 'log' means the natural log, so check the convention.
Can you take the log of a negative number or zero?
Not in the real numbers. A positive base raised to any real power is always positive, so no exponent produces zero or a negative result. log(0) and log(−5) are undefined, which is why answers to log equations must be checked.
Is log(a + b) equal to log a + log b?
No. The product rule says log a + log b = log(ab), not log(a + b). There is no simple rule for the log of a sum. For example, log 2 + log 8 = log 16, but log(2 + 8) = log 10 = 1.