Log Calculator
A logarithm tells you the power the base must be raised to: log₁₀(100) = 2 because 10² = 100. Choose base 10, base e (ln) or base 2, or type any base. Bases other than e and 10 use the change-of-base rule, log_b(x) = ln(x) ÷ ln(b).
Last updated by Ultra Calculator
Log
How to calculate it
log_b(x) = ln(x) ÷ ln(b)
- x
- the number, which must be greater than 0
- b
- the base, which must be greater than 0 and not 1
- ln
- the natural logarithm, base e ≈ 2.718281828
log_b(x) = y means b^y = x. Base 10 is the common log, usually written log; base e is the natural log, ln; base 2 is the binary log.
Worked example
Natural log of 2.71828
ln(2.71828) = 0.999999327347. The input is e rounded to 5 decimal places, so the result is just under ln(e) = 1.
| Number (x) | 2.72 |
|---|---|
| Base | e (natural log, ln) |
| Logarithm | 0.999999327347 |
|---|---|
| Base used | e (natural logarithm) |
| Check: base raised to the result | 2.71828 |
| Calculation | ln(2.71828) = 0.999999327347 |
How to use this calculator
- Enter Number (x), which must be greater than 0.
- Choose the Base: e (natural log, ln), 10, 2, or Custom base.
- If you chose Custom base, type it in Custom base (b).
- Read Logarithm. The Check row raises the base to that power and should give back your number, allowing for rounding.
Frequently asked questions
What is the difference between log and ln?
On calculators and in most school maths, log means base 10 and ln means base e, about 2.718. Some university texts and programming languages use log for the natural log, so check which is meant. The two differ by a fixed factor: ln(x) ≈ 2.302585 × log₁₀(x).
How do you calculate log base 2?
Divide the natural log of the number by ln(2), or its base-10 log by log₁₀(2). For example, log₂(1,024) = 10, because 2¹⁰ = 1,024. Choose 2 (binary log) under Base to calculate it directly.
Why can't you take the log of 0 or a negative number?
A positive base raised to any real power is always positive, so no power gives 0 or a negative number. For bases greater than 1, the logarithm falls without limit as x approaches 0. Logarithms of negative numbers exist as complex numbers, which this calculator does not cover.
What is an antilog?
The antilog reverses a logarithm by raising the base to the result: the base-10 antilog of 2 is 10² = 100. The Check row does this, so it should show your original number apart from rounding.
How do you change the base of a logarithm?
Use log_b(x) = log_k(x) ÷ log_k(b) where k is a valid base, usually 10 or e. For example, log₃(27) = ln(27) ÷ ln(3) = 3. The calculator applies this rule for custom bases.
What is the log of 1?
0 in every valid base, because any valid base raised to the power 0 is 1. The log of the base itself is always 1; for example, log₁₀(10) = 1.
Learn more
Logs undo powers
A logarithm is the inverse of raising to a power. If b^y = x, then log_b(x) = y. So log₁₀(1,000) = 3 because 10³ = 1,000, and log₂(8) = 3 because 2³ = 8.
The log rules
For positive x and y, log(xy) = log(x) + log(y), log(x ÷ y) = log(x) - log(y) and log(x^n) = n × log(x). These turn multiplication into addition and powers into multiplication, which is how printed log tables supported long calculations before electronic calculators.
Where each base is used
Base 10 measures orders of magnitude, as in pH and decibels. Base e appears in continuous growth and decay, including compound interest and radioactive decay, and in calculus. Base 2 counts halvings and doublings, so it tells you how many bits are needed to represent a set of values.
- Finding pH from a hydrogen-ion concentration: -log₁₀(0.0001) = 4
- Counting the bits needed for a million distinct values: log₂(1,000,000) is about 19.93, so 20 bits
- Working out how long money takes to double at 5% a year: ln(2) ÷ ln(1.05) is about 14.2 years
- Comparing sound levels: ten times the power is 10 × log₁₀(10) = 10 decibels more
- Checking homework on log laws and change of base
Assuming log always means base 10
In programming languages and some textbooks, log means the natural log. Check the base before comparing answers.
Splitting the log of a sum
log(x + y) is not log(x) + log(y). The addition rule applies to log(x × y).
Using the percentage instead of the growth factor
For 5% growth, use ln(1.05), not ln(5) or ln(0.05).
Choosing 1 as the base
Every power of 1 is 1, so a base of 1 cannot reach any other number. The base must be positive and not 1.
- To solve b^x = y for x, take the log of y in base b: 2^x = 32 gives x = log₂(32) = 5.
- A base-10 log gives the digit count of a positive whole number: log₁₀(45,000) is about 4.65, so the number has 5 digits.
- Small differences between the Check row and your number come from rounding.
Methodology and sources
The calculator uses JavaScript's built-in natural, base-10 and base-2 logarithms for ln, log₁₀ and log₂, and the change-of-base rule ln(x) ÷ ln(b) for custom bases. It rounds the result to 12 decimal places. The Check row raises the base to the unrounded result and shows it to 12 significant figures, so small rounding differences may appear. The number must be greater than 0, and log(0) has no value at all, so 0 or a negative number gets a message instead of a result. A custom base must be greater than 0 and not 1. Only real logarithms are given.