Logarithm Calculator
Find log base b of x — the power you must raise b to in order to get x — along with ln(x) and log₁₀(x).
Formula
logb(x) = ln(x) ÷ ln(b)
| Symbol | Meaning |
|---|---|
| x | The number whose logarithm you want (must be positive) |
| b | The base (positive and not equal to 1) |
| ln | Natural logarithm, base e ≈ 2.71828 |
How to Use This Calculator
- Enter the Number (x).
- Enter the Base (b). Use 10 for common logs or 2.718281828 for natural logs.
- Press Calculate. Results also update automatically as you type.
Worked Example
Using the values pre-filled in the calculator above:
| Number (x) | 256 |
|---|---|
| Base (b) | 2 |
| log_b(x) | 8 |
|---|---|
| ln(x) | 5.5452 |
| log₁₀(x) | 2.4082 |
About This Calculation
A logarithm answers the question "what power do I need?". Because 2⁸ = 256, log₂(256) = 8. Logarithms turn multiplication into addition — log(ab) = log(a) + log(b) — which is why they were used for centuries, through log tables and slide rules, to make hard calculations easy. Most calculators only have ln and log₁₀ keys; any other base is found with the change-of-base formula shown above.
The logarithm is only defined for positive numbers, and the base must be positive and not 1. Numbers between 0 and 1 have negative logarithms (log₁₀(0.01) = −2), and the logarithm of 1 is 0 in every base. Watch the notation: in mathematics and many programming languages "log" means the natural log, whereas on most calculators and in engineering it means base 10.
Logarithmic scales compress huge ranges into manageable numbers. The pH scale, decibels, the Richter and moment-magnitude earthquake scales and star brightness are all logarithmic, so one step represents a fixed multiplication rather than a fixed addition. Base 2 logs count bits and the steps of binary search, and natural logs appear in continuous growth and decay — see the half-life calculator and the pH calculator.
Frequently Asked Questions
- What is the difference between log and ln?
- ln is the natural logarithm, with base e ≈ 2.71828. "log" usually means base 10 on calculators, but base e in pure mathematics and in programming languages such as Python and JavaScript.
- Why can I not take the log of zero or a negative number?
- No real power of a positive base gives zero or a negative result, so there is no real answer. As x approaches 0, the logarithm heads toward minus infinity.
- How do I undo a logarithm?
- Raise the base to the result: if log_b(x) = y then x = b^y. The exponent calculator does this.