Logarithm
calculator.
Work out a log in any base, or the number or base behind it, with exact answers and every step.
8 is a whole power of 2: multiply 2 by itself 3 times and you get 8.
The curve y = log₂(x)
Drag the brass pointThe curve y = log₂(x) rises from left to right. It crosses the x-axis at (1, 0), because any base to the power 0 is 1, and passes through (2, 1). As x shrinks toward 0 it drops without limit: the y-axis is an asymptote. The brass point is your answer: at x = 8 the curve is at height 3. Drag it sideways to change x.
Working
- 1Definition: the log is the power that turns 2 into 82y = 8
- 2Multiply 2 by itself 3 times23 = 8, so y = 3
- 3Change of base, using natural logsy= ln(8)ln(2)= 2.079440.693147= 3
- 4Any base works: common logs give the same answery= 0.903090.30103= 3
- 5Check: raise the base to the answer23 = 8
- 6Answerlog2(8) = 3
Multiply x by the base
| x | log2(x) | From your x |
|---|---|---|
| 1 | 0 | ÷ 23 |
| 2 | 1 | ÷ 22 |
| 4 | 2 | ÷ 2 |
| 8 | 3 | your x |
| 16 | 4 | × 2 |
| 32 | 5 | × 22 |
| 64 | 6 | × 23 |
Each row down multiplies x by 2 and adds exactly 1 to the log. This is the product rule: the log of a product is the sum of the logs.
Keyboard shortcuts
- Up arrow and Down arrow in a box change it by 1. Hold Shift for 10 or Alt for 0.1.
- Tab to the brass point on the graph. When you are finding the log, Left arrow and Right arrow change x; otherwise Up arrow and Down arrow change y.
- With the graph focused, + and − zoom and 0 resets the view.
- Left arrow and Right arrow move between the options of a switch, such as Log y, Number x and Base b.
Log a list of numbers
Type or paste a column of numbers, for example from a spreadsheet. Each one is logged in base 2, the base in the equation above.
| # | x |
|---|---|
| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 |
Log base 2 of each number
| x | Exact | |
|---|---|---|
| 1 | 0 | 0 |
| 2 | 1 | 1 |
| 8 | 3 | 3 |
| 0.25 | −2 | −2 |
| 1,000 | 9.96578 |
How it’s worked out
A logarithm answers one question: what power turns the base into your number? Writing it as a power is the definition:
- b is the base. It must be positive and cannot be 1, because 1 to any power is still 1.
- x is the number you take the log of. It must be greater than 0.
- y is the log, the power itself. It can be any number, including negatives and fractions.
Most calculators only have two log buttons: ln, the natural log with base e (about 2.71828), and log, the common log with base 10. Any other base goes through the change-of-base formula:
It comes straight from the definition. Take the natural log of both sides of by = x. The power comes down as a factor, so y × ln b = ln x, and dividing by ln b leaves y. Any base works in place of e, which is why the common-log version gives the same answer. The working on this page shows both.
When the unknown is the base or the number, undo the power instead. The base is the yth root of x, and the number, called the antilog, is the base raised to y:
Some logs have an exact value. If b and x are both powers of one number, the log is a fraction. For example 8 = 2³ and 4 = 2², so 8² and 4³ are both 64, and log₈ 4 is exactly . The tool confirms each exact answer with whole-number arithmetic, not by rounding a decimal:
| Log | Exact | Decimal | Why |
|---|---|---|---|
| 3 | Whole number: 2³ = 8 | ||
| 0.5 | Fraction: 4 to the power is √4 = 2 | ||
| 0.6667 | Fraction: 8² and 4³ are both 64 | ||
| −3 | Negative: 0.001 is 1 over 10³ | ||
| none | 3.5609 | No exact form: decimal only |
For bases 10, 2 and e the tool uses the dedicated library routines rather than dividing two logs, and it snaps exact whole powers, so log₅ 125 shows as 3 rather than 3.0000000000000004.
Worked examples
How many guesses does a binary search need?
Maya has a sorted list of 1,000,000 customer records. Binary search checks the middle record and throws away half the list each time. The number of halvings is log₂ 1,000,000 = 19.9316.
You cannot make part of a guess, so round up: 20 comparisons always find a record. The check works: 220 = 1,048,576 covers a million, while 219 = 524,288 falls short.
What does a pool reading of pH 7.4 mean?
Jordan tests the pool and reads pH 7.4. pH is the negative common log of the hydrogen ion concentration, so log₁₀[H⁺] = −7.4. That is a Number x problem: the antilog of −7.4 in base 10.
The answer is 10−7.4 = 3.981 × 10⁻⁸ mol/L. Pure water at pH 7 has 1 × 10⁻⁷ mol/L, about 2.51 times as much. A change of 0.4 on the pH scale is a factor of 2.51, and a full step of 1 is a factor of 10.
What yearly growth doubles money in 10 years?
Priya's investment doubled in 10 years. If it grew by the same factor b each year, then b10 = 2, which is log base b of 2 = 10. The unknown is the base.
The 10th root of 2 gives b = ¹⁰√2 ≈ 1.0718, a rise of about 7.18% a year. The check: 1.071773 raised to the power 10 is 2.
Reading your result
The whole part counts powers of the base. log₁₀ 4,500 is about 3.65. The 3 says 4,500 lies between 10³ and 10⁴, so it has 4 digits before the decimal point. The table under the tool shows the other half of the story: multiply x by 10 and the log goes up by exactly 1, so 45,000 gives 4.65 and 450,000 gives 5.65.
Negative logs mean a number between 0 and 1 when the base is above 1. log₁₀ 0.01 is −2 because 0.01 is 1 over 10². A log of 0 always means x = 1, and a log of 1 means x equals the base.
A base between 0 and 1 flips the signs. The curve falls instead of rising, so numbers above 1 get negative logs: log base 0.5 of 8 is −3. A negative power of a half doubles instead of halving: 0.5 to the power −3 is 2³ = 8.
Exact or decimal. Exact is the form an answer key prints: a whole number, a stacked fraction such as or a root such as √10. Most logs are irrational, so the tool says when there is no exact form and shows the decimal. Choose 3, 6, 9 or 12 significant figures. For a log, 4 to 6 figures is plenty; for an antilog such as a concentration, 3 figures usually matches the precision of the measurement.
The rules behind these readings are in Stewart, Redlin and Watson's Precalculus, section 4.3, and the NIST Digital Library of Mathematical Functions, section 4.2.
Common mistakes
- Pressing the wrong button. On most calculators LOG is base 10 and LN is base e. ln 20 is 2.9957, but log₁₀ 20 is only 1.301.
- Splitting the log of a sum. log₁₀(2 + 8) is log₁₀ 10 = 1. Adding log₁₀ 2 and log₁₀ 8 gives log₁₀ 16 = 1.2041 instead, because the rule only splits a product.
- Dividing inside the log. Change of base divides two logs: ln 8 ÷ ln 2 = 3. It is not the log of a quotient, and ln(8 ÷ 2) = ln 4 is only 1.3863.
- Mixing up the roles. log₂ 8 = 3 means 2³ = 8. It does not mean 8³ or 3², so check which number is the base before you rewrite it as a power.
- Taking the log of 0 or a negative number. No power of a positive base reaches 0 or goes below it, so these logs are not real numbers. The tool says so instead of returning an error code.
- Dropping the minus sign in pH. pH 7.4 means log₁₀[H⁺] = −7.4. Using +7.4 gives a concentration that is far too large.
- Rounding the logs too early. Keep the full values of ln x and ln b until the last division. Rounding both to one decimal place can move the answer in its second decimal place.
Questions people ask
Sources
- NIST Digital Library of Mathematical Functions, section 4.2, Logarithm
- Stewart, Redlin and Watson, Precalculus: Mathematics for Calculus, 7th ed., chapter 4, Exponential and Logarithmic Functions
- OEIS A002392 (ln 10) and A007524 (log10 2), decimal expansions used as reference values