CalcMountain

Logarithm Calculator

Compute logarithms with different bases. Find the natural logarithm (ln), common logarithm (log base 10), or specify any custom base. Essential for scientific, engineering, and mathematical calculations.

Logarithms are the inverse of exponentials. If b^x = y, then log_b(y) = x. They answer the question: "To what power must I raise the base to get this number?" If 10² = 100, then log₁₀(100) = 2. If 2³ = 8, then log₂(8) = 3. This simple inverse relationship makes logarithms incredibly useful for any quantity that spans many orders of magnitude.

Three logarithms appear most frequently: - **Common logarithm (log)**: base 10. Used in engineering and scientific notation. - **Natural logarithm (ln)**: base e ≈ 2.71828. Used in calculus and physics. - **Binary logarithm (log₂)**: base 2. Used in computer science.

Logarithms tame exponential growth into manageable numbers. The Richter earthquake scale uses log₁₀ — a magnitude 7 earthquake releases 10× more energy than magnitude 6, 100× more than magnitude 5. Sound pressure (decibels) uses log₁₀ × 20. The pH scale is log₁₀ of hydrogen ion concentration. Information measured in bits is log₂.

Key properties make logarithms powerful for arithmetic and analysis: - log(a × b) = log(a) + log(b) — multiplication becomes addition. - log(a/b) = log(a) − log(b) — division becomes subtraction. - log(a^n) = n × log(a) — exponents become multiplication.

Before electronic calculators, slide rules used logarithms to perform multiplication and division mechanically. Astronomers and scientists relied on log tables for centuries to perform calculations that would otherwise have taken years.

Common applications: scientific notation, pH chemistry, sound (decibels), earthquakes (Richter), information theory (bits), finance (continuous compounding), and any analysis with wide-range values.

Inputs

Only used when Custom Base is selected

Results

Result

2

Log Base 10

2

Natural Log (ln)

4.605170186

Log Base 2

6.6438561898

Last updated:

Formula

**Logarithm definition:** log_b(y) = x means b^x = y Where: - b = base (must be positive, ≠ 1) - y = number (must be positive) - x = exponent (any real) **Three common logarithms:** - **Common (log)**: base 10. log(100) = 2. - **Natural (ln)**: base e ≈ 2.71828. ln(e) = 1. - **Binary (log₂)**: base 2. log₂(8) = 3. **Properties:** | Property | Formula | |---|---| | Product | log(a × b) = log(a) + log(b) | | Quotient | log(a/b) = log(a) − log(b) | | Power | log(a^n) = n × log(a) | | Change of base | log_a(x) = log_b(x)/log_b(a) | | Log of 1 | log(1) = 0 | | Log of base | log_b(b) = 1 | | Log of reciprocal | log(1/a) = −log(a) | **Worked examples:** log₁₀(1000) = 3 (because 10³ = 1000) log₁₀(10) = 1 log₁₀(1) = 0 log₁₀(0.01) = -2 log₂(8) = 3 (2³ = 8) log₂(1024) = 10 (2¹⁰ = 1024) log₂(1) = 0 ln(e) = 1 (e¹ = e) ln(e²) = 2 ln(1) = 0 ln(2) ≈ 0.693 **Common log values:** | Number | log₁₀ | |---|---| | 0.001 | -3 | | 0.01 | -2 | | 0.1 | -1 | | 1 | 0 | | 2 | 0.301 | | 3 | 0.477 | | 5 | 0.699 | | 7 | 0.845 | | 10 | 1 | | 50 | 1.699 | | 100 | 2 | | 1000 | 3 | | 10,000 | 4 | | 10⁶ | 6 | | 10⁹ | 9 | **Natural log values:** | Number | ln | |---|---| | 1 | 0 | | 2 | 0.693 | | e ≈ 2.718 | 1 | | 10 | 2.303 | | e² ≈ 7.389 | 2 | | 100 | 4.605 | | 1000 | 6.908 | | 10⁶ | 13.816 | **Change of base formula:** log_a(x) = ln(x) / ln(a) = log(x) / log(a) Allows any base logarithm using natural or common log: log₃(81) = ln(81) / ln(3) = 4.394 / 1.099 = 4 **Worked example: scientific notation** How many digits in 7^100? log₁₀(7^100) = 100 × log₁₀(7) = 100 × 0.845 = 84.5 So 7^100 has 85 digits (floor + 1). **Worked example: doubling time:** Continuous growth at rate k: doubling time = ln(2)/k. For 5% growth: ln(2)/0.05 = 0.693/0.05 ≈ 13.86 years. **Earthquake magnitude (Richter):** Magnitude M = log₁₀(amplitude/A₀) Each +1 in magnitude: 10× more amplitude, ~32× more energy. M7 vs M6: 10× shaking, 32× energy released. **Sound pressure (decibels):** dB = 20 × log₁₀(p/p₀) For sound, factor 20 (not 10) because power ∝ pressure²: - Sound twice as loud: +6 dB. - Sound 10× as loud: +20 dB. - Threshold of hearing: 0 dB. - Normal conversation: ~60 dB. - Pain threshold: ~130 dB. **pH scale:** pH = -log₁₀([H⁺]) For [H⁺] = 10⁻⁷ M: pH = 7 (neutral). Each pH decrease of 1 = 10× more acidic. pH 4 (vinegar) vs pH 7 (water): 1000× more H⁺ ions. **Stellar magnitude:** m = -2.5 × log₁₀(I/I₀) Brighter star = smaller magnitude. Each step of 5 magnitudes = 100× brightness ratio. Vega defined as magnitude 0; sun is -26.7; full moon -12.7; Sirius -1.46. **Information (bits):** Information content = log₂(N) bits, where N = number of equally likely outcomes. Coin flip: log₂(2) = 1 bit. Dice: log₂(6) ≈ 2.58 bits. Card from deck: log₂(52) ≈ 5.7 bits. Shannon entropy generalizes this. **Computer science:** - **Binary search**: O(log n) comparisons. - **Merge sort**: O(n log n) operations. - **Tree height** (balanced): log₂(N). - **Memory**: bits = log₂(addresses). **Logarithm in calculus:** ln(x) integrates as 1/x: ∫(1/x) dx = ln|x| + C. Derivative of ln(x) is 1/x. Derivative of e^x is e^x. These elegant relationships make natural log essential in calculus. **Logarithm history:** John Napier introduced logarithms in 1614. Henry Briggs simplified to base 10. Log tables transformed astronomy and engineering calculations for centuries. Slide rules (1622-1970s) used logarithm-marked scales for mechanical multiplication. **Decibel calculations:** For power ratio P₂/P₁: dB = 10 × log₁₀(P₂/P₁) For voltage ratio V₂/V₁: dB = 20 × log₁₀(V₂/V₁) (Factor of 20 because power = V²/R; V² gives factor of 2 in log.) **Common confusions:** - "log" alone: base 10 in elementary math, base e in much of higher math and computer science. - "ln": always natural log, base e. - "lg": sometimes binary log (base 2), context-dependent. Always specify base when ambiguous. **Programming:** | Language | Common | Natural | Custom | |---|---|---|---| | Python | math.log10(x) | math.log(x) | math.log(x, base) | | JavaScript | Math.log10(x) | Math.log(x) | Math.log(x)/Math.log(base) | | Java | Math.log10(x) | Math.log(x) | manual | | Excel | =LOG10(x) | =LN(x) | =LOG(x, base) | | R | log10(x) | log(x) | log(x, base) | | MATLAB | log10(x) | log(x) | log2(x) for binary | Note: in many programming languages (Python, R, MATLAB), log() means natural log; log10() for common log. **Software:** - **Calculators**: log button for base 10, ln for natural. - **Spreadsheets**: dedicated functions. - **Programming**: math libraries. - **Wolfram Alpha**: any base. **Logarithmic scale (plotting):** Used to visualize data spanning many orders of magnitude: - **log scale**: equal distances on axis = equal ratios. - **semi-log plot**: one axis log, other linear. Exponential growth = straight line. - **log-log plot**: both axes log. Power laws = straight line. Example: earthquake magnitudes plotted on log scale fit a power law (Gutenberg-Richter). **Common applications:** - **Chemistry**: pH, pKa, equilibrium constants. - **Acoustics**: decibels. - **Seismology**: Richter scale. - **Astronomy**: stellar magnitudes. - **Information**: bits, entropy. - **Computer science**: algorithm analysis. - **Finance**: continuous compounding. - **Population growth**: logistic models. - **Sensory perception**: many sensory scales logarithmic (Weber-Fechner law). **Pitfalls:** - **Log of 0 or negative**: undefined (real numbers). - **Base 1**: log_1(x) undefined (1 to any power is 1). - **Implicit base**: "log" means base 10 in basic math, often base e elsewhere. - **Order of operations**: log(x+1) ≠ log(x) + log(1). - **Sign**: log of < 1 is negative. - **Domain restrictions**: log only defined for positive arguments.

How to use this calculator

  1. Enter a positive number.
  2. Choose base: log (base 10), ln (base e), or custom.
  3. For custom base: enter the base (must be positive, not 1).
  4. Calculator returns the logarithm value.
  5. Verify: base^result should equal input number.
  6. For ratios: log of ratio = difference of logs.

Worked examples

Earthquake comparison

**Scenario:** Compare magnitude 7.0 vs magnitude 5.0 earthquakes. Energy ratio? **Calculation:** Difference: 7 - 5 = 2 on Richter scale. Energy ratio: 32² ≈ 1000× (each magnitude step is ~32× more energy). Amplitude ratio: 10² = 100×. **Result:** Magnitude 7 releases ~1000× more energy than magnitude 5 — and ~100× more shaking amplitude. Common misconception: M7 vs M5 is "twice as bad"; actually it's ~1000× more energy. Logarithmic scale compresses huge differences into small number increments.

Binary search complexity

**Scenario:** Binary search on sorted list of 1 million items. How many comparisons needed? **Calculation:** log₂(1,000,000) ≈ 20. **Result:** ~20 comparisons. Each step halves search space. For 1 billion items: log₂(10⁹) ≈ 30 comparisons. Why binary search is so efficient: O(log n) growth means even huge data sets are quickly searched.

pH calculation

**Scenario:** Solution has [H⁺] = 5 × 10⁻⁹ M. Calculate pH. **Calculation:** pH = -log₁₀(5 × 10⁻⁹) = -log₁₀(5) - log₁₀(10⁻⁹) = -0.699 - (-9) = 8.30. **Result:** pH ≈ 8.3 (slightly basic). For reference: pH 7 = neutral; pH < 7 acidic; pH > 7 basic. Pure water: pH 7. Stomach acid: pH ~1.5. Blood: pH ~7.4. Bleach: pH ~12.

When to use this calculator

**Use logarithms for:**

- **Wide-range data**: scientific notation, magnitudes. - **Multiplication into addition**: easier mental math for products. - **Exponential analysis**: doubling times, decay rates. - **Sound (decibels)**: sound pressure measurements. - **pH (chemistry)**: hydrogen ion concentration. - **Information theory**: bits, entropy. - **Computer science**: algorithm analysis (O(log n)). - **Astronomy**: stellar magnitudes.

**Choosing base:**

- **Base 10 (log)**: scientific notation, engineering. - **Base e (ln)**: calculus, physics, continuous growth. - **Base 2 (log₂)**: computer science, information theory. - **Custom**: specific applications.

Use whichever makes the formula simplest in context.

**Common log values to memorize:**

log₁₀: - log 1 = 0 - log 10 = 1 - log 100 = 2 - log 1000 = 3 - log 2 ≈ 0.301 - log 3 ≈ 0.477 - log 5 ≈ 0.699 - log 7 ≈ 0.845

These let you quickly estimate logs without calculator.

**Computing arbitrary base logarithm:**

log_a(x) = log(x) / log(a) = ln(x) / ln(a)

Change of base formula uses common or natural log.

**Real-world log scales:**

- **Richter (earthquakes)**: each unit = 10× amplitude. - **Decibel (sound)**: each 10 dB = 10× power. - **pH (acidity)**: each unit = 10× [H⁺]. - **Stellar magnitude**: each 5 = 100× brightness. - **Octave (music)**: doubling of frequency. - **F-stop (photography)**: each stop = 2× light.

**Inverse: exponentials:**

If log_b(x) = y, then x = b^y.

Logarithms and exponents are inverse functions. Together: x = b^(log_b(x)) and y = log_b(b^y).

**Common applications:**

- **Engineering**: signal processing, control systems, dB calculations. - **Chemistry**: equilibrium, kinetics, pH. - **Biology**: population growth, enzyme kinetics. - **Economics**: continuous compounding. - **Statistics**: log-normal distribution. - **Computer science**: algorithmic analysis, data structures. - **Astronomy**: magnitudes, photometry. - **Acoustics**: sound levels.

**Software:**

- **Calculators**: log button (base 10), ln button (natural). - **Spreadsheets**: LOG10, LN, LOG functions. - **Python**: math.log, math.log10, math.log2. - **JavaScript**: Math.log, Math.log10, Math.log2. - **R/MATLAB**: log() is natural; log10() is common.

**Why logarithms changed math:**

Before computers, multiplying large numbers was tedious. With log tables: 1. Look up logs of both numbers. 2. Add them. 3. Look up antilogarithm.

This converted hours of arithmetic into seconds. Slide rules embodied this principle physically. Used for centuries by astronomers, engineers, navigators.

**Computational complexity:**

| Algorithm | Complexity | |---|---| | Linear search | O(n) | | Binary search | O(log n) | | Sort (best) | O(n log n) | | Tree operations | O(log n) |

Logarithmic is just slightly worse than constant — extremely fast for large inputs.

**Pitfalls:**

- **Log of zero or negative**: undefined in real numbers. - **Implicit base**: "log" can mean 10 (basic math) or e (advanced math). - **Order of operations**: log(a) + log(b) = log(ab), not log(a+b). - **Base 1**: undefined (1^x = 1, can't reach other numbers). - **Floating-point precision**: very small numbers have precision issues. - **Domain**: input must be positive.

Common mistakes to avoid

  • Confusing log of sum with sum of logs (log(a+b) ≠ log(a) + log(b)).
  • Taking log of zero or negative (undefined in real numbers).
  • Confusing common log (base 10) with natural log (base e).
  • Implicit base assumption (depends on context).
  • Forgetting properties: log(a*b) = log(a) + log(b), log(a/b) = log(a) - log(b).
  • Wrong base in change of base formula.
  • For decibels: factor 20 (voltage) vs 10 (power).
  • For programming: log() function meaning varies by language.

Frequently Asked Questions

Sources & further reading

SponsoredShop Top Deals on AmazonSupport CalcMountain — browse top-rated products at no extra cost to you.

Related Calculators