Log Calculator

A three-way solver for logₘ(x) = y. Give it any two of the number, the base and the logarithm, and it finds the third — with the working shown each time.

log Just enter your values below — results update automatically.
Any two of three

Fill in two boxes and leave the third empty. The empty one is the one that gets answered — the logarithm, the number, or the base.

logₘ(x) =
Answer
—
Leave one box empty and it gets filled in
The working, step by step
The same number in the three common bases

Reading the three boxes

A logarithm ties three numbers together: a base, a number, and the power that takes one to the other. Written out, logb(x) = y says that by = x. Fill in any two of the three boxes above, leave the third empty, and the empty one gets answered.

  • Base and number → the logarithm. The usual direction: what power of 2 gives 1,024?
  • Base and logarithm → the number. This is an antilog, and it is just raising the base to that power.
  • Number and logarithm → the base. Which base, raised to 3, gives 125?

Typing e into the base box gives Euler’s number at full precision, which is what you want for a natural logarithm — keying in 2.718281828 by hand costs you accuracy several digits before the answer ends. The three shortcut buttons cover the bases that come up in practice.

What a logarithm actually asks

The question a logarithm asks is always the same one: how many times do I multiply the base by itself to land on this number? Everything else follows from that.

log₂(8) = 3 because 2 × 2 × 2 = 8 log₁₀(1000) = 3 because 10 × 10 × 10 = 1000 log₂(1024) = 10 because ten doublings take 1 to 1024

Once the answer stops being a whole number the same question still holds, it just has a fractional answer. log2(100) is 6.6438561897747, which says that a hundred sits between the sixth doubling (64) and the seventh (128), closer to the seventh.

That is also why logarithms turn multiplication into addition. Doubling twice then doubling three more times is the same as doubling five times, so the logs add. Before calculators this was the entire point: slide rules and log tables existed so that engineers could multiply large numbers by adding instead.

The three bases worth knowing

Any positive number except 1 can be a base, but three of them do almost all the work, and each belongs to a different trade.

BaseWrittenUsed for
10log, log₁₀Anything measured across orders of magnitude — decibels, pH, earthquake scales
e ≈ 2.71828lnGrowth and decay that happens continuously — interest, populations, radioactivity
2log₂, lbAnything that halves or doubles — algorithms, information, music intervals

The notation trips people up more than the maths does. A bare log means base 10 in most engineering and school contexts, base e in a lot of pure mathematics, and base 2 in some computer science papers. When it matters, write the base.

ln always means base e, and it has no competing reading. It is called the natural logarithm because e is the base at which the exponential curve grows at exactly its own height, which makes every formula built on it come out without stray constants.

The log rules, and when each one saves you

Four rules cover nearly everything here. Rather than memorise them, put the small cases into the boxes above and watch each one hold.

RuleIn symbolsChecked
A product becomes a sumlog(x × y) = log x + log ylog₁₀(1000) = log₁₀(8) + log₁₀(125) = 3
A quotient becomes a differencelog(x ÷ y) = log x − log ylog₂(8) = log₂(32) − log₂(4) = 3
An exponent comes out frontlog(xⁿ) = n × log xlog₁₀(1024) = 10 × log₁₀(2) = 3.0103
Swapping base and number flips itlogb(c) = 1 ÷ logc(b)log₅(2) = 1 ÷ log₂(5) = 0.430677

The third rule is the one that earns its keep. Solving 1.07t = 2 for t looks hard until you take the log of both sides, at which point the t drops out front and the problem becomes a division. That single move is how every compound-interest, half-life and population question gets solved.

Two small facts finish the set: logb(1) = 0 for every base, because anything to the power 0 is 1; and logb(b) = 1, because a base to the first power is itself.

Change of base, the rule that makes any base possible

Most physical calculators have two logarithm keys, log and ln, and no way to ask for base 7. The change-of-base rule removes the problem entirely:

logₖ(x) = logₖ(x) ÷ logₖ(b) for any base k you like EX: log₇(50) = ln(50) ÷ ln(7) = 3.9120230054281 ÷ 1.9459101490553 = 2.0103821378019 check: 7²·⁰¹⁰³ = 50

It does not matter which base you divide through — natural logs and base-10 logs give the same answer to the last digit that can be trusted, because the ratio cancels the choice out. This page uses natural logs internally for exactly that reason, and shows the division in the working so you can reproduce it on any calculator.

Why log of zero and of a negative are undefined

Ask what power of 10 gives 0 and there is no answer. 10-1 is 0.1, 10-10 is a ten-billionth, 10-100 is smaller still — the values keep shrinking and never arrive. The logarithm does not fail at zero so much as run away from it: as the number approaches 0 the logarithm falls without limit.

A negative number is a flatter refusal. A positive base raised to any real power is positive, so nothing you can put in the exponent will produce a negative result. There is an answer in complex numbers, where logarithms of negatives are perfectly ordinary, but it is not a real number and this calculator says so rather than returning a code.

The base has its own two exclusions. A base of 1 is useless because 1 to any power is 1, so it can never reach a different number — there is nothing to solve. Zero and negative bases are excluded for the same reason negative bases break fractional exponents: the function stops being defined continuously.

Where logarithms show up outside a maths class

Logarithms are the standard way to handle quantities that span too many orders of magnitude to plot or discuss on a straight scale.

  • Decibels. Sound power is compressed with 10 × log₁₀. A thousandfold increase in power is 30 dB; merely doubling it is 3.01 dB, which is why a second identical speaker sounds only slightly louder rather than twice as loud.
  • pH. Acidity is the negative base-10 logarithm of hydrogen-ion concentration. A concentration of 10−8 is pH 8, and each whole step on the scale is a tenfold change in concentration.
  • Earthquake magnitude. One step on the Richter scale is ten times the ground amplitude and about 31.6 times the energy, which is 101.5. A magnitude 7 is not slightly worse than a magnitude 6.
  • Doubling time. Money at 7% a year doubles in ln(2) ÷ ln(1.07) = 10.24 years. The familiar rule of 72 gives 10.29, and now you can see where that shortcut comes from.
  • Algorithms. Binary search on a million items takes log₂(1,000,000) = 19.93 steps, so twenty comparisons. Doubling the data adds exactly one step.
  • Radioactive dating. Carbon-14 has a half-life of 5,730 years, so a sample with an eighth of its original carbon-14 has been through three half-lives — 17,190 years.

For the growth and decay cases specifically, the half-life calculator and the compound interest calculator do the whole job rather than leaving you to take the logarithm yourself.

Exact answers for clean powers

There is a rounding trap in every logarithm calculator and it is worth knowing about. A computer works out logb(x) by dividing one natural logarithm by another, and that division does not always land on the whole number it should:

log₁₀(1000) by division = 2.9999999999999996 log₅(125) by division = 3.0000000000000004 log₃(6561) by division = 8.000000000000002 log₉(59049) by division = 4.999999999999999

All four should be whole numbers. Printing 2.9999999999999996 instead of 3 is a common and avoidable bug. This page checks whether the nearest whole number genuinely reproduces the original number before showing it, using exact integer arithmetic where the base and the answer are both whole, so a clean power comes back clean.

An irrational answer — log2(100), say — has no exact decimal at all, so it stops at 14 figures, the point where double-precision arithmetic runs out of certainty. Reading the same relationship forwards instead of backwards is what the exponent calculator does.

Frequently asked questions

What is the difference between log and ln?

ln always means base e, roughly 2.71828. A bare log usually means base 10 in engineering and at school, but means base e in much of pure mathematics and base 2 in some computer science. When the base matters, write it explicitly rather than relying on the convention.

How do I calculate a log with a base my calculator does not have?

Use the change-of-base rule: log base b of x equals ln(x) divided by ln(b). Any base works as the intermediate, so log or ln both give the same answer. For log base 7 of 50 that is 3.9120230054281 divided by 1.9459101490553, which is 2.0103821378019.

Why is the log of a negative number undefined?

Because a positive base raised to any real power stays positive, so no exponent can produce a negative result. Logarithms of negative numbers do exist in complex numbers, but they are not real values and this calculator works in real numbers only.

Can the base be a fraction?

Yes. Any positive number except 1 works as a base, fractions included. A base below 1 flips the sign of the answer, because raising a fraction to a positive power makes it smaller: log base 0.5 of 100 is -6.6438561897747.

What does it mean to solve for the base?

Leaving the base box empty asks which base, raised to your logarithm, gives your number. That is a root rather than a logarithm: the base equals the number raised to the power 1 divided by the logarithm. Number 125 with logarithm 3 gives base 5, because 5 cubed is 125.

Why do some calculators show 2.9999999999999996 instead of 3?

Because the logarithm is computed as one natural log divided by another, and that division does not always land exactly on the whole number. This page checks whether rounding to the nearest whole number genuinely reproduces your original number before printing it, so clean powers come back clean.

Everything here is worked out on your own device; no value you type leaves it. Irrational answers stop at 14 figures, and any whole-number answer is confirmed with exact integer arithmetic before it appears.

Related calculators