Skip to main content
ponderloop

Logarithm and Exponent Calculator

Pick log, antilog, solve or root, enter two numbers, and get an exact answer when one exists: log₂(1024) = 10, because 2¹⁰ = 1024. The same goes for log₁₀(0.001) = −3 and 8^(2/3) = 4. Otherwise you get a decimal rounded to 12 significant figures, such as log₁₀(2) ≈ 0.301029995664 and ln(10) ≈ 2.30258509299. The working shows the change-of-base steps, and domain errors (log of 0 or a negative number, base 1, a negative base to a fractional power) are explained instead of returning NaN.

Updated Runs in your browser: nothing you enter is uploadedHow this tool works

Calculate

a number above 0 (not 1), or e

above 0; decimals, fractions and 1e-3 work

log₂(1024) =

10

Exact: 2¹⁰ = 1024.

Exact value
10
Precision
Exact, no rounding
ln x
6.9314718056
log₁₀ x
3.01029995664
log₂ x
10

Step by step

  1. Change of base: log₂(1024) = ln(1024) / ln(2). Any base works in place of ln, and the quotient is the same.
  2. ln(1024) = 6.9314718056
  3. ln(2) = 0.69314718056
  4. 6.9314718056 / 0.69314718056 = 10, which is exactly 10
  5. Exact form: 2 = 2^1 and 1024 = 2^10, so the logarithm is 10 / 1 = 10.

Laws of logarithms

Each example is evaluated by the calculator, so both sides agree.
LawRule (b > 0, b ≠ 1, x and y > 0)Example
Productlog_b(x · y) = log_b(x) + log_b(y)log₂(8 × 16) = log₂(128) = 7, and log₂(8) + log₂(16) = 3 + 4
Quotientlog_b(x / y) = log_b(x) − log_b(y)log₃(81 / 9) = log₃(9) = 2, and log₃(81) − log₃(9) = 4 − 2
Powerlog_b(x^k) = k · log_b(x)log₁₀(1000²) = log₁₀(1000000) = 6, and 2 · log₁₀(1000) = 2 × 3
Rootlog_b(x^(1/n)) = log_b(x) / nlog₂(∛64) = log₂(4) = 2, and log₂(64) / 3 = 6 / 3
Reciprocallog_b(1/x) = −log_b(x)log₁₀(0.001) = −3, and −log₁₀(1000) = −3
Change of baselog_b(x) = log_k(x) / log_k(b)log₈(32) = 5/3, and log₂(32) / log₂(8) = 5 / 3
Swap base and argumentlog_b(x) = 1 / log_x(b)log₄(8) = 3/2, and 1 / log₈(4) = 1 / (2/3)
Log of 1 and of the baselog_b(1) = 0 and log_b(b) = 1log₇(1) = 0 and log₇(7) = 1
Inverse of the powerlog_b(b^x) = x and b^(log_b x) = xlog₅(5³) = log₅(125) = 3

Logarithms of common numbers

Exact where the answer is a whole number or fraction, otherwise rounded to 12 significant figures.
nln nlog₁₀ nlog₂ n
20.693147180560.3010299956641
31.098612288670.477121254721.58496250072
51.609437912430.6989700043362.32192809489
71.945910149060.8450980400142.80735492206
102.3025850929913.32192809489
1004.6051701859926.64385618977
10006.9077552789839.96578428466
10246.93147180563.0102999566410

Exact answers the calculator finds

CalculationExact resultWhy
log₂(1024)101024 = 2¹⁰
log₁₀(0.001)−30.001 = 10⁻³
log₄(8)3/24 = 2² and 8 = 2³, so the exponent is 3/2
log₈(2)1/38 = 2³ and 2 = 2¹, so the exponent is 1/3
log base 1/4 of 8−3/21/4 = 2⁻² and 8 = 2³, so the exponent is −3/2
8^(2/3)4the cube root of 8 is 2, and 2² = 4
27^(−2/3)1/9the cube root of 27 is 3, and 3⁻² = 1/9
32^(1/5)22⁵ = 32
(−8)^(1/3)−2an odd root keeps the sign: (−2)³ = −8
2^(−3)1/8a negative exponent is a reciprocal: 1/2³

When there is no real answer

The messages are the ones the calculator shows.
InputWhat the calculator says
log₂(0)log of 0 is undefined: no power of 2 equals 0. As x approaches 0 from above, log_b(x) heads to −∞ for b > 1 and +∞ for 0 < b < 1.
log₂(−4)x must be positive: −4 has no real logarithm, because a positive base raised to a real power is never negative. (Its logarithm is a complex number, which this calculator does not compute.)
log base 1 of 5Base 1 is not allowed: 1 to any power is 1, so log base 1 is undefined. Choose a base above 0 other than 1.
log base −2 of 8The base must be positive: −2 is not allowed. A logarithm needs b > 0 and b ≠ 1, because b^x is not a real number for most x when b ≤ 0.
2^x = −82^x is always positive for a positive base, so no real x solves 2^x = −8. (The solutions are complex numbers, which this calculator does not compute.)
(−2)^0.5A negative base needs a whole-number exponent: (−2)^(0.5) is not a real number. Fractional powers of a negative number are complex. For an odd root such as the cube root of −8, use the root mode.
0^00^0 is undefined (it is an indeterminate form), so there is no single answer.
square root of −16A negative number has no real square root: no real number raised to an even power is negative. (The roots are complex, which this calculator does not compute.)

How to calculate a logarithm or a power

  1. Choose what to calculate. Pick Logarithm for log base b of x, Antilog for b to the power x, Solve to find x in b^x = y, or Root for x^(1/n).
  2. Enter the two numbers. Type the base (or e for natural logarithms) and the number. Decimals, fractions such as 2/3 and E notation such as 1e-3 all work.
  3. Read the answer. An exact result appears as a whole number or fraction with its decimal; anything else is a decimal rounded to 12 significant figures, with very large or small values in scientific notation.
  4. Follow the working. Open the steps to see the change-of-base calculation, whether the answer is exact, and any note on precision.

Frequently asked questions

How do I calculate a logarithm with any base?
Use the change-of-base rule: log_b(x) = ln(x) / ln(b). For log base 2 of 10 that is ln(10) / ln(2) ≈ 3.32192809489. The same quotient comes out with log₁₀ or any other base in place of ln. The calculator shows these steps for every logarithm and, when the base and the number are powers of a common number, the exact fraction as well (log₂(1024) = 10).
What is the difference between ln, log, log10 and log2?
They differ only in the base. ln is the natural logarithm, base e ≈ 2.71828; log₁₀ is the common logarithm; log₂ is the binary logarithm used in computing. A bare “log” means base 10 on most calculators and in engineering, and base e in much of higher mathematics, so check the convention. For 10: ln(10) = 2.30258509299, log₁₀(10) = 1, log₂(10) = 3.32192809489. Every logarithm result here also lists ln, log₁₀ and log₂ of the same number.
What is an antilog?
The antilogarithm undoes a logarithm: antilog_b(x) = b^x. The antilog base 10 of 2.5 is 10^2.5 = 316.227766017, and the antilog base 10 of 2 is 100. Use the Antilog option for these, and the natural antilog is e^x (type e as the base).
How do I solve b^x = y for x?
Take the logarithm of both sides: x = log_b(y) = ln(y) / ln(b). To solve 2^x = 10, x = 3.32192809489. If y is a power of b the answer is exact: 2^x = 1024 gives x = 10. The Solve option shows the working in this form. For square roots, cube roots and simplified radicals, use the square root calculator.
Why do I get an error for the log of zero or a negative number?
A positive base raised to any real power is positive, so no real power of b equals 0 or a negative number. log of 0 is undefined: no power of 2 equals 0. As x approaches 0 from above, log_b(x) heads to −∞ for b > 1 and +∞ for 0 < b < 1. For a negative x the logarithm exists only as a complex number, which this calculator does not compute.
Why can the base not be 1, 0 or negative?
1 to any power is 1, so log base 1 cannot tell different numbers apart and is undefined. A base of 0 or below makes b^x undefined for most x. The calculator says so: “Base 1 is not allowed: 1 to any power is 1, so log base 1 is undefined. Choose a base above 0 other than 1.”
What about a negative number to a fractional power?
For a whole-number exponent a negative base is fine: (−2)³ = −8. For a fractional exponent such as (−2)^0.5 there is no real answer, because the square root of a negative number is not real. An odd root does exist: the cube root of −8 is −2, and the Root option finds it. Even roots of negative numbers are reported as having no real answer.
How does the calculator know an answer is exact?
Inputs are read as exact fractions and handled with BigInt integers, not floating point. log_b(x) is a fraction exactly when b and x are both integer powers of one common number: for log₄(8), 4 = 2² and 8 = 2³, so the answer is 3/2. b^(p/q) is exact when b is a perfect q-th power: 8^(2/3) = 4. If no common base exists the logarithm is irrational, and the calculator says so and rounds it.
How accurate are the decimals, and what are log1p and expm1 for?
Results that are not exact are rounded to 12 significant figures from double-precision arithmetic, which carries about 15 to 16 digits. Very large exponents lose digits, and the page says how many it shows (10^500.5 is shown to 11 significant figures). When a number is close to 1, ordinary ln loses most of its digits: ln(1.000001) is about a millionth, but the nearest double to 1.000001 is off by up to about 10⁻¹⁶, so only about 9 digits of the answer would be right. The calculator reads the number exactly and uses Math.log1p(1e-6) instead, giving log₁₀(1.000001) ≈ 4.34294264756 × 10⁻⁷. In the same way a power near 1 also shows b^x − 1 from Math.expm1: 1.000001^(0.5) ≈ 1.0000005, where b^x − 1 is 4.99999875 × 10⁻⁷.
How are very large and very small results shown?
Results outside everyday sizes use scientific notation, formatted by the same code as the scientific notation converter: 10^500.5 is 3.1622776602 × 10⁵⁰⁰, and log₁₀(1.000001) ≈ 4.34294264756 × 10⁻⁷. Powers too large for any digits to be reliable show only the power of ten.
Is my number sent anywhere?
No. The calculation runs in your browser. The numbers you type stay on your device, and the page only records that the tool was used, never what you entered.

How it works

Typed numbers (decimals, fractions, E notation) are converted to exact fractions of BigInt integers. For log_b(x) the calculator writes b and x as powers of their primitive roots: each number above 1 is split into the largest integer power of a smaller rational, found by exact integer root tests over prime exponents, and numbers below 1 are inverted first. The logarithm is a fraction exactly when both have the same primitive root, and the fraction is the ratio of their exponents; otherwise it is irrational. A power b^(p/q) in lowest terms is exact when the integer q-th roots of the numerator and denominator of b both exist, and the result is then (root)^p computed with integers, up to about 9,000 digits. Everything else uses the change-of-base rule with doubles: ln(x) / ln(b), where ln of a number within a factor of 2 of 1 is computed by Math.log1p applied to the exact value of x − 1, and ln of numbers beyond the double range by splitting off the leading 64 bits. b^x is computed as e^(x · ln b), with Math.expm1 shown for results near 1, and as a power of ten when the result overflows a double. Decimals are rounded to 12 significant figures (fewer when the size of the exponent magnifies the rounding error), and notation follows the scientific notation converter. A negative base needs a whole-number exponent, and negative numbers have real roots only for odd indexes. Definitions and special values follow NIST DLMF §4.2 and §4.4. Everything runs in your browser and nothing you type is sent anywhere.

Sources

More: Algebra and number theoryAll math & numbersAll toolsHome & DIY calculators