Tools · Math & Statistics

Logarithm Calculator

logb(x) = y, solved for whichever part you are missing — any base, not just 10 and e. The common, binary and natural logarithms of your number come back on every calculation, because those three are what most questions are really asking for.

Any base, via change of baseHow it worksInputs stay on this device
Your inputs

Fill any two

The one you pick becomes the answer; the other two become the inputs.

The number being raised to a power. 10, 2 and 2.718281828 (e) are the common ones; any positive number except 1 works.

The number you are taking the logarithm of. It must be greater than zero.

Your inputs are calculated locally and are not stored.
Logarithm10

log₂(1024) = 102 to the power 10 is 1,024. In the three bases every computer has built in, that value is 3.010299957 (base 10), 10 (base 2) and 6.931471806 (natural).

Equation
log₂(1024) = 10
Common log (log₁₀)
3.010299957
Binary log (log₂)
10
Natural log (ln)
6.931471806
Formula & methodology

A logarithm is an exponent, rearranged three ways

logb(x) is the power b must be raised to in order to reach x. That is the whole definition, and every question this page answers is that one sentence solved for a different letter.

log_b(x) = y ⟺ bʸ = x  •  y = ln x ÷ ln b  •  b = x1/y
b
The base — positive, and never 1
x
The value, which must be greater than zero
y
The logarithm itself: the exponent

Why change of base

Processors and standard libraries implement exactly three logarithms — natural, base 10 and base 2. There is no log₇ instruction anywhere. Every other base is reached with the change-of-base identity, logb(x) = ln x ÷ ln b, which follows directly from the definition: write x as bʸ, take the natural log of both sides to get ln x = y × ln b, and divide. The identity is exact. The only error is in the two logarithms feeding it, which is why log₇(343) arrives as 3.0000000000000004 before rounding and as 3 after.

What multiplication becomes

The property that made logarithms worth inventing is that they turn multiplication into addition: log(ab) = log(a) + log(b). A product of two awkward numbers becomes a sum of two table lookups. That is precisely what a slide rule does — the scales are printed logarithmically, so sliding one along the other adds two lengths and reads back a product. Napier published the first tables in 1614 and Briggs recast them into base 10 shortly after, and for the next three and a half centuries this was how astronomers, navigators and engineers multiplied.

What a log scale on a chart means

The same property is why a logarithmic axis behaves the way it does. On a linear axis equal distances are equal differences; on a log axis equal distances are equal ratios. One inch might mean plus ten on the first and times ten on the second. So a quantity multiplying by a constant factor each period draws a straight line, and its slope is the growth rate — which is exactly why epidemic curves and adoption charts are drawn on log axes. Read them carefully: the same visual slope means the same percentage growth, not the same number of new cases.

Worked example

log₂(1024), and the same equation twice

Ask for the logarithm of 1024 in base 2. Doubling from 1 gives 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024 — ten doublings, so the answer is 10. Read the other way, 2¹⁰ = 1024, which is why a ten-bit number counts up to 1023 and a kilobyte was 1024 bytes.

The calculator does not count doublings; it uses change of base. ln(1024) = 6.931471806 and ln(2) = 0.6931471806, and one divided by the other is exactly 10 — the natural log of 1024 is precisely ten times the natural log of 2, because 1024 is precisely 2 multiplied by itself ten times.

Now turn the equation around without changing the numbers. Ask for the value instead, from base 2 and logarithm 10, and you get 1024 back. Ask for the base, from value 1024 and logarithm 10, and it solves 10241/10 = 2 — a tenth root, because rearranging a logarithm for its base is a root rather than a division. Three questions, one equation, and the three answers agree by construction.

Alongside all of that, the same 1024 in the three standard bases: 3.010299957 in base 10, 10 in base 2, and 6.931471806 natural. The first says 1024 is a little over three orders of magnitude; the second says it takes ten bits.

Assumptions

What this calculator assumes

  • Real logarithms only. The value must be greater than zero and the base must be positive and not 1. Logarithms of negative numbers exist in the complex plane and are out of scope here.
  • Change of base, not a per-base algorithm. Every base other than e, 10 and 2 is computed as ln x ÷ ln b. The identity is exact; the rounding is inherited from the two natural logs, and lands past the tenth decimal place.
  • Solving for the base needs a non-zero logarithm. b⁰ = 1 for every base, so if the value is 1 every base works and if it is anything else none does. The calculator says so instead of guessing.
  • Bounds that keep the answer meaningful. Bases run from a billionth to a billion, logarithms from −1000 to 1000, and values across the full range a double can hold. A base a whisker above 1 needs an exponent in the billions to reach anything, and that combination is refused rather than rounded.
  • Ten decimal places on a logarithm. A logarithm stays small however astronomical its argument is, so a fixed number of decimals is safe. The value itself is kept to twelve significant figures, because that one can span three hundred orders of magnitude.
Common questions

Logarithm FAQ

What does log base 2 of 1024 = 10 actually mean?

It means 2 has to be multiplied by itself 10 times to reach 1024 — 2¹⁰ = 1024. A logarithm is an exponent, and nothing more: it answers the question how many times do I multiply this base by itself to get that number. Read the equation right to left and it turns into an ordinary power, which is why this calculator will solve it in either direction.

How do I work out log base 7 on a calculator that only has log and ln?

Divide. log₇(343) = ln(343) ÷ ln(7) = 5.83773 ÷ 1.94591 = 3. That is the change-of-base formula, and it works with any logarithm on the bottom as long as you use the same one on top: log(343) ÷ log(7) gives 3 as well. The reason it works falls straight out of the definition — if 7ʸ = 343, then taking ln of both sides gives y × ln 7 = ln 343, and you divide. Hardware only ever implements base e, base 10 and base 2; every other base you have ever seen was computed this way.

Why is there no logarithm of zero or a negative number?

Because a positive base raised to any real power is positive. There is no exponent that takes 2 down to zero — 2⁻¹⁰ is 0.0009765625, 2⁻¹⁰⁰ is smaller still, and the sequence approaches zero without ever arriving. So log(0) is not a very large negative number, it is undefined, though the limit runs to −∞. Negative numbers are worse: no real exponent turns a positive base negative at all, which is why the calculator refuses both rather than returning something misleading.

What does a straight line on a log-scale chart actually mean?

Exponential growth at a constant rate. On a linear axis, equal distances are equal differences — the gap from 10 to 20 is the same as from 1010 to 1020. On a log axis, equal distances are equal ratios: the gap from 1 to 10 is the same as from 10 to 100 and from 100 to 1000, because each is a tenfold step. So a quantity that multiplies by a fixed factor each period plots as a straight line, and the slope of that line is the growth rate. It is also why a log chart flatters a decelerating series and makes a doubling every three days look identical whether it starts at ten cases or ten thousand.

Why is base e called natural?

Because it is the base at which the exponential function is its own derivative. Differentiate bˣ and you get bˣ × ln(b) — there is a stray constant in front for every base except one. That constant is 1 exactly when b = e = 2.718281828, so the rate at which eˣ grows equals its own height at every point. Anything that grows or decays in proportion to how much of it there is — compound interest paid continuously, radioactive decay, a cooling cup of coffee — is written in base e for that reason, and no other base makes the calculus come out clean.

What is log base 2 used for?

Counting halvings and doublings. log₂ of a number is how many times you can double from 1 to reach it, which makes it the natural unit for anything binary: log₂(1024) = 10 says a value from 0 to 1023 needs 10 bits, and it is also the number of steps a binary search takes through a thousand-item list. In information theory a fair coin flip carries exactly one bit — log₂(2) — of information. Music uses the same idea with a different name: an octave is a doubling of frequency, so log₂ of a frequency ratio counts octaves.

Why can the base not be 1?

Because every power of 1 is 1. Ask what exponent takes 1 to 1000 and there is no answer; ask what exponent takes 1 to 1, and every number at once is an answer. Neither case names a single exponent, so log base 1 is undefined. The change-of-base formula shows the same failure arithmetically: it would divide by ln(1), which is zero.

Primary sources

Sources and review notes

  1. NIST Digital Library of Mathematical Functions §4.2 — the definitions and identities of the logarithmic function, including change of base
  2. ISO 80000-2:2019, Quantities and units — Part 2: Mathematics — the notation conventions for ln, lg and lb used on this page

The identities here are definitional and have nothing behind them to go stale. What can go wrong is the arithmetic, so the engine is a pure function under unit test — including the two cases that have no answer at all: a base of 1, and solving for a base from a logarithm of zero.