How to use the logarithm calculator
- Enter the number you want to find the logarithm of in the first field.
- Select a base from the dropdown: 10 for the common log, e for the natural log, 2 for binary, or choose custom.
- If you chose custom, type the desired base value in the Custom base value field.
- Read the computed logarithm in the result area below.
How the logarithm is calculated
A logarithm answers the question: to what power must the base be raised to produce the given number? Mathematically, if by = x, then logb(x) = y. For example, to find log base 10 of 1000, we ask what power of 10 equals 1000. Since 10 multiplied by itself three times is 1000, the answer is 3.
When computing a logarithm with an arbitrary base, the change-of-base formula is used: logb(x) = ln(x) / ln(b). The tool divides the natural logarithm of the number by the natural logarithm of the chosen base to arrive at the result. This works for any valid base, whether it is 2, 5, or 16.
Common logarithm reference table
The common logarithm (log base 10) appears frequently in science and engineering. Below is a quick reference for powers of ten and a few intermediate values.
| x | log₁₀(x) |
|---|---|
| 0.001 | -3 |
| 0.01 | -2 |
| 0.1 | -1 |
| 1 | 0 |
| 10 | 1 |
| 100 | 2 |
| 1,000 | 3 |
| 10,000 | 4 |
| 100,000 | 5 |
Notice that each time the number is multiplied by 10, the log base 10 increases by exactly 1. This linear relationship on a logarithmic scale is why orders of magnitude are so easy to compare using base 10.
Where different bases are used
Different fields rely on specific logarithm bases. The common logarithm (base 10) is standard in chemistry for calculating pH, where pH = -log₁₀[H⁺]. It is also used in acoustics to express sound levels in decibels and in the Richter scale for measuring earthquake magnitudes.
The natural logarithm (base e, approximately 2.71828) is central to calculus, physics, and finance. Growth rates, radioactive decay, and continuous compounding all use base e. If you need to model growth over time, tools like the compound interest calculator rely on these same exponential principles.
Base 2 is fundamental in computer science. It measures information in bits, determines algorithm complexity (such as binary search running in O(log₂ n) time), and defines memory addressing. When working with data sizes, converting between units often involves powers of two.
Properties and rules of logarithms
Logarithms follow several algebraic rules that simplify complex calculations:
- Product rule:
logb(x * y) = logb(x) + logb(y). Multiplication inside the log becomes addition outside. - Quotient rule:
logb(x / y) = logb(x) - logb(y). Division becomes subtraction. - Power rule:
logb(xn) = n * logb(x). An exponent moves to the front as a multiplier. - Identity:
logb(b) = 1andlogb(1) = 0for any valid base.
These properties were historically used with slide rules and log tables to perform multiplication and division before electronic calculators existed. Today they remain essential for simplifying equations in algebra and calculus.
Edge cases and invalid inputs
A logarithm is only defined for strictly positive numbers. You cannot compute the log base 10 of zero or a negative number within the real number system; doing so requires complex numbers, which this tool does not handle. Entering zero or a negative value will return an error.
The base itself must also be a positive number other than 1. A base of 1 is invalid because 1 raised to any power is always 1, making it impossible to reach any other number. A base of zero or a negative base is similarly undefined for general real-valued logarithms. Always ensure both the input number and the custom base are greater than zero, and that the base is not exactly 1.
Worked examples
Each result below was produced by the same code the tool runs, so you can check your own numbers against them.
| Example | Input | Result |
|---|---|---|
| Log base 10 of 1000 | Number (x): 1000; Base: 10 | log₁₀(1,000): 3 |
| Natural log of 1 | Number (x): 1; Base: e | ln(1): 0 |
| Log base 2 of 256 | Number (x): 256; Base: 2 | log₂(256): 8 |
| Log base 5 of 125 | Number (x): 125; Base: custom; Custom base value: 5 | log₅(125): 3 |
FAQ
What is log base 10?
Log base 10, also called the common logarithm, is the power to which 10 must be raised to equal a given number. For example, log base 10 of 100 is 2 because 10 squared equals 100.
What is the difference between log and ln?
In most scientific contexts, "log" without a specified base refers to log base 10, while "ln" specifically means the natural logarithm, which uses base e (approximately 2.71828).
Can I calculate the logarithm of a negative number?
Not in the real number system. The logarithm of a negative number or zero is undefined for real values. Complex logarithms exist but are beyond the scope of this tool.
Why is base 1 used as an invalid base?
Because 1 raised to any power is always 1. There is no exponent that makes 1 equal to any number other than 1, so a logarithm with base 1 cannot be solved.
How do I calculate a log with a custom base?
Use the change-of-base formula: divide the natural log of the number by the natural log of your desired base. Select "Custom base" in the tool and enter your value to do this automatically.
Is my data sent to a server when I use this tool?
No. All calculations happen locally in your browser. Nothing you type is uploaded anywhere.