ES EN FR PT DE IT

Logarithm Calculator

Logarithm Calculator. Free online calculator with formula, examples and step-by-step guide.

The Logarithm Calculator is a free online math calculator. Logarithm Calculator. Free online calculator with formula, examples and step-by-step guide. Get instant results with the detailed formula and step-by-step examples.
Inputs
Result
Enter values and press Calculate

What is a Logarithm Calculator?

A logarithm calculator finds the exponent needed to produce a given number. The question "What is log₂(1024)?" asks: "2 raised to what power equals 1024?" Answer: log₂(1024) = 10 because 2¹⁰ = 1024. Logarithms are the inverse operation of exponents — if exponents ask "What is 2¹⁰?", logarithms ask "2 to what power gives 1024?"

Logarithms compress enormous ranges into manageable scales. The Richter scale: magnitude 6 earthquake is 10× stronger than magnitude 5. Decibels: 120 dB (rock concert) is 1 billion times more intense than 0 dB (hearing threshold). pH: stomach acid (pH 1.5) is 100,000× more acidic than pure water (pH 7). Without logarithms, we'd write "1,000,000,000 times" instead of "9 orders of magnitude."

This calculator computes logarithms in any base: base 10 (common log, used in science and engineering), base 2 (binary log, used in computer science), base e (natural log, used in calculus and finance), or custom bases. Enter any positive number and base, get the exponent instantly.

Formulas Explained with Actual Calculations

Basic Logarithm Definition: log_b(x) = y means b^y = x. The base b raised to power y equals x. Example: log₃(81) = 4 because 3⁴ = 81. Example: log₅(625) = 4 because 5⁴ = 625. Example: log₁₀(1000) = 3 because 10³ = 1000. The logarithm IS the exponent — this is the fundamental insight. When you calculate log₂(32) = 5, you're saying "the exponent 5 makes 2⁵ = 32."

Common Logarithm (Base 10): log₁₀(x) or simply log(x). Used in science, engineering, and calculators. log(100) = 2 because 10² = 100. log(1000) = 3. log(0.01) = -2 because 10⁻² = 0.01. log(50) = 1.699 because 10¹.⁶⁹⁹ = 50. Scientific notation uses common logs: log(4.5 × 10⁸) = log(4.5) + log(10⁸) = 0.653 + 8 = 8.653. The integer part (8) is the "characteristic" (order of magnitude), the decimal part (0.653) is the "mantissa" (significant digits).

Natural Logarithm (Base e): ln(x) = log_e(x), where e ≈ 2.71828. The number e appears in continuous growth: compound interest, population growth, radioactive decay. ln(7.389) = 2 because e² = 7.389. ln(1) = 0 because e⁰ = 1. ln(0.5) = -0.693 because e⁻⁰.⁶⁹³ = 0.5. In finance: if money grows continuously at rate r, time to double is ln(2)/r = 0.693/r. At 5% continuous growth: 0.693/0.05 = 13.86 years to double.

Binary Logarithm (Base 2): log₂(x) or lb(x). Essential in computer science. log₂(1024) = 10 because 2¹⁰ = 1024. log₂(1,000,000) = 19.93 ≈ 20 — a million is about 2²⁰. log₂(1,000,000,000) = 29.89 ≈ 30 — a billion is about 2³⁰. This explains why computers use 32-bit and 64-bit addressing. Algorithm complexity: binary search is O(log₂ n) — searching 1 million items takes at most 20 comparisons. Information theory: 1 bit distinguishes 2 options, 8 bits (1 byte) distinguishes 2⁸ = 256 options.

Change of Base Formula: log_b(x) = log_a(x) / log_a(b). Convert any logarithm to your calculator's available bases (usually 10 or e). Example: log₇(343) = log(343) / log(7) = 2.5353 / 0.8451 = 3. Verify: 7³ = 343 ✓. Example: log₁.₀₅(2) = ln(2) / ln(1.05) = 0.6931 / 0.04879 = 14.21. This means at 5% annual growth, it takes 14.21 years to double. Example: log₃(50) = ln(50) / ln(3) = 3.912 / 1.099 = 3.56. Verify: 3³.⁵⁶ = 50.0 ✓.

Logarithm Rules: (1) Product rule: log(xy) = log(x) + log(y). Example: log(6) = log(2 × 3) = log(2) + log(3) = 0.301 + 0.477 = 0.778. (2) Quotient rule: log(x/y) = log(x) - log(y). Example: log(4) = log(8/2) = log(8) - log(2) = 0.903 - 0.301 = 0.602. (3) Power rule: log(xⁿ) = n × log(x). Example: log(8) = log(2³) = 3 × log(2) = 3 × 0.301 = 0.903. These rules made slide rules possible and still simplify complex calculations.

6 Step-by-Step Instructions

  1. Identify what you're solving for: Three scenarios: (a) Find the logarithm: "What is log₅(125)?" You know base (5) and result (125), need exponent. (b) Find the result: "If log₃(x) = 4, what is x?" You know base (3) and exponent (4), need result. (c) Find the base: "If log_b(64) = 6, what is b?" You know result (64) and exponent (6), need base. Each requires different algebra. This calculator handles scenario (a) directly; (b) and (c) use exponentiation.
  2. Choose the appropriate base: Base 10 (common log): general science, engineering, decibels, pH, Richter scale. Base e (natural log): calculus, continuous growth, finance, physics equations. Base 2 (binary log): computer science, information theory, algorithm analysis. Custom base: specific applications like log₁.₀₅ for 5% growth rates. Example: calculating compound annual growth rate uses natural log. Example: analyzing binary search complexity uses base 2.
  3. Enter the number (argument) and base: For log₈(512): number = 512, base = 8. Result: 3 because 8³ = 512. For ln(50): number = 50, base = e (2.71828...). Result: 3.912. For log(0.001): number = 0.001, base = 10. Result: -3 because 10⁻³ = 0.001. IMPORTANT: logarithms of zero or negative numbers are UNDEFINED in real arithmetic. You cannot take log(-5) or log(0). The domain is x > 0.
  4. Calculate using the calculator or change-of-base: Modern calculators have log (base 10) and ln (base e) buttons. For other bases, use change-of-base: log₇(100) = log(100) / log(7) = 2 / 0.845 = 2.367. Verify: 7².³⁶⁷ = 100.0 ✓. For natural log: ln(20) = 2.996. Verify: e².⁹⁹⁶ = 20.0. For binary log: log₂(256) = 8. Many programming languages have log2() function. If not: log₂(256) = ln(256) / ln(2) = 5.545 / 0.693 = 8.
  5. Interpret the result: The logarithm IS the exponent. log₁₀(500) = 2.699 means 10².⁶⁹⁹ = 500. The integer part (2) tells you the order of magnitude (hundreds). The decimal part (0.699) refines within that range. log₁₀(500,000) = 5.699 — same decimal part (same significant digits "5"), different magnitude (10⁵ vs 10²). In growth contexts: if population grows from 1,000 to 8,000, log₂(8000/1000) = log₂(8) = 3 doublings occurred. In finance: ln(final/initial) = continuous return. ln(12000/10000) = ln(1.2) = 0.182 = 18.2% continuous return.
  6. Verify by exponentiating: If log₄(256) = 4, then 4⁴ should equal 256. Calculate: 4⁴ = 256 ✓. If ln(x) = 2.5, then x = e².⁵ = 12.18. If log(x) = -2, then x = 10⁻² = 0.01. This verification catches input errors. If your calculator says log₃(100) = 4.5, verify: 3⁴.⁵ = 140.3 ≠ 100. Error! Recalculate: log₃(100) = ln(100)/ln(3) = 4.605/1.099 = 4.192. Verify: 3⁴.¹⁹² = 100.0 ✓. Always verify critical calculations by reversing the operation.

5 Real-World Examples with Specific Numbers

Example 1 — Earthquake Magnitude (Richter Scale): The Richter scale is logarithmic: M = log₁₀(A/A₀), where A is earthquake amplitude and A₀ is a reference amplitude. A magnitude 5.0 earthquake has amplitude 10⁵ = 100,000 times the reference. A magnitude 7.0 has amplitude 10⁷ = 10,000,000 times reference. The difference: 10⁷ / 10⁵ = 10² = 100×. A magnitude 7.0 quake is 100× stronger than magnitude 5.0. Energy release scales as 10^(1.5M): M5.0 releases 10^7.5 = 31.6 million joules. M7.0 releases 10^10.5 = 31.6 billion joules — 1,000× more energy. The 2011 Japan earthquake (M9.0) released 10^13.5 = 31.6 trillion joules — equivalent to 7,500 Hiroshima bombs. Each whole-number increase represents 31.6× more energy release. This logarithmic scaling lets us discuss enormous ranges (million-fold energy differences) with small numbers (magnitude 5 to 9).

Example 2 — Sound Intensity and Decibels: Decibel formula: dB = 10 × log₁₀(I/I₀), where I₀ = 10⁻¹² W/m² (threshold of hearing). Whisper: I = 10⁻¹⁰ W/m². dB = 10 × log₁₀(10⁻¹⁰/10⁻¹²) = 10 × log₁₀(100) = 10 × 2 = 20 dB. Normal conversation: I = 10⁻⁶ W/m². dB = 10 × log₁₀(10⁶) = 10 × 6 = 60 dB. Rock concert: I = 10⁻¹ W/m². dB = 10 × log₁₀(10¹¹) = 10 × 11 = 110 dB. Jet engine at 30 m: I = 10 W/m². dB = 10 × log₁₀(10¹³) = 130 dB (pain threshold). Each 10 dB increase = 10× intensity. 60 dB to 80 dB is 100× more intense. 60 dB to 100 dB is 10,000× more intense. Hearing damage occurs above 85 dB for prolonged exposure. At 110 dB (rock concert), damage occurs in minutes. Logarithmic scaling compresses the trillion-fold range of human hearing (10⁻¹² to 10 W/m²) into 0-130 dB.

Example 3 — Compound Annual Growth Rate (CAGR): A startup's revenue grew from €850,000 to €2,400,000 over 6 years. CAGR = (Ending/Beginning)^(1/n) - 1. Using logarithms: CAGR = e^(ln(Ending/Beginning)/n) - 1. ln(2,400,000/850,000) = ln(2.8235) = 1.038. Divide by 6: 1.038/6 = 0.173. e^0.173 = 1.189. CAGR = 1.189 - 1 = 0.189 = 18.9% annually. Verify: €850,000 × 1.189⁶ = €850,000 × 2.823 = €2,400,000 ✓. Compare to competitor: €1,200,000 to €2,100,000 over 6 years. ln(2.1/1.2) = ln(1.75) = 0.560. 0.560/6 = 0.0933. e^0.0933 = 1.098. CAGR = 9.8%. Your startup grew nearly twice as fast (18.9% vs 9.8%). For investment portfolio: €50,000 to €185,000 over 12 years. ln(185/50) = ln(3.7) = 1.308. 1.308/12 = 0.109. e^0.109 = 1.115 = 11.5% CAGR — excellent long-term return.

Example 4 — pH and Acidity in Chemistry: pH = -log₁₀[H⁺], where [H⁺] is hydrogen ion concentration in mol/L. Pure water: [H⁺] = 10⁻⁷ mol/L. pH = -log₁₀(10⁻⁷) = 7 (neutral). Stomach acid: [H⁺] = 0.01 mol/L = 10⁻² mol/L. pH = -log₁₀(10⁻²) = 2 (very acidic). Blood: [H⁺] = 4 × 10⁻⁸ mol/L. pH = -log₁₀(4 × 10⁻⁸) = -(log₁₀(4) + log₁₀(10⁻⁸)) = -(0.602 - 8) = 7.398 ≈ 7.4 (slightly alkaline). Acid rain: pH 4.0 means [H⁺] = 10⁻⁴ = 0.0001 mol/L — 100× more acidic than rain (pH 5.6) and 10,000× more acidic than pure water. Swimming pool: maintain pH 7.2-7.6. If pH drops to 6.8: [H⁺] = 10⁻⁶.⁸ = 1.58 × 10⁻⁷ mol/L. Add base (sodium carbonate) to raise pH. Each pH unit represents 10× concentration change — small pH shifts mean large chemical changes.

Example 5 — Binary Search and Algorithm Efficiency: Binary search finds an item in a sorted list by repeatedly halving the search space. Maximum comparisons = log₂(n), where n is list size. Phone book with 1,000,000 names: log₂(1,000,000) = ln(1,000,000)/ln(2) = 13.82/0.693 = 19.93 ≈ 20 comparisons maximum. Linear search would average 500,000 comparisons — binary search is 25,000× faster! Database with 10 billion records: log₂(10¹⁰) = 10 × log₂(10) = 10 × 3.322 = 33.2 ≈ 34 comparisons. Even with Earth's population (8 billion), binary search finds any person in 33 steps. This is why databases use B-trees (logarithmic indexing). Sorting algorithms: merge sort is O(n log n). Sorting 1 million items: 1,000,000 × 20 = 20 million operations. Bubble sort O(n²) would need 1 trillion operations — 50,000× slower. Logarithmic complexity enables modern computing at scale.

4 Common Mistakes

Mistake 1: Confusing log(x + y) with log(x) + log(y)
log(x + y) ≠ log(x) + log(y). This is a fundamental error. Example: log(3 + 4) = log(7) = 0.845. But log(3) + log(4) = 0.477 + 0.602 = 1.079. These differ significantly! The correct rule is log(xy) = log(x) + log(y) — logarithms convert MULTIPLICATION to addition, not addition to addition. Example: log(3 × 4) = log(12) = 1.079 = log(3) + log(4) ✓. Similarly, log(x - y) ≠ log(x) - log(y). Correct: log(x/y) = log(x) - log(y). Test yourself: log(5 + 5) = log(10) = 1. log(5) + log(5) = 0.699 + 0.699 = 1.398. Different! log(5 × 5) = log(25) = 1.398 = log(5) + log(5) ✓.

Mistake 2: Forgetting That Logarithms Require Positive Arguments
log(-5) is UNDEFINED in real numbers. No real exponent makes 10^y = -5 (or e^y = -5, or 2^y = -5). Exponential functions b^y are always positive for real y. Similarly, log(0) is undefined — no finite exponent gives zero (though lim(x→0⁺) log(x) = -∞). Domain of log(x) is x > 0. In equations: solve log(x - 3) = 2. This means x - 3 = 10² = 100, so x = 103. Verify: log(103 - 3) = log(100) = 2 ✓. But solve log(x - 5) = log(2x - 15). This gives x - 5 = 2x - 15, so x = 10. Verify: log(10 - 5) = log(5), log(20 - 15) = log(5) ✓. If solving gave x = 3, you'd get log(-2) = log(-9) — invalid, reject that solution.

Mistake 3: Misapplying the Power Rule
log(xⁿ) = n × log(x), not [log(x)]ⁿ. Example: log(2³) = log(8) = 0.903. Using power rule: 3 × log(2) = 3 × 0.301 = 0.903 ✓. But [log(2)]³ = (0.301)³ = 0.0273 — completely different! The exponent comes OUT FRONT as a multiplier. Common error in calculus: d/dx[log(x²)] = d/dx[2 × log(x)] = 2/x. Not d/dx[log(x)]² = 2 × log(x) × 1/x. Another trap: log(√x) = log(x¹⸍²) = ½ × log(x), not √[log(x)]. Example: log(√100) = log(10) = 1. Using rule: ½ × log(100) = ½ × 2 = 1 ✓. But √[log(100)] = √2 = 1.414 — wrong. Keep the power rule clear: the exponent on the argument becomes a coefficient in front.

Mistake 4: Assuming log_b(x + y) = log_b(x) + log_b(y) in Growth Contexts
In finance and population growth, people mistakenly add logarithms of separate growth factors. Example: Investment grows 20% year 1, then 30% year 2. Total growth factor: 1.20 × 1.30 = 1.56 (56% total). Log return: ln(1.56) = 0.445. WRONG approach: ln(1.20) + ln(1.30) = 0.182 + 0.262 = 0.444 — wait, this IS correct! Because ln(xy) = ln(x) + ln(y). The mistake happens with ADDITIVE scenarios: "Portfolio gained €10,000 (log = 9.21) and €15,000 (log = 9.61), so total log gain = 18.82." Nonsense! You can't add logarithms of additive quantities. Log returns add for MULTIPLICATIVE growth (sequential returns), not for additive contributions. Know when logarithms apply: multiplicative processes (compound growth, signal chains) use log addition; additive processes (summing gains, combining forces) don't.

4-5 Pro Tips

Tip 1: Use Logarithmic Scales to Visualize Exponential Data
Plot exponential growth on a logarithmic Y-axis (semi-log plot) — it appears as a straight line. COVID cases early in pandemic: linear plot showed "hockey stick" curve, semi-log plot showed straight line (confirming exponential spread). Stock market long-term: linear plot shows recent years dominating, log plot shows 1929 crash and 2008 crash as similar-sized drops (both ~50% declines). Moore's Law (transistor count doubling every 2 years) appeared as a straight line on log plots for 50 years. To create semi-log plot: take log of Y-values, plot against linear X. Slope of line = growth rate. If log₁₀(y) increases by 0.301 per year, that's 10^0.301 = 2× per year (100% growth). If it increases by 0.0414 per year, that's 10^0.0414 = 1.10× per year (10% growth).

Tip 2: Memorize Common Log Values for Quick Estimates
log₁₀(2) = 0.301, log₁₀(3) = 0.477, log₁₀(5) = 0.699, log₁₀(7) = 0.845. Use these to estimate: log₁₀(6) = log₁₀(2 × 3) = 0.301 + 0.477 = 0.778. log₁₀(12) = log₁₀(3 × 4) = 0.477 + 2(0.301) = 1.079. log₁₀(15) = log₁₀(3 × 5) = 0.477 + 0.699 = 1.176. log₁₀(200) = log₁₀(2) + log₁₀(100) = 0.301 + 2 = 2.301. ln(2) = 0.693 (Rule of 72: 72/rate = doubling time). ln(10) = 2.303 (converts log₁₀ to ln: ln(x) = 2.303 × log₁₀(x)). log₂(10) = 3.322 (bits per decimal digit). These constants appear constantly in engineering, finance, and computer science. Flashcard them.

Tip 3: Apply the Rule of 72 and Its Logarithmic Origin
The Rule of 72 estimates doubling time: years ≈ 72 ÷ annual rate (%). At 8%: 72/8 = 9 years. Derivation uses natural log: exact doubling time = ln(2) / ln(1 + r). For small r, ln(1 + r) ≈ r. So doubling time ≈ ln(2) / r = 0.693 / r. With r as percentage: 69.3 / rate%. We use 72 instead of 69.3 because 72 has many divisors (2, 3, 4, 6, 8, 9, 12) and is more accurate for typical rates (6-10%). At 8%: exact = ln(2)/ln(1.08) = 0.693/0.0770 = 9.00 years. Rule of 72: 72/8 = 9.0 ✓. At 5%: exact = 14.21 years, Rule of 72: 14.4 years (1.3% error). For continuous compounding, use Rule of 69.3: 69.3/5 = 13.86 years (exact).

Tip 4: Solve Exponential Equations Using Logarithms
When the variable is in the exponent, take logarithms of both sides. Example: 3^x = 50. Take log: log(3^x) = log(50). Power rule: x × log(3) = log(50). Solve: x = log(50)/log(3) = 1.699/0.477 = 3.56. Verify: 3³.⁵⁶ = 50.0 ✓. Example: 1.05^t = 3 (how long to triple at 5%?). t × log(1.05) = log(3). t = log(3)/log(1.05) = 0.477/0.0212 = 22.5 years. Verify: 1.05²².⁵ = 3.00 ✓. Example: 2^(3x-1) = 128. Take log₂: 3x - 1 = log₂(128) = 7. So 3x = 8, x = 8/3 = 2.667. Verify: 2^(3×2.667 - 1) = 2^7 = 128 ✓. This technique solves any exponential equation — essential for finance, physics, and biology.

Tip 5: Use Logarithmic Differentiation for Complex Functions
In calculus, differentiate y = f(x)^g(x) by taking logs first. Example: y = x^x. Take ln: ln(y) = x × ln(x). Differentiate implicitly: (1/y) × dy/dx = ln(x) + x × (1/x) = ln(x) + 1. So dy/dx = y × (ln(x) + 1) = x^x × (ln(x) + 1). At x = 2: dy/dx = 4 × (0.693 + 1) = 6.77. Another example: y = (x² + 1)^√x. Take ln: ln(y) = √x × ln(x² + 1). Differentiate: (1/y) × dy/dx = (1/(2√x)) × ln(x² + 1) + √x × (2x/(x² + 1)). Solve for dy/dx. This technique handles products, quotients, and powers that would be nightmares with standard rules. It's also how calculators compute arbitrary powers: x^y = e^(y × ln(x)).

4 Frequently Asked Questions

What's the difference between log, ln, and lg?

Notation varies by field: log(x) usually means log₁₀(x) (common logarithm) in engineering and high school math. ln(x) always means log_e(x) (natural logarithm, base e ≈ 2.718). lg(x) or lb(x) means log₂(x) (binary logarithm) in computer science. In advanced mathematics, log(x) often means ln(x) — context matters. Programming languages: Python's math.log(x) is natural log, math.log10(x) is common log, math.log2(x) is binary log. Excel: LOG(x) is base 10, LN(x) is natural log, LOG(x, b) is custom base. Calculator buttons: "log" is base 10, "ln" is base e. To avoid confusion, always specify the base: log₁₀(x), log₂(x), or log_e(x). The change-of-base formula converts between them: log_b(x) = ln(x)/ln(b).

Why are logarithms of numbers between 0 and 1 negative?

Because negative exponents produce fractions. 10⁻¹ = 0.1, so log₁₀(0.1) = -1. 10⁻² = 0.01, so log₁₀(0.01) = -2. 10⁻³ = 0.001, so log₁₀(0.001) = -3. Pattern: log₁₀(0.005) = log₁₀(5 × 10⁻³) = log₁₀(5) + log₁₀(10⁻³) = 0.699 + (-3) = -2.301. The negative logarithm indicates the number is less than 1. In pH: [H⁺] = 0.0001 = 10⁻⁴, so pH = -log₁₀(10⁻⁴) = -(-4) = 4. In decibels: if intensity is 1/1000 of reference, dB = 10 × log₁₀(0.001) = 10 × (-3) = -30 dB (quieter than reference). Negative logs are common in science — they signal "fraction of the reference unit."

How did people calculate logarithms before calculators?

Logarithm tables, published from 1614 (John Napier's invention) through the 1970s. A typical table listed log₁₀(x) for x = 1.000 to 9.999 with 4-7 decimal places. To find log(3.141): look up 3.14 in the table, interpolate for the third decimal. Result: 0.4971. For numbers outside 1-10, use log(a × 10ⁿ) = log(a) + n. log(314.1) = log(3.141) + 2 = 2.4971. Slide rules (invented ~1620) had logarithmic scales — sliding them added lengths, which multiplied numbers. To multiply 3 × 4: align "1" on sliding scale with "3" on fixed scale, find "4" on sliding scale, read "12" on fixed scale. Engineers used slide rules until the 1970s — Apollo guidance computers were programmed by engineers with slide rules. Log tables and slide rules made complex calculations feasible before electronics.

Can logarithms have negative bases?

No — logarithms with negative bases are undefined in real numbers. log_(-2)(8) would ask "what exponent makes (-2)^y = 8?" There's no consistent real answer. (-2)³ = -8, (-2)⁴ = 16 — no integer power gives positive 8. Fractional powers of negative numbers produce complex results: (-2)^0.5 = √(-2) = i√2. Since logarithms must produce unique real values for practical use, negative bases are excluded. Similarly, base 0 and base 1 are undefined: 0^y = 0 for all y > 0 (can't produce other numbers), 1^y = 1 for all y (always gives 1). Valid bases: b > 0 and b ≠ 1. Common bases: 10 (decimal system), e (natural growth), 2 (binary systems). Custom bases like 1.05 (5% growth) or 3 (ternary systems) are valid but less common.

See also: Exponent Calculator, Root Calculator, Compound Savings Calculator, Scientific Notation Calculator, Percentage Increase Calculator

Written and reviewed by the CalcToWork editorial team. Last updated: 2026-04-29.

Frequently Asked Questions

15% of 200 is 30. Calculated as 200 × 15 / 100 = 30.
Percentage change = ((final − initial) / |initial|) × 100. From 80 to 100 it is (20/80)×100 = 25%.
The Pythagorean theorem states that in a right triangle, c² = a² + b², where c is the hypotenuse and a, b are the legs.
If A corresponds to B, and we want what corresponds to C: X = (B × C) / A.