Logarithm Calculator
Calculate base-10, base-2, and natural logarithms at once, add an arbitrary base, and verify results with the inverse power operation.
FreeOnline Tool
Loading…
Rate this tool
Your rating helps others decide whether this tool is worth using
How to Use
Results update immediately as you type the argument; changing the base or power inputs also recalculates.
- Enter an argument x greater than 0 to get lg(x), log₂(x), and ln(x) together.
- For an arbitrary base, enter b greater than 0 and not equal to 1. A log_b(x) card appears; leave the field blank to show only the three standard logarithms.
- In the Power section, enter base a and exponent n to compute aⁿ as a check of the inverse relationship.
- “Copy result” copies all current logarithm values, including the custom base. “Load sample” restores x = 100, b = 10, and 2¹⁰.
- If x is not positive, the base equals 1, or a negative base is paired with a non-integer exponent, the tool shows the corresponding error.
Features
- Four logarithms at once: lg(x) = log₁₀(x), log₂(x), ln(x), and an optional custom-base log_b(x) computed with the change-of-base formula ln(x)/ln(b).
- Arbitrary base: b must be greater than 0 and not equal to 1. Leaving it blank skips the custom result.
- Power check: computes aⁿ so you can verify identities such as log_b(bⁿ) = n.
- Domain validation: the argument must be a finite number greater than 0; negative bases allow only integer exponents; zero cannot be used with a negative exponent.
- Clean output: results keep 12 significant digits with trailing zeros removed, avoiding long floating-point tails.
- Local and copyable: all math runs in the browser and the results can be copied at once.
Use Cases
Algorithm complexity estimates
Enter an input size to get log₂(n) for estimating the growth of binary search, balanced trees, and similar algorithms.
Audio and signal level work
Use lg or ln results to check decibel, gain, and attenuation conversions between power ratios and level differences.
Verify an arbitrary-base log
Enter a custom base such as 3 or 0.5 to check change-of-base results from a textbook or program.
Check the inverse relationship
Compute aⁿ in the Power section, then use that result as the argument to confirm logₐ(aⁿ) returns the original exponent.
FAQ
Which logarithms are calculated?
lg(x) (base 10), log₂(x), and ln(x) (base e) are always calculated. If you enter a custom base b, log_b(x) is added as a fourth result.
What are the restrictions on the custom base?
The base must be greater than 0 and not equal to 1, otherwise the logarithm is undefined. Leaving the field blank means no custom result; only the three standard logarithms are shown.
Why must the argument be greater than 0?
Over the real numbers the argument of a logarithm must be positive. Entering 0, a negative number, or non-numeric text shows “the argument must be a finite number greater than 0” and hides the results.
What restrictions apply to the power operation?
A negative base requires an integer exponent to produce a real result; zero cannot be raised to a negative exponent; the result must be finite. Values outside JavaScript double-precision range are reported as out of range.
How precise are the results?
Calculations use JavaScript double-precision floating point. Display keeps 12 significant digits and strips trailing zeros, so the last digits may differ from an arbitrary-precision math library.