← Home

🧮 Log Calculator

Compute logarithms with any base. Enter a number and a base to get logₙ(x), plus the natural log ln and common log log₁₀ for convenience.

What is this tool?

A logarithm answers the question "to what power must I raise the base to get this number?" For example, the base-10 logarithm of 1000 is 3, because 10 raised to the power of 3 equals 1000. Logarithms are the inverse of exponentials and appear everywhere in science and engineering — from the decibel scale of sound, to the pH scale of acidity, to the magnitude scale of earthquakes, all of which are logarithmic by design. This log calculator lets you choose any base you like. Enter a positive number and a base (the base must also be positive and not equal to 1), and the tool returns the logarithm. For convenience it also displays the natural logarithm ln(x) (base e ≈ 2.71828) and the common logarithm log₁₀(x), since those two are by far the most frequently used in textbooks and real-world formulas. Everything is computed locally in your browser with no server involved, so your inputs are private. The calculator guards against invalid inputs: it will not let you take the log of zero or a negative number, and it rejects a base of 1, which would make the logarithm undefined.

How it works

The calculator uses the change-of-base formula, which says that logₙ(x) = ln(x) / ln(b). In other words, any logarithm can be expressed in terms of the natural logarithm, so a single precise ln function is enough to evaluate logarithms of any base. JavaScript provides the natural logarithm through Math.log, and the common log (base 10) through Math.log10, both of which are accurate to about 15 significant figures. Input validation happens before any math runs. The number x must be strictly greater than zero, because the logarithm of zero is undefined and the logarithm of a negative number is a complex value that this tool does not handle. The base b must also be positive and cannot equal 1, since 1 raised to any power is always 1 and therefore never reaches any other number. When the inputs are valid, the three results are computed and rounded for clean display.
Ad

How to use

  1. Enter the number x you want to take the logarithm of (must be positive).
  2. Enter the base b (any positive number except 1).
  3. Press the Calculate button.
  4. Read logₙ(x), plus the natural log ln(x) and common log log₁₀(x).
  5. Change either value to recalculate instantly.

Frequently Asked Questions

Frequently Asked Questions

Why must the number be positive?
The logarithm is only defined for positive real numbers. Raising any positive base to a real power can never produce zero or a negative result, so there is no real exponent that would give a non-positive number. The calculator will warn you if you enter zero or a negative value.

What are the natural log and common log?
The natural logarithm, written ln(x), uses the base e (approximately 2.71828) and appears throughout calculus and continuous-growth formulas. The common logarithm, written log₁₀(x), uses base 10 and is the basis of the decibel and pH scales. They are shown automatically for your convenience.

Why can the base not be 1?
Because 1 raised to any power is always 1, it can never equal any other number. That means there is no exponent that solves 1^y = x when x is not 1, so the base-1 logarithm is undefined and the calculator rejects it.

How accurate are the results?
Very accurate. The calculator uses JavaScript’s built-in natural logarithm function, which is precise to about 15 significant figures. For textbook problems and real-world science this is more than enough; the displayed result is simply rounded to a readable number of decimals.

Tips & Advice

Remember that logarithms turn multiplication into addition: log(a × b) = log(a) + log(b), which is why logarithms were originally invented — to simplify huge calculations by hand. When the base is not specified in a problem, science and engineering usually mean base 10 (log), while pure mathematics and calculus almost always mean the natural log (ln); the tool shows both so you never have to guess. Logarithms grow very slowly, so log₁₀(1 000 000) is only 6 even though the number is huge — keep this slow growth in mind when interpreting results. A negative logarithm simply means the original number is less than 1 (a fraction), not that anything is wrong. If you work with acids and bases, the pH is just the negative of the base-10 log of the hydrogen ion concentration, so this calculator can double as a quick pH helper.

Related Tools

Ad