Logarithm Calculator
Compute a log in any base, plus ln, log10 and log2
Privacy: your files never leave your device. All processing happens locally in your browser.
How to use
- 1.Type the number you want the logarithm of into the Argument (x) field — it must be greater than 0.
- 2.Enter a base, or leave the base field blank to use e for the natural logarithm (ln).
- 3.Read log_base(x) instantly below, along with the 2^exponent-style explanation and ln, log10 and log2 for the same number.
About Logarithm Calculator
A logarithm answers one question: what power do you raise a base to in order to get a given number? This logarithm calculator returns log_b(x) the moment you stop typing — no button to press, nothing sent to a server — and at the same time shows the three logarithms people need most: ln(x) the natural log (base e), log10(x) the common log, and log2(x) the binary log. Leave the base field blank and it defaults to e, so it works instantly as a natural log calculator or ln calculator; type any base and it becomes a log base calculator for log2, log10, log5, or anything else.
The tool also echoes the reasoning. When you compute log2(8) it shows log2(8) = 3 and explains it as 2^3 = 8, so the abstract idea becomes concrete: the logarithm is just the exponent. For results that are whole numbers it uses an equals sign, and for irrational results like ln(7) it shows a rounded value with an approximately-equal sign so the answer stays honest.
Under the hood every base is handled with the change of base formula: log_b(x) = ln(x) ÷ ln(b), where ln is the natural logarithm. That single identity is why a calculator that only knows ln and log10 can still evaluate any base. For the everyday bases 2, 10 and e the calculator uses the browser's native high-precision functions, so log2(8) comes out as exactly 3 rather than 2.9999999999999996, while genuinely non-integer answers such as log10(7) ≈ 0.845098 keep their full decimal detail. Tiny floating-point noise is trimmed to twelve significant figures — enough to clean 3.0000000000000004 back to 3 without ever hiding a real fractional result.
Logarithms are only defined for the right inputs, and the calculator enforces that instead of printing a broken value. The argument x must be greater than 0, because there is no power of a positive base that produces zero or a negative number, so those inputs return a clear undefined message. The base must be greater than 0 and cannot equal 1: a base of 1 would make ln(b) = 0 and force a division by zero, and every power of 1 is just 1, so it could never reach another number.
Logarithms show up everywhere once you look. pH in chemistry, decibels in sound, the Richter scale for earthquakes, and stellar magnitudes are all base-10 logarithms; information entropy and the depth of a balanced binary tree are base-2 logarithms; and continuous compound growth and half-life decay live on the natural log. Whether you are checking homework, sizing an algorithm's O(log n) running time, converting between log scales, or solving b^y = x for the exponent y, this calculator gives the answer and the steps. Everything runs locally in your browser, so it is fast, private, and works offline.
Frequently asked questions
- How do I calculate a logarithm like log base 2 of 8?
- A logarithm is the exponent a base must be raised to. log2(8) asks 'what power of 2 gives 8?', and since 2^3 = 8 the answer is 3. Enter 8 as the argument and 2 as the base and this logarithm calculator returns 3 instantly, showing log2(8) = 3 with the 2^3 = 8 explanation so you can follow the reasoning.
- What is the difference between ln, log, and log2?
- They are logarithms with different bases. ln(x) is the natural log, base e ≈ 2.71828, used in growth and calculus. log without a written base usually means the common log, base 10 (log10), used for pH, decibels and the Richter scale. log2(x) is the binary log, base 2, used in computing. This tool shows all three at once and lets you set any base you like.
- How does the change of base formula work?
- To evaluate a log in any base you use log_b(x) = ln(x) ÷ ln(b), where ln is the natural logarithm. For example log5(25) = ln(25) ÷ ln(5) = 2, because 5^2 = 25. This is exactly how the calculator handles unusual bases, so you can compute log5, log7 or any base even though most calculators only have ln and log10 buttons.
- Why can't I take the logarithm of 0 or a negative number?
- The logarithm is undefined for zero and negative arguments. A positive base raised to any real power always stays positive, so no exponent can ever produce 0 or a negative result — there is simply no answer to return. Enter a value greater than 0. The base itself must also be greater than 0 and not equal to 1, since base 1 would force a division by zero in the change of base formula.
- Why is log2(8) exactly 3 but log10(7) has many decimals?
- log2(8) is a whole number because 8 is a clean power of 2 (2^3), so the result is exactly 3. log10(7) is irrational — no simple power of 10 equals 7 — so it is about 0.845098, and the calculator keeps the full decimals for accuracy. It only trims tiny floating-point noise (turning 3.0000000000000004 back into 3) and never rounds a genuine fraction into a fake whole number.
Related tools
- Exponent CalculatorRaise any base to any power instantly, with the steps
- GCF CalculatorFind the GCF/GCD and LCM of any integers, with steps
- Online CalculatorDo quick everyday math in your browser — free, private, no signup.
- Absolute Value CalculatorInstantly find |x| — the absolute value of any number, free.
- Age CalculatorYour exact age in years, months, and days — updated live
- Angle ConverterConvert degrees, radians, gradians, turns, arcmin & arcsec
Calculators guides
View all- How to Calculate Cube Volume from One Side Length
- How to Calculate Cube Root for Any Number
- How to Change Clothing Size on Amazon: Convert Sizes
- How to Calculate Circumference From Radius or Diameter
- How to Calculate Circle Area: A = πr² Made Simple
- Convert Your Cat's Age to Human Years the Vet-Approved Way
- Calculate Brinell Hardness from Load, Ball and Indent
- How to Calculate Bra Size Accurately at Home
- Measure Body Fat at Home Without Scales or Calipers
- Calculate Your BMR in Seconds with Two Trusted Formulas
- How to Calculate BMI in Seconds with a Free Online Tool
- How to Calculate Online Without a Physical Calculator
- How to Calculate Your Blood Alcohol Content Accurately
- Predict Your Baby's Eye Color Odds in One Click
- How to Calculate Average Fast – Free Online Mean, Median & Mode Tool
- Convert Any Area to Square Feet in Seconds – Free Online Tool
- How to Calculate Annular Area Quickly – Free Online Tool
- How to Convert Degrees to Radians in Seconds – Free Online Tool
- How to Calculate Age Between Two Dates in Excel – Instant Online Tool
- How to Calculate Absolute Value Fast – Free Online Tool