Logarithm Calculator

A logarithm answers one question: what exponent turns the base into the number? Fill any two of the three boxes below and the third one appears, with the power written back out so you watch the answer check itself.

Logarithm tool

Logarithm2
102 = 100

Has to stay above zero. Real logarithms of zero and negatives do not exist.

The exponent. Negative values belong here too, they point at numbers below one.

Where your number sits on a base 10 ruler. Each step to the right multiplies by ten, so equal gaps hold equal ratios rather than equal amounts.
ln (base e)4.60517
log₂ (base 2)6.643856
log₁₀ (base 10)2
Log of the reciprocal-2

Periods to reach a target

Steady growth is the everyday reason to reach for a logarithm. Divide the log of the ratio by the log of one growth step and out comes the number of periods.

%

10.24 periods, so 11 whole ones before the target is passed.

Rule of 72 estimate for a doubling at this rate: 10.29 periods, against 10.24 from the logarithm.

Digits, bits and hex width

Counting how wide a number prints or stores is a logarithm with a floor function bolted on. Enter a count of distinct values to size a field for them.

  • Decimal digits7
  • Bits to store the value20
  • Bits to label this many items20
  • Hex characters5

Solving for the logarithm from the base and number you typed.

A logarithm is division for exponents

Multiplication asks how many copies of one number fit inside another. A logarithm asks the same question about repeated multiplication. How many times do you multiply by 2 to get from 1 to 1024? Ten times, so log₂(1024) is 10. Every logarithm problem reduces to counting steps of this kind, and the answer is allowed to be fractional because a partial step is still a defined amount of multiplying.

Three pieces are always in play: a base, a number and an exponent. Write the exponential form and the logarithmic form side by side and you see the identical information, rearranged.

Exponential formby = x
Logarithmic formlogb(x) = y

The three modes at the top of the page match the three ways to be stuck. You know the base and the number and want the exponent. You know the base and the exponent and want the number, an operation older textbooks call the antilogarithm. Or you know the number and the exponent and want the base, which is a root wearing different clothes.

Picking the base you need

Four bases cover almost everything anyone types into a log calculator, and each earns its place in a different field.

BaseWritten asTurns up inOne step means
10log or log₁₀pH, decibels, Richter, order-of-magnitude estimatesTen times bigger
e (2.71828…)lnContinuous growth, half-lives, calculus, statisticsOne time constant of growth
2lg or log₂Binary sizing, search trees, information entropy, audio octavesTwice as big
16log₁₆Hex field widths, colour codes, memory addressingOne hex character wider

Base e looks arbitrary next to the round numbers, and it draws the most questions. It wins wherever growth is continuous rather than stepwise. Money compounding every instant, a population breeding year round, a hot mug shedding heat every moment. Write any of those with base e and you get a rate constant you differentiate without dragging a conversion factor along.

Change of base, and why one calculator covers every base

Hardware and language runtimes ship two logarithms, natural and base 10. Everything else comes out of one identity.

logb(x) = ln(x) / ln(b) = log10(x) / log10(b)

Both divisions land on the same answer, and this page runs the natural log version. To get log₂(1000) by hand, take ln(1000) = 6.907755 and divide by ln(2) = 0.693147, giving 9.965784. The reading is direct: 1000 sits a hair under ten doublings above 1, which lines up with 210 = 1024 sitting a hair above 1000. Memorising a table of logs for every base was the old alternative, and this identity is why nobody has needed one since.

The five rules worth keeping in your head

Logarithms convert each operation into the one below it. Multiplication becomes addition, division becomes subtraction, powers become multiplication. Slide rules ran on the first line of this table for three centuries.

RuleStatementWorked example
Productlog(xy) = log(x) + log(y)log₂(8 × 4) = 3 + 2 = 5
Quotientlog(x/y) = log(x) − log(y)log₁₀(1000/10) = 3 − 1 = 2
Powerlog(xn) = n × log(x)log₁₀(100³) = 3 × 2 = 6
Rootlog(ⁿ√x) = log(x) / nlog₂(√64) = 6 / 2 = 3
Reciprocallog(1/x) = −log(x)log₁₀(0.01) = −2

Two constants fall out of the definition and catch people during checks. logb(1) is always 0, because raising anything to the zero power gives 1. And logb(b) is always 1. A result contradicting either one means the base and the number went into the wrong boxes.

Scales built on logarithms compress ranges no linear axis survives

Sound pressure between a whisper and a jet engine spans a factor near a trillion. Plot it linearly and the whisper disappears. Take a log first and the whole range fits in three inches of paper, which is why so many physical measurements arrive already logarithmic.

ScaleDefinitionA step of 1 unit
pH−log₁₀[H⁺]Ten times the hydrogen ion concentration
Decibels (power)10 × log₁₀(P/P₀)About 1.26 times the power
Richterlog₁₀ of wave amplitudeTen times the shaking, near 31.6 times the energy
Stellar magnitude−2.5 × log₁₀ of brightnessRoughly 2.512 times dimmer as the number rises
Musical octavelog₂ of the frequency ratioDouble the frequency

Notice the sign on pH and magnitude. Both carry a minus in front, so the friendlier number belongs to the larger quantity. A pH of 3 beats a pH of 6 for acidity by a factor of a thousand, and a magnitude 1 star outshines a magnitude 6 one.

Reading the growth panel

Take a balance of 1000 growing 7 percent a year and ask when it reaches 2000. The ratio is 2, one growth step is 1.07, and ln(2) divided by ln(1.07) gives 10.24 years. Compounding lands once a year, so the balance falls short at year 10 and clears the target at year 11. The panel reports both readings for this reason.

The rule of 72 shortcut divides 72 by the percentage rate and gets 10.29 here, close enough for mental arithmetic. It drifts once rates climb. At 25 percent the rule says 2.88 periods and the logarithm says 3.11, an error near 8 percent. Below roughly 15 percent the shortcut holds up fine.

Where this calculator stops

Being clear about the edges keeps you from trusting a number the page was never built to produce.

  • Zero and negative numbers return nothing. No real exponent turns a positive base into a negative result, and the value falls toward negative infinity as the input approaches zero. Complex logarithms handle those inputs and sit outside this page.
  • Base 1 is rejected. 1 raised to any power stays 1, so the change of base formula divides by zero. Negative bases are refused for a related reason.
  • Precision runs out around 15 significant figures. The browser works in double precision floats, so asking for 10 decimals on a huge input prints digits the format cannot back up. Number theory and cryptographic work want an arbitrary precision library instead.
  • Answers you expect to be whole sometimes are not. log₂(8) is exactly 3 on paper and frequently 2.9999999999999996 in floating point. Round the display before comparing two results for equality.
  • Inputs above 1e308 overflow. Past that limit JavaScript reads infinity. Split the number into a mantissa and a power of ten, take the log of each part, then add them.

Checking an answer in five seconds

Every result carries its own proof, which is why the exponential form sits beside the readout. Raise the base to the answer and the number should come back. Beyond that, bracket the result against powers you already know. log₂(1000) has to land between 9 and 10, since 2⁹ is 512 and 2¹⁰ is 1024. A number smaller than the base always gives a logarithm under 1, and a number below 1 always gives a negative one. Those three checks catch nearly every mis-typed base.

Logarithm questions people hit mid-problem

Bases, negative inputs, the change of base identity and the floating point quirks behind odd-looking results.

What is a logarithm in plain terms?

It is the exponent a base needs to reach a number. Log base 10 of 1000 is 3, because 10 multiplied by itself three times gives 1000. Switch the mode to solve for the number and the page runs the same relationship backwards.

What is the difference between log and ln?

Log with no base written means base 10 in most calculators and engineering work, though pure maths papers sometimes use it for base e. Ln always means base e, near 2.71828. Both sit as buttons above the base box, so nothing is left to guess.

Why do negative numbers give no answer?

A positive base raised to a real exponent is always positive, so no real solution exists. Values below one give a negative logarithm, a different situation the calculator handles normally. Log base 10 of 0.001 is -3.

How do I work out a log in a base my calculator lacks?

Divide the natural log of the number by the natural log of the base. For log base 7 of 343, take ln(343) = 5.83773 and divide by ln(7) = 1.94591 to get exactly 3. Base 10 logs work in the same identity.

What is an antilog?

The reverse operation, the base raised to a power. The antilog base 10 of 2.5 is 316.23. Pick the solve for the number mode, enter the base and the exponent, and the answer appears in the readout.

Why does log base 2 of 8 show as 2.9999999999999996?

Double precision arithmetic stores neither ln(8) nor ln(2) exactly, so the division lands a hair short. The page rounds the display to hide it. In code, round before testing equality rather than comparing the raw float to 3.

How do logarithms give the number of digits?

Take log base 10, drop the fractional part and add one. 45678 has a log of 4.66, so five digits. Swap in base 2 for the bit width, which is how the sizing panel fills its rows.

Is a fractional base allowed?

Yes, any positive base other than 1 works. A base between 0 and 1 flips the sign of every result, so log base 0.5 of 8 is -3. Base 1 stays rejected because the change of base division has zero underneath it.