Factorial Calculator

Computes n! for whole numbers up to 20, showing the full multiplication. The limit is not arbitrary — 21! is the first factorial that cannot be represented exactly in a JavaScript number.

Live demo · real result from this tool
20!2,432,902,008,176,640,000
Digits
19
Trailing zeros
4
Scientific
2.432902008 × 10¹⁸

Expansion

20! = 20 × 19 × 18 × 17 × 16 × 15 × 14 × 13 × 12 × 11 × 10 × 9 × 8 × 7 × 6 × 5 × 4 × 3 × 2 × 1 = 2432902008176640000

Exact value

2432902008176640000

Processed on your device — nothing is uploaded.

How to use Factorial Calculator

  1. Enter a whole number from 0 to 20.
  2. Read the result and the full multiplication.
  3. 0! is 1, by definition and by necessity.
  4. The 20 limit is where exact integer representation ends in a double — beyond it, results would be silently wrong.
  5. Factorials of negative numbers are undefined; the gamma function extends to non-integers but not to negative integers.

Why it stops at 20

JavaScript numbers are IEEE-754 doubles, which hold integers exactly only up to 2⁵³, about 9.007 quadrillion. 20! is 2,432,902,008,176,640,000, comfortably inside that. 21! is 51,090,942,171,709,440,000, which is not — so a calculator that kept going would return confidently wrong digits. Refusing is better than lying. Beyond 20, exact factorials need arbitrary-precision arithmetic, which JavaScript provides through BigInt.

How fast it grows

Factorial growth outruns exponential growth. 10! is 3.6 million; 20! is 2.4 quintillion; 70! already exceeds the number of atoms in the observable universe. This is why brute-force algorithms with factorial complexity are hopeless: the travelling salesman problem checked exhaustively over 20 cities is 20! routes, which at a billion per second takes 77 years. Over 25 cities it outlives the solar system.

Why 0! is 1

It looks like a convention and it is forced. The recurrence n! = n × (n−1)! with 1! = 1 requires 0! = 1. Combinatorially, n! counts the arrangements of n objects, and there is exactly one way to arrange nothing — the empty arrangement. It also makes the binomial coefficient formula work at its edges without special cases, which is the practical reason it is defined that way rather than left undefined.

Where factorials are used

Permutations and combinations, which is most of discrete probability. The binomial coefficient n!/(k!(n−k)!) counting how many ways to choose k from n. Taylor series, where factorials sit in every denominator. And the gamma function, which extends factorial to non-integers and gives the famous result that the factorial of a half is half the square root of pi.

Frequently asked questions

What is a factorial?
n! is the product of all positive integers up to n, so 5! = 5 × 4 × 3 × 2 × 1 = 120.
What is 0! equal to?
0! is defined as 1, a convention that keeps combinatorics formulas consistent.
Why is the limit 20!?
20! is the largest factorial that fits exactly in a standard 64-bit number without losing precision.
Why can I not calculate 21 factorial?
Because it exceeds the largest integer a JavaScript number represents exactly (2⁵³). The calculator would return a number that looks precise and is wrong in its final digits, so it declines instead. Exact values beyond 20! need arbitrary-precision arithmetic.
What is 0 factorial?
1. The recurrence relation requires it, and combinatorially there is exactly one way to arrange zero objects. It also keeps the binomial coefficient formula valid at its boundaries.
How big does a factorial get?
Extremely fast. 10! is 3.6 million, 20! is 2.4 quintillion, and 70! exceeds the estimated number of atoms in the observable universe. Factorial growth outpaces any exponential, which is why factorial-time algorithms are unusable beyond tiny inputs.

Written by the ToolsRift team · Last updated

Pages are drafted with AI assistance and checked by automated tests. How we write and check pages.

Was this tool useful?

Report a problem

Start typing to search every tool.

↑ ↓ to moveEnter to openEsc to close