Logarithm Calculator
Calculate a logarithm in any base - free, no signup.
What this tool does
Enter a value and choose a base - 10 (common log), e (natural log), 2 (binary log), or any custom base - to get the logarithm calculated instantly using the change-of-base formula.
Calculates the logarithm of a value in base 10, base e (natural log), base 2, or any custom positive base.
Uses the change-of-base formula (log base b of x = ln(x) / ln(b)) so any valid base works, not just the ones with a dedicated calculator button.
Recalculates live as you type, rounding a result that lands within a hair of a whole number so a clean answer like log base 2 of 8 = 3 doesn't display as 2.99999999.
Rejects invalid inputs immediately - a non-positive x, a non-positive base, or a base of exactly 1 - with an explanation instead of a NaN or blank result.
How to use it
- Enter x, the value.
- Choose a base, or enter a custom one.
- Read the result.
Why use this calculator
Logarithms undo exponents and appear in science, finance and computing. Any base from one formula avoids hunting for the right button.
Why we built it
We built the logarithm calculator to use change-of-base for any positive base, not only 10, e and 2. Check powers with the exponent calculator and use logs for pH with the pH calculator.
If your task goes further, try the Linear Equation Solver.
For a neighbouring job there is also the Decibel Calculator.
Who this tool is for
- Students and teachers
- Scientists and engineers
- Anyone converting between powers and logs
When to use it
- Solving exponential equations.
- Decibels, pH and Richter style scales.
- Computing growth times.
- Studying logs.
Why the change-of-base formula works for any base
Every logarithm can be expressed in terms of the natural log.
Calculators and programming languages typically only build in the natural logarithm (base e) directly. The change-of-base formula - log base b of x equals ln(x) divided by ln(b) - converts any base into that one built-in operation, which is mathematically exact and is the standard technique used everywhere a logarithm in an arbitrary base is needed, including inside this calculator.
What a logarithm actually answers, and why the base matters
A logarithm isn't a separate operation from exponents - it's the question exponentiation leaves unanswered.
If 2^3 = 8, then log base 2 of 8 = 3 is the same fact viewed backwards: 'what power do I have to raise 2 to, to get 8?' Every logarithm is that same question - 'what power of the base gives me this number?' - just with a different base. The base isn't cosmetic; it's the unit the answer is measured in, and swapping it changes what the number means even though it describes the same underlying quantity.
| Base | Common name | Typical use |
|---|---|---|
| 10 | Common log | Orders of magnitude - pH, decibels, the Richter scale |
| e (~2.71828) | Natural log | Continuous growth and decay in calculus and finance |
| 2 | Binary log | Bits of information, and how many times a quantity doubles |
That's why log base 2 shows up specifically when counting bits or doublings: log base 2 of 8 = 3 means 8 takes exactly 3 binary doublings (1 -> 2 -> 4 -> 8) to reach, which is also exactly the number of bits needed to represent 8 distinct values. The same number 8 run through log base 10 instead gives about 0.903 - a true statement, but not one about bits or doublings anymore.
What you give it, and what you get back
| Item | Details |
|---|---|
| Input | A value and a base: 10, e, 2 or custom. |
| Output | The logarithm. |
| Method | Change of base. |
Issues you may run into
| What you see | Why it happens | What to do |
|---|---|---|
| Error for zero or negative | Logs need a positive value. | Enter a number above zero. |
| Base 1 is refused | It is undefined. | Choose another base. |
| Nearly whole result is rounded | Display rounding. | The value is accurate. |
Assumptions and limitations
- x must be greater than 0 and the base must be greater than 0 and not equal to 1 - logarithms are undefined outside those conditions.
- Results very close to a whole number are rounded for display; the underlying calculation itself is standard double-precision floating point.
Frequently asked questions
How do I calculate a logarithm online for free?
Enter x, choose a base, and the result appears instantly.
What's the difference between log and ln?
'log' conventionally means base-10 (common) logarithm, while 'ln' specifically means base-e (natural) logarithm - both are available here as presets.
Can I use a base other than 10, e, or 2?
Yes - select 'Custom' and enter any positive base other than 1.
Why must x be greater than 0?
Logarithms of zero or negative numbers aren't defined for real numbers - the result would be complex or undefined.
Is my data uploaded anywhere?
No. Calculation happens entirely in your browser - nothing is sent to a server.
What does a logarithm actually calculate?
It answers 'what power do I have to raise the base to, in order to get this number?' - the inverse question to exponentiation.
Why is log base 2 used for bits and data sizes?
Because each additional bit doubles the number of values you can represent, so log base 2 of a count tells you how many doublings - and therefore how many bits - it takes to reach that count.