A logarithm answers the question “what power must I raise the base to in order to get this number?”. This calculator computes logarithms in base 10 (common log), base e (natural log, ln), base 2, or any custom base, and confirms each answer with the matching power. It is for students, engineers and anyone working with exponential growth, decibels, pH or information theory.
How it works
JavaScript provides only the natural logarithm, so the tool uses the change-of-base identity to handle any base:
log_base(x) = ln(x) ÷ ln(base)
The preset buttons simply set the base to 10, e or 2; the custom option accepts any base greater than 0 and not equal to 1. Logarithms are only defined for x greater than 0, so the calculator validates the domain before computing. Results are shown to ten decimal places and confirmed by the inverse relationship base^result = x.
Worked examples
To find log base 10 of 1000:
log₁₀(1000) = ln(1000) ÷ ln(10) = 6.907755 ÷ 2.302585 = 3
The check confirms it: 10³ = 1000.
| Expression | Result | Verification |
|---|---|---|
| log₁₀(1000) | 3 | 10³ = 1000 |
| ln(e) | 1 | e¹ = e |
| log₂(8) | 3 | 2³ = 8 |
| log₃(81) | 4 | 3⁴ = 81 |
When to use each base
The choice of base depends entirely on the field you are working in:
- Base 10 (common log) is used in acoustics for decibels (dB = 10 · log₁₀(power ratio)), in chemistry for pH (pH = −log₁₀[H⁺]), and in earthquake magnitude (Richter scale). It is the default “log” in most engineering contexts.
- Natural log (base e ≈ 2.71828) appears in calculus, finance (continuous compounding), population growth, and radioactive decay because the derivative of eˣ is itself, making the maths unusually clean.
- Base 2 (binary log) measures information in bits. A byte of 256 possible values encodes log₂(256) = 8 bits. Computer scientists use it for algorithm analysis — binary search on 1,024 items takes at most log₂(1024) = 10 comparisons.
- Custom base is useful for specialty scales: the Brinell hardness index, musical intervals in equal temperament, or any exponential decay with a non-standard half-life.
Practical guidance
Domain restrictions matter. You cannot take a logarithm of zero or a negative number — no real power of a positive base reaches those values. The calculator validates the input and reports an error if x ≤ 0 or if the base is ≤ 0 or exactly 1.
Reading precision. Results appear to ten decimal places, which is sufficient for scientific and engineering purposes. If you need fewer places, round the displayed value; the underlying computation uses JavaScript’s 64-bit double-precision arithmetic.
The inverse check. The tool always confirms the result by computing base^result and comparing it to x. If the two agree closely, the logarithm is correct. Small floating-point differences (less than 10⁻⁹) are normal and not errors.
Common mistake: confusing log and ln. Many textbooks write “log” to mean the natural log, while calculators and engineers use “log” to mean base 10. If you are unsure which base a formula expects, check the context — or compute both and see which gives the expected result for a known value.
The calculator is privacy-first — the value and base stay in your browser and nothing is sent to any server.