Logarithm Calculator
Calculate the logarithm of any number with any base, including log base 2, 10, and e.
Did this tool answer your question?
Thanks — this helps us improve the tool.
How to use this tool
- Enter number and base in the fields above.
- Results update instantly as you type — or click Calculate.
- Read your log result and the full breakdown beneath it.
Calculate logbase(x) using the change-of-base formula: ln(x)/ln(base).
Formula
logbase(x) = ln(x) / ln(base)
This uses the change-of-base identity, where ln denotes the natural logarithm.
How it works
The calculator applies the change-of-base formula, dividing the natural logarithm of x by the natural logarithm of the chosen base to obtain the logarithm in any base. Both x and the base must be positive and the base must not equal 1; entering invalid values will produce NaN or ±Infinity.
Worked example
Worked example: log base 2 of 8
- Input: x = 8, base = 2.
- Apply change-of-base: ln(8) / ln(2).
- ln(8) ≈ 2.0794; ln(2) ≈ 0.6931.
- Divide: 2.0794 / 0.6931 = 3.
log2(8) = 3
Common mistakes to avoid
- Confusing log base 10 (common log) with natural log (ln); entering log(100) and expecting ln(100) = 4.605 instead of 2.
- Treating log(x) as defined for x <= 0; the logarithm is undefined for non-positive inputs.
- Forgetting to apply the change-of-base formula when using a non-standard base, e.g. computing log2(8) as log(8) instead of log(8)/log(2).
Key terms
- Logarithm
- The exponent to which a base must be raised to produce a given number; logb(x) = y means by = x.
- Natural logarithm (ln)
- The logarithm with base e (≈ 2.71828); the basis for the change-of-base formula.
- Change-of-base formula
- The identity logb(x) = ln(x) / ln(b), used to compute logarithms in any base from natural logs.
- Common logarithm (log10)
- The base-10 logarithm, widely used in science and engineering; log10(1000) = 3.
- Binary logarithm (log2)
- The base-2 logarithm, important in computer science and information theory.
Frequently asked questions
- How do you calculate a logarithm with any base?
- Use the change-of-base formula: log_b(x) = ln(x) / ln(b). For example, log_2(8) = ln(8)/ln(2) = 3.