Skip to content
Calculator Collection

Logarithm Calculator

Compute the logarithm of a number to any base using log_b(x) = ln(x) / ln(b). Answers 'what power must the base be raised to in order to get this number?'

Last updated: May 2026

Fill in the required fields to see your result.

Compare with similar

About this calculator

A logarithm answers the question: to what power must a base be raised to produce a given number? Formally, log_b(x) = y means b^y = x. This calculator computes the logarithm of a number x to any base b using the change-of-base formula, log_b(x) = ln(x) / ln(b), where ln is the natural logarithm (base e). The change-of-base formula lets a single natural-log function compute logarithms in any base by dividing two natural logs. Common bases include 10 (the 'common logarithm', written log), e ≈ 2.71828 (the 'natural logarithm', written ln), and 2 (used heavily in computer science). Logarithms turn multiplication into addition and exponentiation into multiplication, which is why they historically simplified hard calculations and why they underpin slide rules, decibels, the Richter scale, and pH. They are the inverse of exponentiation: if exponentials describe rapid growth, logarithms describe how long that growth takes or how many digits a number has. Edge cases are important: the logarithm is only defined for positive numbers x > 0 — you cannot take the log of zero (it tends to negative infinity) or of a negative number (which gives a complex result). The base must be positive and not equal to 1. log_b(1) = 0 for any base, because anything raised to the power 0 is 1, and log_b(b) = 1, because the base to the first power is itself.

How to use

Example 1 — log base 10 of 1000. Enter Number = 1000, Base = 10. log₁₀(1000) = ln(1000) / ln(10) = 6.9078 / 2.3026 = 3. Verify: 10³ = 1000, so the answer must be 3 — the power of 10 that gives 1000. Example 2 — log base 2 of 8. Enter Number = 8, Base = 2. log₂(8) = ln(8) / ln(2) = 2.0794 / 0.6931 = 3. Verify: 2³ = 8, so again the answer is 3 — the number of times you multiply 2 by itself to reach 8.

Frequently asked questions

What is the change-of-base formula and why is it used?

The change-of-base formula states that log_b(x) = log_k(x) / log_k(b) for any valid base k, and it lets you compute a logarithm in any base using a base your tools already support. This calculator uses the natural logarithm (base e), so log_b(x) = ln(x) / ln(b). It is needed because most calculators and programming languages provide only natural log (ln) and common log (base 10) directly, not arbitrary bases. By dividing two logs you can find a log in base 2, base 7, or any base you like. The formula works with any common base in the denominator and numerator, as long as both use the same one.

What is the difference between log, ln, and log base 2?

They are all logarithms, differing only in their base. 'log' usually means the common logarithm, base 10, widely used in science and engineering for quantities spanning many orders of magnitude. 'ln' is the natural logarithm, base e ≈ 2.718, which arises naturally in calculus, growth, and decay problems. Log base 2 is the binary logarithm, central to computer science because it counts how many times you can halve a quantity or how many bits represent a number. This calculator lets you choose any base, so you can compute all three. The choice of base depends entirely on the context of your problem.

Why can't I take the logarithm of zero or a negative number?

Logarithms are only defined for positive numbers. The log of zero is undefined because no finite power of a positive base equals zero — as the input approaches zero, the logarithm heads toward negative infinity. The log of a negative number is undefined in the real numbers because a positive base raised to any real power is always positive, so it can never produce a negative result. Negative inputs do have complex logarithms, but those are outside the scope of a real-valued calculator. If you enter zero or a negative number, the result is not a valid real logarithm. Always ensure your input is greater than zero.

What are logarithms actually used for?

Logarithms appear wherever quantities span a huge range or grow exponentially. They define logarithmic scales like the Richter scale for earthquakes, decibels for sound, and pH for acidity, each of which compresses enormous ranges into manageable numbers. In computing, base-2 logarithms measure information (bits) and the efficiency of algorithms like binary search. In finance and biology, logarithms describe compound growth and decay. They also convert multiplicative relationships into additive ones, which simplifies analysis and is the basis of log-scale graphs. Understanding logarithms is essential across science, engineering, and data analysis.

When should I NOT use this calculator?

Do not use it for non-positive inputs, since the logarithm of zero or a negative number is undefined in real numbers — you would need complex analysis for negatives. Ensure the base is positive and not equal to 1, because base 1 makes the logarithm undefined (1 to any power is always 1). It computes a single logarithm, so it is not the tool for solving full logarithmic or exponential equations, which may require additional algebra. If you need the antilogarithm (the inverse operation), use an exponent calculator instead. And remember the result is generally irrational, so the displayed value is rounded.

Sources & references