Logarithm Calculator

log_b(x) = y means b^y = x. log2(8) = 3 because 2^3 = 8. log10(1000) = 3 because 10^3 = 1000. ln(e) = 1 because e^1 = e. Change of base: log_b(x) = ln(x) / ln(b). Key identities: log(x*y) = log(x)+log(y); log(x/y) = log(x)−log(y); log(x^n) = n*log(x). log2 is used in computer science for bits and binary search; log10 for decibels and pH; ln for calculus and exponential growth.

Calculate logarithms in any base: log base 2 (binary), log base 10 (common), natural log (ln), or any custom base. Shows formula, result, and inverse. Includes key logarithm identities and reference table.

Quick Examples

Logarithm Base

Value

log10() =
Value must be greater than 0

Logarithm Reference

BaseNotationCommon Use
2log2, lbBits, binary search, algorithms (Big O)
e (2.71828...)ln, logeCalculus, exponential growth/decay, statistics
10log, log10Decibels (dB), pH, Richter scale, slide rules
Key identities:
log_b(x * y) = log_b(x) + log_b(y)
log_b(x / y) = log_b(x) - log_b(y)
log_b(x^n) = n * log_b(x)
log_b(x) = ln(x) / ln(b) (change of base)

How to Use

  1. 1

    Select the logarithm base

    Choose log2 (binary, used in CS), log10 (common log, used for pH/decibels), ln (natural log, base e), or Custom to enter any base. Click a quick example preset to prefill a known result.

  2. 2

    Enter the value

    Type the number to take the logarithm of. The value must be greater than 0 (logarithm is undefined at 0 and negative numbers). For custom base, also enter a positive base that is not equal to 1.

  3. 3

    Read the result

    The logarithm result appears with full precision. If the result is a whole number (e.g., log2(8) = 3), it is highlighted as an exact integer.

  4. 4

    Check the formula and inverse

    The formula panel shows the change-of-base calculation used. The inverse panel shows the exponentiation that reverses the logarithm (b^result = original value) as a verification.

Frequently Asked Questions

What is a logarithm and what does log base 2 mean?
A logarithm answers the question: "What exponent do I need to raise base b to get x?" Written log_b(x) = y means b^y = x. log base 2 (log2) means: "2 raised to what power gives this number?" For example, log2(8) = 3 because 2^3 = 8. log2 is used in computer science for counting bits, binary search steps, and tree heights. log base 10 (log10) is the common logarithm used for decibels and pH. ln is log base e (≈2.71828), used in calculus and natural exponential growth.
What is the natural logarithm (ln) and why use it?
The natural logarithm (ln) is the logarithm with base e, where e ≈ 2.71828 (Euler's number). It arises naturally in calculus because the derivative of e^x is e^x itself, making it the "natural" base for exponential functions. ln is used in: compound interest formulas (A = Pe^(rt)), probability distributions (normal, Poisson), physics (radioactive decay half-life), and information theory. The change of base formula lets you convert: log_b(x) = ln(x) / ln(b), so any logarithm can be computed from ln.
What are the logarithm rules (product, quotient, power)?
The three core logarithm rules: (1) Product rule: log_b(x * y) = log_b(x) + log_b(y) — multiplying numbers adds their logs. (2) Quotient rule: log_b(x / y) = log_b(x) - log_b(y) — dividing numbers subtracts their logs. (3) Power rule: log_b(x^n) = n * log_b(x) — an exponent becomes a multiplier. Change of base: log_b(x) = log(x) / log(b) = ln(x) / ln(b). These rules are why slide rules worked and why logs simplify multiplication in engineering calculations.
Why is log2 important in computer science?
log2 (binary logarithm) counts how many times you can halve a number before reaching 1, which is the essence of binary search and tree-based data structures. Key applications: binary search on n elements takes at most log2(n) steps; a balanced binary tree of n nodes has height log2(n); a number n needs ceiling(log2(n)) bits to represent in binary; sorting algorithms like merge sort and quicksort run in O(n log2 n) time. For example, searching 1 billion records with binary search takes at most log2(1,000,000,000) ≈ 30 comparisons.
What is the change of base formula for logarithms?
The change of base formula converts any logarithm to one your calculator supports: log_b(x) = log(x) / log(b) = ln(x) / ln(b). This is derived from the identity b^(log_b(x)) = x — taking ln of both sides gives log_b(x) * ln(b) = ln(x), so log_b(x) = ln(x)/ln(b). Example: log_3(81) = ln(81)/ln(3) = 4.394/1.099 = 4, because 3^4 = 81. This is how calculators with only log10 or ln buttons compute arbitrary base logarithms.
How do I calculate log base 2 of a number manually?
Methods to find log2(x): (1) Change of base: log2(x) = log10(x) / log10(2) = log10(x) / 0.30103. Example: log2(32) = log10(32)/0.30103 = 1.5051/0.30103 = 5. (2) Bit counting: for powers of 2, count the bit position minus 1 (log2(256) = 8 because 256 = 2^8). (3) Repeated halving: count how many times you divide x by 2 until you reach 1. These methods work well for powers of 2; for non-powers use the change of base formula or this calculator.

Related Tools