Log Calculator
A logarithm is the power that turns the base into your number. log10 1000 = 3, because 10³ = 1000 (see the steps). Type any base, or pick 10, e (ln) or 2, and fill in any two of base, number and log to get the third.
Fill in any two, get the third
Type a base and a number to get the log. Or type the log to get the number (antilog), or the number and log to get the base.
The two boxes you typed in last are used. Fractions (3/4), e, e^2, 10^-3 and √2 work.
Check your input
Counted in steps of the base
How to Use This Calculator
-
Type a base and a number
Use any positive base other than 1, or tap 10, e or 2. The log appears as you type.
-
Or solve the other way
Type the log y instead of x to get the antilog, or type x and y to find the base.
-
Read the answer
You get the exact answer where there is one, ln, log₁₀ and log₂ of x, the steps and the Excel formula.
What is a logarithm?
A logarithm is an exponent. The log of x in base b is the power y that turns b into x:
Since 2 × 2 × 2 = 8, the log of 8 in base 2 is 3. A log counts how many times you multiply by the base to get from 1 to the number. That is why logs turn huge ranges into small ones: a million is 10⁶, so its common log is just 6, and a billion's is 9.
The answer does not have to be a whole number. 40 is more than 2⁵ = 32 and less than 2⁶ = 64, so log2 40 is 5 and a part, ≈ 5.3219. The calculator draws this as a ruler with one tick per "× 2", so you can see the 5 full steps and the part step after them.
How to calculate a logarithm
When the number is a power of the base
Write the number as a power of the base and read off the exponent. 32 = 2⁵, so log2 32 = 5. 0.001 = 10⁻³, so log10 0.001 = −3. When the base and the number are both powers of a third number, the answer is a fraction: 4 = 2² and 8 = 2³, so log4 8 = 3/2 = 1.5. Check it: 41.5 = √4³ = 8. The calculator spots these cases and gives the exact answer.
Any other number: the change of base formula
Most calculators have only two log buttons, log (base 10) and ln (base e). To get a log in any other base, divide one log by another:
For log3 20: ln 20 ≈ 2.9957 and ln 3 ≈ 1.0986, and 2.9957 ÷ 1.0986 ≈ 2.7268. With base-10 logs you get the same answer, because the formula works with any base on the right as long as it is the same one on top and below. A quick check: 32.7268 should be close to 20, and it is.
Show log₃ 20 in the calculator
ln vs log: which base is which?
| Written | Base | Name | Used for |
|---|---|---|---|
| log x, log₁₀ x | 10 | Common log | pH, decibels, orders of magnitude |
| ln x | e ≈ 2.71828 | Natural log | Calculus, growth and decay, interest |
| log₂ x, lb x | 2 | Binary log | Bits, computer science, doublings |
Watch the meaning of plain "log". On a calculator and in most school math it is base 10. In higher math and in programming it usually means ln: Python's math.log(x) and JavaScript's Math.log(x) both return the natural log. Excel's LOG(x) is base 10 unless you give it a base, and LN(x) is the natural log.
Log base 2
The binary log counts doublings. log2 1024 = 10 because 2¹⁰ = 1024, so 10 bits can store 1,024 different values, and a binary search through 1,024 sorted items needs at most 10 halvings. To find log2 on a calculator, use log x ÷ log 2.
Show log₂ 1024 in the calculator
Logarithm rules
These rules hold for any base b (positive, not 1) and any positive x and y. Each example uses whole numbers, so you can check it in your head.
| Rule | Formula | Example |
|---|---|---|
| Product | log_b(xy) = log_b x + log_b y | log₂(8 × 4) = 3 + 2 = 5 |
| Quotient | log_b(x/y) = log_b x − log_b y | log₂(32/4) = 5 − 2 = 3 |
| Power | log_b(xⁿ) = n · log_b x | log₁₀(100³) = 3 × 2 = 6 |
| Change of base | log_b x = log_a x ÷ log_a b | log₄ 8 = log₂ 8 ÷ log₂ 4 = 3/2 |
| Swap base and number | log_b x = 1 ÷ log_x b | log₈ 2 = 1 ÷ log₂ 8 = 1/3 |
| Log of 1 | log_b 1 = 0 | log₇ 1 = 0 |
| Log of the base | log_b b = 1 | log₇ 7 = 1 |
| Inverse | blog_b x = x, log_b(bˣ) = x | 10log 5 = 5 |
The usual slip is to split the log of a sum: log(x + y) is not log x + log y (log 10 + log 10 = 2, but log 20 ≈ 1.301). Likewise, a quotient of logs is not the log of a quotient: log 100 ÷ log 10 = 2, while log(100/10) = 1. Only products, quotients and powers inside the log break apart.
Antilog: going back from the log
The antilog (inverse log) turns a log back into the number: antilogb(y) = bʸ. In base 10 the antilog of 3 is 10³ = 1000, and the antilog of −2 is 10⁻² = 0.01. The natural antilog is eʸ, so the natural antilog of 1.5 is e1.5 ≈ 4.4817. On a calculator these are the 10ˣ and eˣ keys, usually the second function of log and ln. In this calculator, type the base and y and leave x empty.
You can also find the base: if logb 81 = 4, then b⁴ = 81 and b = ⁴√81 = 3.
Logs of 0, 1 and negative numbers
The log of 1 is 0 in every base, because b⁰ = 1. Logs of numbers between 0 and 1 are negative when the base is above 1: log10 0.5 ≈ −0.301. The log of 0 is undefined: no power of a positive base reaches 0, and as x shrinks toward 0 the log falls without limit. Negative numbers have no real log either, since a positive base to any power stays positive. The base itself must be positive and not 1, because every power of 1 is 1.
Table of common log values
Rounded values are marked with ≈. Each number opens in the calculator with base 10.
| x | log₁₀ x | ln x | log₂ x |
|---|---|---|---|
| 1 | 0 | 0 | 0 |
| 2 | ≈ 0.301 | ≈ 0.6931 | 1 |
| 3 | ≈ 0.4771 | ≈ 1.0986 | ≈ 1.585 |
| 4 | ≈ 0.6021 | ≈ 1.3863 | 2 |
| 5 | ≈ 0.699 | ≈ 1.6094 | ≈ 2.3219 |
| 6 | ≈ 0.7782 | ≈ 1.7918 | ≈ 2.585 |
| 7 | ≈ 0.8451 | ≈ 1.9459 | ≈ 2.8074 |
| 8 | ≈ 0.9031 | ≈ 2.0794 | 3 |
| 9 | ≈ 0.9542 | ≈ 2.1972 | ≈ 3.1699 |
| 10 | 1 | ≈ 2.3026 | ≈ 3.3219 |
| 100 | 2 | ≈ 4.6052 | ≈ 6.6439 |
| 1,000 | 3 | ≈ 6.9078 | ≈ 9.9658 |
Where logarithms are used
- pH is −log10 of the hydrogen ion concentration in moles per litre, so pH 7 means 10⁻⁷ mol/L, and each step down in pH is ten times more acidic.
- Decibels compare power on a log scale: 10 × log10(P / P0). Ten times the power is 10 dB more, and a hundred times is 20 dB more.
- Earthquake magnitude goes up by 1 for each tenfold increase in measured ground motion.
- Growth: money growing at 7% a year doubles in ln 2 ÷ ln 1.07 ≈ 10.2448 years.
Logs undo powers, so the exponent calculator is the same relationship read the other way, and the geometric mean calculator uses logs to average growth rates.
Frequently Asked Questions
What is a logarithm?
A logarithm is the power you raise a base to in order to get a number. log₁₀ 1000 = 3 because 10³ = 1000, and log₂ 8 = 3 because 2³ = 8. Put another way, it counts how many times you multiply by the base to get from 1 to the number.
What is the difference between log and ln?
They use different bases. ln is the natural log, base e ≈ 2.71828, and log on a calculator means base 10. So ln 10 ≈ 2.3026 while log 10 = 1. In Python and JavaScript, though, log() means ln.
How do you calculate log base 2?
Divide the log of the number by the log of 2, using either ln or log: log₂ x = ln x ÷ ln 2. For 40, that is 3.6889 ÷ 0.6931 ≈ 5.3219. For a power of 2 the answer is exact: log₂ 1024 = 10, because 2¹⁰ = 1024.
What is the change of base formula?
log_b x = log x ÷ log b, where both logs on the right use the same base, usually 10 or e. It lets a calculator with only log and ln buttons find a log in any base: log₃ 20 = ln 20 ÷ ln 3 ≈ 2.7268.
What is an antilog?
The antilog undoes a log: the antilog of y in base b is bʸ. The antilog of 3 in base 10 is 10³ = 1000, and the natural antilog of 1.5 is e to the power 1.5, ≈ 4.4817. On a calculator, use the 10ˣ or eˣ key.
Can you take the log of 0 or a negative number?
No, not with real numbers. A positive base raised to any power is always positive, so no power gives 0 or a negative number. As x gets close to 0 the log falls toward minus infinity, so log 0 is undefined.
How do you find a log without a calculator?
Write the number as a power of the base if you can: 81 = 3⁴, so log₃ 81 = 4. If not, find the two powers it lies between to get the whole part: 40 lies between 2⁵ = 32 and 2⁶ = 64, so log₂ 40 is 5 and a bit.