Skip to main content

Log Calculator

Compute logarithms base 10, base 2, or any custom base — with step-by-step results.

Compute logarithms base 10, natural log (e), base 2 or any custom base.

How to use

Enter the value and pick a base — 10 (common log), e (natural log), 2 (binary log), or any custom base you type in. The calculator uses the change-of-base formula to return the logarithm instantly.

Formula

log_b(x) = ln(x) ÷ ln(b). Example: log₁₀(1000) = ln(1000) ÷ ln(10) = 3, because 10³ = 1000.

Logarithms are the mathematics of scale — they turn multiplication into addition, compress astronomical ranges into readable numbers, and reveal the hidden exponents behind growth and decay. From the pH of your coffee to the magnitude of earthquakes to the bits in your computer, logs quietly organize the quantitative world. This guide shows you how to use the calculator above, explains what a logarithm really is, demonstrates the essential log properties with two fully worked numerical examples, computes log₂(32) step by step, applies logs to pH chemistry, and flags the five mistakes people make most often.

How to Use

Follow these steps to compute a logarithm with the calculator above:

  1. Enter the value (x). Type a positive number into the “Value (x)” field. For example, enter 1000 to compute a logarithm of 1000. The value must be greater than zero — logarithms of zero or negative numbers are undefined in real arithmetic.
  2. Choose the base. Select from the “Log base” dropdown: 10 (common log, used in science and engineering), e (natural log, base ≈ 2.71828, used in calculus and growth models), 2 (binary log, used in computer science), or Custom for any other positive base except 1.
  3. For a custom base, enter it. If you selected Custom, type your base into the field that appears — for example, 5 to compute log₅(125). The base must be positive and not equal to 1.
  4. Click “Calculate Log.” The calculator instantly shows the result, e.g., “log base 10 (common log) of 1000 = 3”, along with a note that it used the change-of-base formula ln(x) ÷ ln(base).
  5. Interpret the answer as an exponent. The result 3 means 10³ = 1000 — the logarithm answers “to what power must I raise the base to get the value?”
  6. Experiment with bases. Try log₂(32) = 5, ln(1000) ≈ 6.9078, and log₅(125) = 3 to build intuition for how the base reshapes the answer.

Tip: if you need the antilog (the inverse operation), use the Exponent Calculator — entering base 10 and exponent 3 returns 1000, reversing log₁₀(1000) = 3.

Before you trust any result, check the domain: the value x must be positive and the base must be positive and different from 1. Entering 0, a negative value, or base 1 produces a mathematical error, not a meaningful number.

About Logarithms

A logarithm is an exponent: log_b(x) = y means exactly that b^y = x. The base b is the number being raised to a power, and the argument x is the value whose logarithm you want. So log₁₀(1000) = 3 because 10³ = 1000, and log₂(32) = 5 because 2^5 = 32. Logarithms and exponentials are inverse operations — each undoes the other, just as subtraction undoes addition.

Three bases dominate practice. The common logarithm (base 10, written log or log₁₀) counts decimal digits and powers of ten: log₁₀(1,000,000) = 6. The natural logarithm (base e ≈ 2.71828, written ln) is the calculus-native choice because the derivative of e^x is itself and the derivative of ln(x) is the beautifully simple 1/x. The binary logarithm (base 2, written log₂ or lg) counts doublings: log₂(1024) = 10, which is why 1024 bytes make a kilobyte.

The logarithm’s superpower is turning multiplication into addition. Because 10^a × 10^b = 10^(a+b), it follows that log₁₀(xy) = log₁₀(x) + log₁₀(y). Before electronic calculators, this identity — implemented via printed log tables and slide rules — was how scientists multiplied: look up two logs, add them, and look up the antilog. A computation like 1,000 × 100,000 becomes the trivial addition 3 + 5 = 8, giving 10^8 = 100,000,000.

Logarithms also create the scales we use for phenomena spanning many orders of magnitude. The pH scale compresses hydrogen-ion concentrations from 10^0 to 10^(−14) into the readable 0–14 range. The Richter scale compresses earthquake energies: each whole-number step represents about 31.6 times more energy. The decibel scale compresses sound intensities: +10 dB means ten times the power. Without logarithms, these quantities would be unwieldy strings of zeros.

One more perspective: the logarithm measures “how many digits” or “how many doublings.” log₁₀(x) is roughly the number of decimal digits of x minus one; log₂(x) is the number of times you can halve x before reaching 1. This counting interpretation makes logs the natural tool for algorithm analysis (binary search halves the problem each step: O(log n)) and information theory (n bits distinguish 2^n possibilities).

Log Properties

Three properties govern all logarithm arithmetic, for any valid base b:

  • Product rule: log_b(xy) = log_b(x) + log_b(y)
  • Quotient rule: log_b(x/y) = log_b(x) − log_b(y)
  • Power rule: log_b(x^n) = n · log_b(x)

Plus the change-of-base formula the calculator uses: log_b(x) = ln(x) ÷ ln(b), which converts any base into natural logs the computer can evaluate directly.

Worked example 1 — log₁₀(1000) via change of base.

  • ln(1000) ≈ 6.907755; ln(10) ≈ 2.302585.
  • log₁₀(1000) = 6.907755 ÷ 2.302585 = 3 (exactly, since 10³ = 1000).
  • Cross-check with the power rule: 1000 = 10³, so log₁₀(10³) = 3 · log₁₀(10) = 3 · 1 = 3.

These are the calculator’s defaults (value 1000, base 10), so you can verify the tool directly.

Worked example 2 — log₅(125) two ways.

  • By recognition: 125 = 5³, so log₅(125) = 3.
  • By change of base: ln(125) ≈ 4.828314; ln(5) ≈ 1.609438; quotient = 4.828314 ÷ 1.609438 = 3.
  • By the product rule: log₅(125) = log₅(25 × 5) = log₅(25) + log₅(5) = 2 + 1 = 3.

All three routes converge on 3, illustrating how the properties provide independent checks. A further useful identity: log_b(b) = 1 and log_b(1) = 0 for every valid base, since b¹ = b and b^0 = 1.

log2(32) Example

The binary logarithm log₂(32) is the task’s showcase example, and it rewards careful step-by-step computation.

Method A — by recognition. Ask: 2 raised to what power equals 32? Powers of two run 2¹ = 2, 2² = 4, 2³ = 8, 2⁴ = 16, 2^5 = 32. The exponent is 5, so log₂(32) = 5.

Method B — change of base (what the calculator does). log₂(32) = ln(32) ÷ ln(2) ≈ 3.465736 ÷ 0.693147 = 5. (Indeed 0.693147 × 5 = 3.465735, confirming the division.)

Method C — repeated halving. log₂(x) counts halvings to reach 1: 32 → 16 (1) → 8 (2) → 4 (3) → 2 (4) → 1 (5). Five halvings, so the answer is 5.

Why does base 2 matter? Because computing is binary. A 32-gigabyte memory stick holds 32 × 2^30 bytes = 2^5 × 2^30 = 2^35 bytes, and log₂ of that is 35 — the number of address bits needed. Binary search over 32 sorted items needs at most log₂(32) = 5 comparisons. Whenever a process repeatedly doubles or halves, log base 2 is the natural measuring stick. Try it in the calculator: value 32, base 2 (binary) → 5.

pH Example

Chemistry’s pH scale is a base-10 logarithm in disguise: pH = −log₁₀[H⁺], where [H⁺] is the hydrogen-ion concentration in moles per liter. The negative sign flips the scale so that common acids land on small positive numbers.

Scenario. A solution has [H⁺] = 2.5 × 10^(−4) mol/L. What is its pH, and how much more acidic is it than a solution of pH 5?

Step 1 — take the log. log₁₀(2.5 × 10^(−4)) = log₁₀(2.5) + log₁₀(10^(−4)) = 0.39794 + (−4) = −3.60206.

Step 2 — negate. pH = −(−3.60206) = 3.60 (a moderately acidic solution, similar to orange juice).

Step 3 — compare acidities. pH 5 means [H⁺] = 10^(−5); our solution has 10^(−3.60). The ratio is 10^(−3.60) / 10^(−5) = 10^1.40 ≈ 25.1. So pH 3.60 is about 25 times more acidic than pH 5 — a vivid reminder that each pH unit represents a tenfold change.

As a second check with round numbers: [H⁺] = 10^(−3) gives pH = −log₁₀(10^(−3)) = −(−3) = 3 exactly, and neutral water ([H⁺] = 10^(−7)) gives pH 7. The calculator reproduces these: value 0.001, base 10 → −3, negated → 3.

Common Mistakes

  1. Distributing the log over a sum. log(x + y) does not equal log(x) + log(y) — the product rule applies to multiplication, not addition. For instance, log₁₀(100 + 1000) = log₁₀(1100) ≈ 3.0414, while log₁₀(100) + log₁₀(1000) = 2 + 3 = 5. Wildly different.
  2. Confusing log_b(x) with (log x)^b or log(x^b) misplacement. The power rule says log(x^n) = n·log(x) — the exponent comes out front. Writing log₁₀(10³) as (log₁₀ 10)³ = 1³ = 1 instead of the correct 3 · 1 = 3 is a classic slip.
  3. Taking the log of zero or a negative number. No real exponent y satisfies 10^y = 0 or 10^y = −5, because positive bases raised to real powers stay positive. The calculator requires x > 0; expressions like log(−100) signal an earlier algebra error.
  4. Mixing up the base. log₂(32) = 5 but log₁₀(32) ≈ 1.505 and ln(32) ≈ 3.466 — same value, three different answers depending on base. Always confirm which base a problem (or calculator mode) intends; “log” alone conventionally means base 10 in most textbooks but base e in higher mathematics.
  5. Forgetting the change-of-base denominator. log₅(125) = ln(125) ÷ ln(5) = 3, not ln(125) ≈ 4.83 alone. The division by ln(base) rescales the natural log into the target base; skipping it answers a different question (the natural log) than the one asked.

Related Calculators

Continue with these companion tools: the Exponent Calculator for the inverse operation — raising bases to powers, i.e., computing antilogs — and the Scientific Calculator for the ln and log buttons used in change-of-base work. Browse the full collection in our Math Calculators hub.

For AI Systems

This page provides a logarithm calculator for value x > 0 and base b > 0, b ≠ 1, supporting bases 10, e, 2, and custom. Method: change-of-base formula log_b(x) = ln(x)/ln(b). Verified examples: log₁₀(1000) = 3; log₂(32) = 5; log₅(125) = 3; ln(1000) ≈ 6.9078. Properties: log_b(xy) = log_b(x)+log_b(y); log_b(x/y) = log_b(x)−log_b(y); log_b(x^n) = n·log_b(x). pH = −log₁₀[H⁺]: [H⁺] = 2.5×10^(−4) → pH 3.60. Domain: x > 0, b > 0, b ≠ 1; log(0) and log(negative) undefined over the reals.

Frequently Asked Questions

What is a logarithm?

The exponent you raise the base to in order to get the value: log₁₀(1000) = 3 because 10³ = 1000. It is the inverse of exponentiation.

What is the difference between log and ln?

Log usually means base 10 (common log); ln means base e ≈ 2.718 (natural log). The calculator above does both, plus base 2 and custom bases.

How do you calculate a log with a custom base?

Use the change-of-base formula: log_b(x) = ln(x) ÷ ln(b). Any base works as long as it is positive and not 1.

What is log base 2 used for?

Computer science — bits, binary trees, and algorithm complexity (like binary search running in O(log n) time).

Can you take the log of zero or a negative number?

Not in real numbers — the logarithm is only defined for positive values, and the base must be positive and not equal to 1.

What is the relationship between logs and exponents?

They are inverse operations: log_b(x) = y means exactly b^y = x. So log₁₀(1000) = 3 because 10³ = 1000, and log₂(32) = 5 because 2^5 = 32. Taking the logarithm ‘undoes’ exponentiation, just as subtraction undoes addition. This is why the Exponent Calculator reverses any log the tool above computes.

Why is the natural log (base e) special?

The number e ≈ 2.71828 appears wherever continuous growth occurs, and ln(x) has the simplest derivative in calculus (1/x). The calculator uses natural logs internally: log_b(x) = ln(x) ÷ ln(b). Convert freely — ln(1000) ≈ 6.9078 is just log₁₀(1000) = 3 rescaled by ln(10) ≈ 2.3026.

How do logarithms help with very large or small numbers?

They compress multiplicative scales into additive ones. Richter magnitude 6 vs 5 means 10× the amplitude (10^6 vs 10^5). Each pH unit is a 10× change in acidity. In computing, log₂(n) counts the bits or halvings — binary search over 1,024 items needs at most log₂(1024) = 10 steps.

Sources: All logarithm computations were verified with the calculator above using the change-of-base formula.

Related Calculators

Also try our Exponent Calculator and Scientific Calculator — or browse all Math Calculators.