Logarithm Calculator

Share calculator:
Embed this tool:

Enter a number and a base to get log base b of x, or leave the base empty for the natural logarithm. The guide explains what a logarithm means and the rules for working with them.

What is a logarithm?

A logarithm answers the question: what exponent do I need? If you raise the base b to the power y and get x, then y is the logarithm of x to base b. The two statements are interchangeable:

log_b(x) = y if and only if by = xb must be positive and not equal to 1; x must be positive

Because 103 = 1000, the base-10 logarithm of 1000 is 3. Because 210 = 1024, the base-2 logarithm of 1024 is 10. Logarithms turn multiplication into addition, which is why they once powered slide rules and why they still compress huge ranges of values into manageable scales.

The three bases you will meet most

  • Common logarithm, base 10, written log or log₁₀. It counts powers of ten and is used for scales such as decibels and pH.
  • Binary logarithm, base 2, written log₂ or lb. It counts doublings and appears throughout computing and information theory.
  • Natural logarithm, base e ≈ 2.71828, written ln. It is the logarithm that calculus prefers, and it governs continuous growth and decay.

How to use the calculator

  1. Type the base in the Base box. Use 10 for the common log and 2 for the binary log.
  2. Leave the base empty to get the natural logarithm (ln). A base of zero or below is also treated as e.
  3. Type the positive number whose logarithm you want in the Number box and press Calculate.

The result is rounded to six decimal places. A whole-number answer is shown bare, and other answers are padded to two, four or six decimals, so log base 4 of 2 appears as 0.50 and log base 10 of 2 as 0.301030. Plain numbers only: exponent notation such as 1e3 is not accepted.

Rules for working with logarithms

RuleFormula
Productlog_b(x × y) = log_b(x) + log_b(y)
Quotientlog_b(x ÷ y) = log_b(x) − log_b(y)
Powerlog_b(xk) = k × log_b(x)
Log of the baselog_b(b) = 1
Log of onelog_b(1) = 0
Change of baselog_b(x) = log_c(x) ÷ log_c(b)

The change-of-base rule is what the calculator uses internally: it takes the natural log of the number and divides it by the natural log of the base. You can use the same trick on any calculator that only has ln or log₁₀ keys.

Worked examples

  • log₁₀(1000) = 3, because 10 × 10 × 10 = 1000.
  • log₂(0.25) = −2, because 2−2 = 1/4. Numbers below 1 have negative logarithms when the base is greater than 1.
  • log₂(10) ≈ 3.321928. Ten bits can distinguish 1024 values, so 3.32 bits are needed per decimal digit.
  • ln(100) ≈ 4.605170, which is twice ln(10) ≈ 2.302585, in line with the power rule.
  • log₃(20) ≈ 2.726833. With no base-3 key, compute ln(20) ÷ ln(3) = 2.995732 ÷ 1.098612 = 2.726833.

Where logarithms are used

  • Acidity. pH is −log₁₀ of the hydrogen-ion concentration. A concentration of 3.2 × 10−4 mol/L gives a pH of about 3.49.
  • Sound. The decibel is 10 × log₁₀ of a power ratio, so a hundredfold increase in power is +20 dB.
  • Growth and finance. The time for something growing at rate r to double is ln 2 ÷ ln(1 + r). At 7% a year that is about 10.24 years, close to the rule-of-72 estimate of 10.3.
  • Information. Choosing among 1000 equally likely options takes log₂(1000) ≈ 9.97 bits, so 10 whole bits are needed to store the choice.
  • Orders of magnitude. On a log scale, equal steps mean equal ratios, which is why earthquake magnitudes and astronomical brightness are quoted this way.

To go the other way and recover the number from its logarithm, use the antilog calculator; for plain powers, see the exponent calculator. Roots are covered by the square root calculator.

Domain and special cases

  • Zero. No power of a positive base ever equals 0, so log(0) is undefined and the calculator says so.
  • Negative numbers. There is no real logarithm of a negative number, so the result shows as nan (not a number).
  • Base 1. Every power of 1 is 1, so a base of 1 cannot recover other numbers and the result is nan.
  • Values between 0 and 1 are fine and simply produce negative answers.

Frequently asked questions

What is the difference between log and ln?

Log usually means base 10 (or sometimes base 2 in computing), while ln is the natural logarithm with base e ≈ 2.71828. Both are the same function up to a constant factor: ln(x) = 2.302585 × log₁₀(x).

How do I calculate a logarithm with a base my calculator does not have?

Use the change-of-base rule: take the log of the number in any base you do have and divide by the log of your base in that same base. For log base 3 of 20, that is ln 20 ÷ ln 3 ≈ 2.7268.

Why is the logarithm of a negative number not defined?

A positive base raised to any real power always gives a positive result, so no real exponent can produce a negative number. Complex numbers allow it, but this calculator works with real values.

What does leaving the base empty do?

It computes the natural logarithm, base e. The same happens if you enter a base of zero or a negative number.

References

  1. NIST Digital Library of Mathematical Functions, section 4.2: Definitions of the logarithm

Cite this calculator and page

If you use this page in your work, you can cite it as:

Reeliy Editorial Team. (2026). Logarithm Calculator. Reeliy. https://reeliy.com/calculators/log-calculator“Logarithm Calculator.” Reeliy, 2026, https://reeliy.com/calculators/log-calculator.