Logarithm Calculator

Compute log base b of any positive number, with presets for log₁₀, ln, and log₂, plus a full change-of-base breakdown.

Enter a number and base to calculate the logarithm

Logarithm Calculator

A logarithm answers the question: to what exponent must a given base be raised to produce a certain number? Written as log_b(x) = y, it means b^y = x. This calculator computes the logarithm of any positive number x for any valid base b (where b > 0 and b ≠ 1), including the common presets: base-10 (log₁₀), natural logarithm (ln, base e ≈ 2.718), and binary logarithm (log₂).

The change-of-base formula is the key to computing any logarithm using natural or common logs: log_b(x) = ln(x) / ln(b). This calculator displays the full step-by-step breakdown using this identity, making it easy to verify results and understand the underlying math.

How it works

log_b(x) = ln(x) / ln(b) = log(x) / log(b). Special cases: log₁₀(x) = log(x), ln(x) = log_e(x), log₂(x) = ln(x) / ln(2). Domain: x > 0, b > 0, b ≠ 1.

Use cases

  • Solving exponential equations in algebra and pre-calculus
  • Calculating decibel levels in acoustics and signal processing
  • Computing pH values in chemistry (pH = −log₁₀[H⁺])
  • Analyzing algorithm complexity in computer science (e.g., O(log n))
  • Measuring earthquake magnitudes on the Richter scale

Frequently asked questions

What is a logarithm in simple terms?

A logarithm answers the question: to what power must the base be raised to get a number? Writing log_b(x) = y means b^y = x. For example, log₁₀(1000) = 3 because 10³ = 1000, and log₂(8) = 3 because 2³ = 8.

What is the difference between log and ln?

By convention, log usually means the common logarithm with base 10, while ln is the natural logarithm with base e ≈ 2.718. They differ only by a constant factor: log₁₀(x) = ln(x) ÷ ln(10) ≈ ln(x) ÷ 2.3026. Base 10 is common in engineering and pH calculations; base e appears throughout calculus, growth models, and compound interest.

How do you calculate a logarithm with any base?

Use the change-of-base formula: log_b(x) = ln(x) ÷ ln(b), or equivalently log(x) ÷ log(b). For example, log₂(10) = ln(10) ÷ ln(2) ≈ 2.3026 ÷ 0.6931 ≈ 3.32. This calculator shows this exact step-by-step breakdown for any base b > 0 with b ≠ 1.

Why can't you take the logarithm of a negative number or zero?

Because a positive base raised to any real power is always positive: b^y > 0 for every real y. There is therefore no real exponent that produces 0 or a negative result, so log_b(x) is only defined for x > 0. The base itself must also satisfy b > 0 and b ≠ 1, since 1 raised to any power is always 1.

What is the logarithm base 2 used for?

The binary logarithm log₂ is central to computer science and information theory. It measures how many times a value can be halved — which is why binary search on n items takes about log₂(n) steps, expressed as O(log n) complexity — and it counts the bits needed to represent a number, since log₂(8) = 3 means 8 values fit in 3 bits.

Related Calculators