calculate logarithm

Logarithm Calculator

Enter a number and a base to compute logbase(number).

What Is a Logarithm?

A logarithm is the inverse of an exponent. If you know that by = x, then logb(x) = y. In plain language: a logarithm tells you what power a base must be raised to in order to produce a target number.

Example: since 103 = 1000, we have log10(1000) = 3.

How This Calculator Works

Most programming languages provide the natural logarithm function ln(x). To calculate logs in any base, we use the change-of-base formula:

logb(x) = ln(x) / ln(b)

This is exactly what the calculator above does. It also shows natural log and common log for quick comparison.

Input Rules You Should Know

  • Number x must be greater than 0. Logarithms of zero or negative numbers are undefined in real numbers.
  • Base b must be greater than 0 and cannot equal 1. A base of 1 never changes under exponentiation, so it cannot define a valid logarithm scale.
  • Use decimal values if needed. Fractional bases and numbers are valid as long as they meet the conditions above.

Worked Examples

Example 1: Common Logarithm

Compute log10(10000). Since 104 = 10000, the result is 4.

Example 2: Binary Logarithm

Compute log2(64). Because 26 = 64, the answer is 6.

Example 3: Fractional Result

Compute log10(50). This is not an integer; the calculator gives approximately 1.69897.

Why Logarithms Matter

Logarithms appear everywhere in science, technology, and finance because they compress very large ranges into manageable scales.

  • Finance: growth models, continuously compounded returns, and risk calculations.
  • Computer science: algorithm complexity such as O(log n), binary search, and tree depth.
  • Chemistry: pH is logarithmic.
  • Engineering: decibel scales for signal and sound strength.
  • Data science: log transformations for skewed distributions.

Core Logarithm Properties

Product Rule

logb(mn) = logb(m) + logb(n)

Quotient Rule

logb(m/n) = logb(m) - logb(n)

Power Rule

logb(mk) = k · logb(m)

Identity Rules

  • logb(1) = 0
  • logb(b) = 1

Common Mistakes

  • Entering x = 0 and expecting a number output.
  • Setting base to 1 by accident.
  • Confusing ln(x) (base e) with log(x) (often base 10, depending on context).
  • Rounding too early in multi-step calculations.

Quick FAQ

Can a logarithm be negative?

Yes. If 0 < x < 1 and base is greater than 1, the logarithm is negative.

What is the natural logarithm?

The natural log is base e (approximately 2.71828), written as ln(x).

What base should I use?

Use base 10 for common logarithms, base 2 for computing and information theory, and base e for continuous growth and calculus.

🔗 Related Calculators