CALCULATORCASTLE

Log Calculator

Calculate logarithms in any base, including natural log.

About

Log Calculator

The calculator takes any two of the three values in logbx = y and works out the third. Type e in the base box for a natural logarithm, and the result panel also gives the same value in base 10 and base 2 so you can read it whichever way you need.

What a logarithm is

A logarithm is the inverse of raising to a power. It answers one question: what exponent turns the base into this number? So the log of 100 to base 10 is 2, because 10 squared is 100.

x=byis the same asy=logb(x)

Reading it aloud helps: logbx is "the power you raise b to in order to get x". The base sits underneath the word log, and it is the number doing the growing. Everything else about logarithms follows from that one relationship, which is why the calculator can solve for any of the three from the other two.

Written without a base, log usually means base 10 in engineering and on calculator keys. When the base is e the notation is normally ln rather than loge, and log2 is called the binary logarithm and often written lg.

The three bases in common use

Base 10, the common logarithm, suits anything measured across orders of magnitude, because the whole-number part of the answer counts the digits. Science and engineering use it for that reason.

Base e, the natural logarithm, uses the constant e = 2.718281828459045. It looks arbitrary and is not: e is the base at which the exponential function is its own rate of change, so anything growing or decaying continuously produces natural logs whether you wanted them or not. Mathematics and physics default to it.

Base 2, the binary logarithm, counts halvings and doublings. Computer science uses it because a bit is a two-way choice, so log2 of the number of possibilities is the number of bits needed to tell them apart.

The three differ only by a constant multiplier, which is what the change-of-base rule below says. Nothing is lost by switching between them.

The log rules

When the argument is a product, the logarithm becomes a sum:

logb(x×y)=logb(x)+logb(y)

For example log(1 × 10) = log(1) + log(10) = 0 + 1 = 1.

When the argument is a fraction, it becomes a subtraction:

logb(x/y)=logb(x)logb(y)

So log(10 / 2) = log(10) − log(2) = 1 − 0.301 = 0.699.

An exponent inside the logarithm comes out as a multiplier:

logbxy=y×logb(x)

Which gives log(26) = 6 × log(2) = 6 × 0.30103 = 1.806.

Any logarithm can be rewritten in another base by dividing:

logb(x)=logk(x)logk(b)

So log10(x) = log2(x) / log2(10). This is the rule the calculator uses internally, working everything through natural logs, and it is what lets a calculator with only ln and log keys handle any base at all.

Swapping the base and the argument inverts the result:

logb(c)=1logc(b)

So log5(2) = 1 / log2(5). It falls straight out of the change-of-base rule.

Values worth knowing

logb(1)=0logb(b)=1ln(ex)=x

logb(1) is 0 for every base, because anything raised to the power 0 is 1. logb(b) is 1, since the base raised to the first power is itself. logb(0) is undefined, because no exponent brings a positive base down to zero, and as x approaches 0 the logarithm falls without limit towards minus infinity. Negative arguments have no real logarithm at all.

Those last two are why the calculator refuses a value of zero or below, and why it rejects a base of 1: one raised to any power is still one, so the equation could never reach anything else.

Why logarithms were invented

John Napier published the first table in 1614, and the motivation was purely practical. The product rule turns multiplication into addition, so multiplying two awkward numbers became a matter of looking up two logs, adding them, and looking the answer back up. Henry Briggs then reworked the idea onto base 10, which made the tables far easier to use.

For the next three and a half centuries this was how serious arithmetic got done. The slide rule is the product rule made physical: two logarithmic scales sliding past each other add lengths, and adding lengths multiplies the numbers. Engineers carried them until the pocket calculator arrived in the 1970s.

The tables are gone and the rules are not. Logarithms turned out to describe how a great deal of the world actually behaves.

Where log scales show up

Human senses respond to ratios rather than differences, so the scales built around them are logarithmic.

  • Decibels measure sound as 10 × log10 of a power ratio, so every 10 dB is ten times the power and roughly twice the perceived loudness.
  • pH is the negative base-10 log of hydrogen ion concentration, so pH 4 is ten times more acidic than pH 5.
  • Earthquake magnitude rises by one for every tenfold increase in wave amplitude, which is about 31.6 times the energy, so a magnitude 7 releases roughly a thousand times the energy of a magnitude 5.
  • Stellar magnitude keeps a system the Greeks started: five steps is a factor of 100 in brightness, so one step is the fifth root of 100, about 2.512.
  • Information is measured in bits, and a choice among n equally likely options carries log2(n) bits.

A logarithmic axis on a chart does the same job, turning a curve that doubles repeatedly into a straight line and making both small and large values readable at once.

Growth, halving and algorithms

Anything that grows by a fixed percentage takes a logarithm to answer "how long". At 7% a year, the time to double is ln(2) / ln(1.07), which is about 10.24 years. The familiar rule of 72 is a mental shortcut for exactly this calculation, since 72 / 7 gives 10.3.

Radioactive decay runs the same maths backwards, with half-life coming from ln(2) divided by the decay constant.

In computing, an algorithm that halves the problem each step takes log2(n) steps, which is why binary search on a million sorted items needs about 20 comparisons rather than a million. That is also why algorithms described as O(log n) barely slow down as the data grows: multiplying the input by a thousand adds about ten steps.

Mistakes worth avoiding

The commonest error is splitting a sum. log(x + y) is not log x + log y. The product rule applies to multiplication inside the logarithm, and there is no rule at all for addition. Check it with numbers: log(1 + 10) is about 1.041, while log(1) + log(10) is exactly 1.

The second is a negative or zero argument, which has no real answer. The third is confusing the base with the argument, since log2(8) = 3 while log8(2) = 0.333. The calculator puts the argument on top and the base underneath to keep them apart.

Reading your result

Check the base you typed. Entering e gives a natural logarithm, and leaving it as 10 gives a common one, which differ by a factor of about 2.303.

Use the sanity check the panel provides: raising the base to the answer should return your original value, and that line is printed under the result. If the answer is negative, your value was between 0 and 1, which is correct rather than an error, since a fraction needs a negative exponent.

For arithmetic in the other direction, the Exponent Calculator raises a base to a power, and the Scientific Calculator handles longer expressions with logs inside them.

Common questions

Frequently asked questions

It is the inverse of raising to a power, and it answers one question: what exponent turns the base into this number? Since 10 squared is 100, the log of 100 to base 10 is 2. Written as an equation, x = b to the power y means the same as y = log base b of x.

Written on its own, log usually means base 10. Written as ln, it means base e, where e is about 2.718281828459045. They differ only by a constant factor of about 2.303, so either can be converted into the other with the change-of-base rule.

Use the change-of-base rule: log base b of x equals ln(x) divided by ln(b). Any base works, and it is exactly what this calculator does internally, which is why a calculator with only ln and log keys can still handle base 7 or base 12.

Because no exponent brings a positive base down to zero or below. As the value approaches zero the logarithm falls towards minus infinity without ever arriving, and negative values have no real logarithm at all. The calculator rejects both.

No, and this is the commonest mistake with logarithms. The product rule applies to multiplication inside the log, not addition: log(x times y) equals log x plus log y. Check it with numbers, since log(1 + 10) is about 1.041 while log(1) + log(10) is exactly 1.

Because 1 raised to any power is still 1, so the equation could never produce any other value and no exponent would answer the question. Bases also have to be positive, which is why the calculator rejects zero and negative bases as well.

That the value is between 0 and 1. A fraction needs a negative exponent, so log base 10 of 0.01 is -2 because 10 to the power -2 is 0.01. It is a valid answer rather than an error.

In every scale built around ratios rather than differences: decibels for sound, pH for acidity, earthquake magnitude, and stellar brightness. They also answer how long something takes to double at a given growth rate, and they describe algorithms that halve the problem each step, such as binary search.