Logarithm Calculator
Solve log_b(x) = y for whichever of the number, base or logarithm you don't already know, with the natural log, common log and change-of-base working shown.
How to use this calculator
- 1Choose what you know: the number and base (to find the logarithm), the base and logarithm (to find the number — the antilog), or the number and logarithm (to find the base).
- 2Enter the two known values. Use 10 for the common log base, or 2.718281828 for the natural log base e.
- 3Check the verification line, which confirms the three values are consistent with each other.
How the calculation works
log_b(x) = ln(x) ÷ ln(b) Antilog: x = b^y Base: b = x^(1/y)- x
- The number to take the logarithm of — must be greater than 0
- b
- The base — must be positive and not equal to 1
- y
- The logarithm itself — the power b must be raised to, to reach x
This is the change-of-base formula. It works for any valid base because natural log (ln) is built into essentially every calculator and programming language, so any base can be reached through it rather than needing a separate routine per base.
log_b(x) answers "b raised to what power gives x?" — it is the inverse operation of exponentiation, the same way division inverts multiplication. Solving for x given b and y (the antilog) reverses that back into a plain exponentiation; solving for b given x and y takes a y-th root instead.
Worked example
log base 2 of 8
- 1.log₂(8) asks: 2 raised to what power gives 8?
- 2.2³ = 2 × 2 × 2 = 8, so the answer is 3.
- 3.Using the change-of-base formula as a check: ln(8) ÷ ln(2) = 2.079442 ÷ 0.693147 = 3.
Result: log₂(8) = 3
Antilog: x where log base 5 of x = 3
- 1.log₅(x) = 3 means 5 raised to the 3rd power gives x.
- 2.5³ = 5 × 5 × 5 = 125.
Result: x = 125
What a logarithm actually is
A logarithm answers a single question: a base raised to what power gives this number? log₂(8) = 3 because 2 has to be raised to the third power to reach 8. It is the mirror image of exponentiation in exactly the way subtraction mirrors addition, or division mirrors multiplication — each operation undoes the other.
Because of that relationship, a logarithm turns multiplication into addition: log(a × b) = log(a) + log(b). Before electronic calculators existed, that single identity was reason enough to build entire tables and instruments — including the slide rule — around logarithms, since adding two looked-up numbers is far easier by hand than multiplying two large ones directly.
Where logarithms turn up outside the classroom
Logarithms are the natural language for anything that spans many orders of magnitude, because they compress a huge range of values into a manageable scale.
- Earthquake magnitude — the Richter and moment magnitude scales are logarithmic, so each whole step up represents roughly ten times more ground movement, not a fixed increment.
- pH — a solution’s acidity is the negative base-10 logarithm of its hydrogen-ion concentration, which is why each pH unit represents a tenfold change in acidity.
- Sound and decibels — loudness in decibels is measured on a logarithmic scale because human hearing itself responds to sound intensity roughly logarithmically, not linearly.
- Information theory — a "bit" is, formally, a base-2 logarithm — the number of yes/no questions needed to pin down one option among many.
- Musical pitch — the frequency ratio between notes an octave apart is always 2:1, so pitches that sound evenly spaced to the ear actually rise exponentially in frequency.
A couple of things worth getting straight
"log" written with no base is usually shorthand for base 10 in everyday and engineering contexts, while "ln" always means the natural log, base e ≈ 2.71828. Confusingly, many programming languages reverse that convention — a function simply called log() is often the natural log, not the common log — so it is worth checking the documentation of whatever tool you are using.
A logarithm is only defined for a positive number: there is no power you can raise a positive base to that produces zero or a negative result, which is why log(0) and the log of a negative number have no real answer. It is an easy detail to forget partway through manipulating an equation, silently introducing a step that only holds for a positive value.
A shortcut invented for astronomers
Logarithms were introduced in 1614 by the Scottish mathematician John Napier, who published the first tables specifically to save astronomers and navigators from the tedium and error of multiplying large numbers by hand. His tables let a difficult multiplication be replaced with a much easier addition, looked up in a book — a trick that mattered enormously in an era with no mechanical calculators at all.
That same idea, mapped onto a physical ruler, became the slide rule — the standard engineering calculating tool for over three centuries, right up until electronic calculators made it obsolete in the 1970s. The underlying mathematics never went away; it simply moved from printed tables and sliding rulers into the algorithm this calculator runs instantly.
What this assumes, and where it stops
Assumptions
- x and the base are real numbers — this does not compute logarithms of negative numbers or zero, which require complex results.
Limitations
- Only real-valued results are returned. For a non-positive number or an invalid base, a CalcError explains why rather than returning a complex number.
- Results lose precision beyond about 15 significant figures, the limit of standard double-precision floating point — the same limit every calculator built on JavaScript or a typical scientific calculator shares.
Common questions
What does log base b of x mean?
It is the exponent b must be raised to in order to produce x. log₂(8) = 3 because 2 raised to the third power equals 8 — a logarithm and an exponent describe the same relationship from opposite directions.
What is the difference between log and ln?
"log" with no base written usually means base 10 (the common log) in everyday and engineering contexts, while "ln" always means base e ≈ 2.71828 (the natural log). Programming languages often reverse the everyday convention: Math.log() in JavaScript means natural log, not common log.
Why can the base not be 1?
1 raised to any power is always 1, so "1 to what power gives x" has no answer unless x is already 1, and infinitely many answers if it is. The base is excluded from being 1 for the same reason zero is excluded from division.
What is an antilog?
The reverse of taking a logarithm: given a base and a logarithm value y, the antilog is the number x that produces it, found as x = base^y. If log₅(x) = 3, the antilog tells you x = 5³ = 125. Select "The number x" under Solve for to compute it directly.
Sources
- Logarithm — Wolfram MathWorld
Formula and content last reviewed on .
Results are estimates for information only, not professional advice.
Related calculators
Tools people commonly use alongside the logarithm calculator.