Logarithm Calculator (Log Base Any Number)

  • Free
  • No sign-up
  • Works on phones
  • Shows the working
Algebra & Trig#34

Logarithm Calculator

\(\log_b x\) for any base (use e for ln), with the exponential form and change of base.

This logarithm calculator computes \( \log_b x \) for any positive base \( b \neq 1 \): base 10 (common log), base 2, base \( e \) (natural log, ln) or any other number. It shows the answer exactly when it’s a whole number or simple fraction, the equivalent exponential statement, the change-of-base working, and the value in the three most-used bases.

It’s handy for checking log homework, solving exponential equations and converting between bases. It’s free and needs no sign-up.

Logarithm Calculator (Log Base Any Number): The graph of y = log₂ x passes through (1, 0), (2, 1) and (8, 3): the logarithm…
The graph of y = log₂ x passes through (1, 0), (2, 1) and (8, 3): the logarithm is the exponent you put on 2 to get x.

How to use the logarithm calculator

  1. Enter x, the number you’re taking the log of. It must be positive. Expressions such as 1/4, e^2 or sqrt(10) are accepted.
  2. Enter the base b. Type e for the natural log.
  3. Press Calculate.
  4. Read \( \log_b x \), the exponential form \( b^y = x \), and the change of base \( \frac{\ln x}{\ln b} \).

Definition and formula

A logarithm answers the question “what power of b gives x?”:

A hand operating an HP financial calculator with a number on the screen.

$$\log_b x = y \iff b^y = x$$

Most calculators only have ln and log base 10, so other bases use the change-of-base formula:

$$\log_b x = \frac{\ln x}{\ln b} = \frac{\log_{10} x}{\log_{10} b}$$

Worked example: log base 2 of 8

\( 2^3 = 8 \), so \( \log_2 8 = 3 \). Change of base agrees: \( \frac{\ln 8}{\ln 2} = \frac{2.0794}{0.6931} = 3 \).

Worked example: a non-integer answer

\( \log_3 50 \). Since \( 3^3 = 27 \) and \( 3^4 = 81 \), the answer is between 3 and 4. Change of base gives

$$\log_3 50 = \frac{\ln 50}{\ln 3} = \frac{3.9120}{1.0986} \approx 3.5609$$

Check: \( 3^{3.5609} \approx 50 \).

Worked example: a negative log

\( \log_2 \frac14 = -2 \), because \( 2^{-2} = \frac{1}{4} \). Logs of numbers between 0 and 1 are negative whenever the base is greater than 1.

Solving an exponential equation

Solve \( 5 \cdot 2^t = 80 \). Divide by 5: \( 2^t = 16 \). Take \( \log_2 \) of both sides: \( t = \log_2 16 = 4 \). For an equation like \( 2^t = 50 \), \( t = \log_2 50 \approx 5.6439 \), which is one of the values the calculator lists.

Tips and common mistakes

  • Logs of zero or negatives. \( \log_b x \) is only defined for \( x > 0 \). There’s no real power of 10 that gives \( -1 \).
  • log means different things. In most school courses \( \log x \) is base 10; in many calculus and programming contexts it means ln. Check which your source uses.
  • \( \log(a + b) \neq \log a + \log b \). The product rule is \( \log(ab) = \log a + \log b \). See logarithm rules for all of them.
  • Base 1 is not allowed. Every power of 1 is 1, so \( \log_1 x \) can’t be defined.

Logs in calculus

The natural log is the one calculus prefers because its derivative is simple: \( \frac{d}{dx}\ln x = \frac1x \), and \( \int \frac{dx}{x} = \ln|x| + C \). For other bases, \( \frac{d}{dx}\log_b x = \frac{1}{x\ln b} \). See the derivative of ln x and the integral of 1/x.

The rules of logarithms

RuleFormulaExample
Product\( \log_b(xy) = \log_b x + \log_b y \)\( \log_2 32 = \log_2 4 + \log_2 8 = 2 + 3 \)
Quotient\( \log_b(x/y) = \log_b x - \log_b y \)\( \log 50 - \log 5 = \log 10 = 1 \)
Power\( \log_b(x^k) = k\log_b x \)\( \ln(e^5) = 5 \)
Change of base\( \log_b x = \frac{\ln x}{\ln b} \)\( \log_5 40 = \frac{\ln 40}{\ln 5} \approx 2.292 \)
Special values\( \log_b 1 = 0 \), \( \log_b b = 1 \)\( \log 1 = 0 \)

There is no rule for \( \log(x + y) \): it is not \( \log x + \log y \).

A note on notation

In this calculator and most calculus courses, \( \ln x \) is the natural logarithm (base \( e \)). On most school calculators \( \log x \) means base 10, while in many university texts and programming languages \( \log x \) means the natural log. When in doubt, write the base explicitly: \( \log_{10} x \) or \( \ln x \).

Solving a logarithmic equation

Solve \( \log_2 x + \log_2(x - 2) = 3 \):

  1. Combine: \( \log_2[x(x - 2)] = 3 \).
  2. Rewrite as a power: \( x(x - 2) = 2^3 = 8 \).
  3. Solve \( x^2 - 2x - 8 = 0 \): \( x = 4 \) or \( x = -2 \).
  4. Check: \( \log_2(-2) \) is undefined, so the only solution is \( x = 4 \).

Always check answers, because logarithms are only defined for positive numbers.

Logarithms in the real world

  • pH: \( \text{pH} = -\log_{10}[\text{H}^+] \). A solution with \( [\text{H}^+] = 3.2 \times 10^{-4} \) mol/L has pH \( \approx 3.49 \).
  • Decibels: sound level \( = 10\log_{10}(I/I_0) \). Every 10 dB is ten times the intensity.
  • Earthquakes: each whole step on the magnitude scale is about 32 times more energy.
  • Growth and decay: the time to reach a target in exponential growth uses logs, see the half-life calculator.

The graph of a logarithm

For any base \( b > 1 \), \( y = \log_b x \) is defined only for \( x > 0 \), passes through \( (1, 0) \) and \( (b, 1) \), rises slowly without limit, and has a vertical asymptote at \( x = 0 \). It is the mirror image of \( y = b^x \) in the line \( y = x \), because logarithms and exponentials undo each other.

Common mistakes

  • Taking the log of zero or a negative number: it is undefined for real numbers.
  • Splitting \( \log(x + y) \) into \( \log x + \log y \).
  • Mixing up base 10 and base \( e \) on a calculator.

Practice problems

  1. \( \log_3 81 \)
  2. Write \( 2\log x + \log 5 \) as a single logarithm.
  3. Solve \( 5^x = 40 \).

Answers: 1. 4. 2. \( \log(5x^2) \). 3. \( x = \ln 40 / \ln 5 \approx 2.292 \).

Interpreting the Results

After using the logarithm calculator, you will see several pieces of information. The primary result is log_b x = y. This tells you the exponent 'y' needed to raise the base 'b' to get 'x'. For example, if log_5 25 = 2, it means 5 raised to the power of 2 equals 25.

The calculator also provides the equivalent exponential form, b^y = x. This restates the logarithm in a more familiar exponential format. It helps reinforce the definition of a logarithm. Always check this relationship to confirm your understanding of the output.

Furthermore, you'll see the change-of-base formula applied. This shows how the calculation was performed using natural logarithms (ln). This is useful for manual checks with a standard scientific calculator. It confirms the result and demonstrates a key logarithmic property.

When to Use a Different Approach

While this logarithm calculator is versatile, sometimes a mental calculation or a quick rule is faster. For instance, if you need log_b 1, the answer is always 0. This is because any base 'b' raised to the power of 0 equals 1. Therefore, using the calculator for such simple cases is often unnecessary.

Similarly, for log_b b, the result is always 1. This is because any base 'b' raised to the power of 1 equals itself. Recognizing these special values saves time. For complex expressions, however, the calculator provides accuracy and speed.

When solving equations with simple integer powers, direct calculation can be quicker. For example, if 2^x = 32, you might know x = 5 immediately. In contrast, for non-integer or irrational exponents, the logarithm calculator becomes indispensable.

Related guides

Further reading

FAQ

How do I calculate a log with a different base?

Use \( \log_b x = \frac{\ln x}{\ln b} \), or enter x and the base in the calculator.

What is the difference between log and ln?

ln is the logarithm with base \( e \approx 2.71828 \). log usually means base 10 in algebra courses.

What is log base 10 of 1000?

3, because \( 10^3 = 1000 \).

Can a logarithm be negative?

Yes. With a base greater than 1, the log of any number between 0 and 1 is negative, for example \( \log_{10} 0.01 = -2 \).

Embed this calculator on your website

Teachers, tutors and bloggers are welcome to use this calculator for free. Copy the code below and paste it into any page (in WordPress, use a "Custom HTML" block). The small script makes the calculator grow to fit its answer; if your site removes scripts, it still works at a fixed height. Please keep the credit link.

More calculators

See all calculators