Factorial Calculator (n!)

Find the exact factorial of any whole number from 0 to 10,000, with its number of digits, trailing zeros and a step-by-step breakdown.

A whole number from 0 to 10,000.
Number of digits
19
Trailing zeros
4
Scientific notation
2.432902008 × 10¹⁸
Sum of the digits
54
Stirling's estimate
≈ 2.42279 × 10¹⁸0.416% below the exact value
20! (20 factorial)2,432,902,008,176,640,00019 digits

Show the work

  1. Definition: n! = n × (n − 1) × … × 2 × 1, so 20! = 20 × 19 × 18 × … × 2 × 1
  2. Using the previous factorial: 20! = 20 × 19! = 20 × 121,645,100,408,832,000 = 2,432,902,008,176,640,000
  3. Trailing zeros: each final zero needs a factor 10 = 2 × 5, and fives are scarcer than twos, so count the fives (Legendre's formula): ⌊20/5⌋ = 4
  4. Digit count: ⌊log10(20!)⌋ + 1 = ⌊18.3861⌋ + 1 = 19
Factorials from 0! to 20!
n!ValueDigits
0!11
1!11
2!21
3!61
4!242
5!1203
6!7203
7!5,0404
8!40,3205
9!362,8806
10!3,628,8007
11!39,916,8008
12!479,001,6009
13!6,227,020,80010
14!87,178,291,20011
15!1,307,674,368,00013
16!20,922,789,888,00014
17!355,687,428,096,00015
18!6,402,373,705,728,00016
19!121,645,100,408,832,00018
20!2,432,902,008,176,640,00019

The factorial of n, written n!, multiplies every whole number from 1 up to n. It counts how many ways n different objects can be lined up, and it sits inside nearly every counting formula — permutations, combinations, probabilities and series. Factorials also grow explosively, so ordinary calculators overflow after 170!. This one uses exact integer arithmetic and returns every digit of n! for any n from 0 to 10,000, along with the digit count, the number of trailing zeros and Stirling’s approximation.

How to use the factorial calculator

  1. Enter a whole number from 0 to 10,000 in Number (n).
  2. Read n! on the tape. Up to 24 digits are shown in full; longer results show a scientific approximation on the tape and the complete number underneath, ready to select and copy.
  3. Check the extra rows: number of digits, trailing zeros, scientific notation, the sum of the digits and Stirling’s estimate with its percentage error.
  4. For n up to 50, a table lists every factorial from 0! to n!.

Factorial formula

n! = n × (n − 1) × (n − 2) × ⋯ × 2 × 1,   0! = 1

The recursive form is often handier:

n! = n × (n − 1)!

The number of trailing zeros comes from Legendre’s formula, which counts the factors of 5:

zeros = ⌊n/5⌋ + ⌊n/25⌋ + ⌊n/125⌋ + ⋯

Worked example: 20!

20! = 20 × 19 × 18 × ⋯ × 2 × 1

Using 19! = 121,645,100,408,832,000: 20! = 20 × 121,645,100,408,832,000 = 2,432,902,008,176,640,000

Digits: 19. Trailing zeros: ⌊20/5⌋ = 4.

20! is the largest factorial that fits in a signed 64-bit integer, which is why many programming languages give wrong answers from 21! onward unless they use big-number arithmetic, as this calculator does.

Factorials from 0! to 15!

n n! n n!
0 1 8 40,320
1 1 9 362,880
2 2 10 3,628,800
3 6 11 39,916,800
4 24 12 479,001,600
5 120 13 6,227,020,800
6 720 14 87,178,291,200
7 5,040 15 1,307,674,368,000

How big factorials get

A standard deck of cards can be shuffled into 52! ≈ 8.07 × 10⁶⁷ different orders, a 68-digit number. 70! ≈ 1.198 × 10¹⁰⁰ is the first factorial larger than a googol. 1000! has 2,568 digits, and 10,000! has 35,660 digits, 2,499 of which are trailing zeros.

For an estimate without multiplying everything out, use Stirling’s approximation, published by James Stirling in 1730:

n! ≈ √(2πn) · (n/e)n

It is always slightly low, by roughly 1/(12n): about 8% for n = 1, 0.42% for n = 20 and under 0.01% for n = 1,000. The tape shows the exact error for your n.

Where factorials are used

  • Arrangements: n! ways to order n distinct items; see the permutations calculator for arranging only some of them.
  • Choices: binomial coefficients C(n, r) = n! ÷ (r!(n − r)!), used by the combinations calculator.
  • Series: e = 1/0! + 1/1! + 1/2! + ⋯, and the Taylor series for sine, cosine and the exponential all divide by factorials.
  • Probability: the Poisson distribution and multinomial probabilities both contain factorials.

A short history of the notation

Products of consecutive integers were studied for centuries, but the exclamation mark is fairly recent. The French mathematician Christian Kramp introduced the notation n! in 1808, partly because printers found it easier to set than the competing symbols of the time. Related products that skip numbers, such as 9!! = 9 × 7 × 5 × 3 × 1, are handled by the multifactorial calculator.

Frequently asked questions

What is a factorial?

The factorial of a whole number n, written n!, is the product of all whole numbers from 1 to n. For example, 5! = 5 × 4 × 3 × 2 × 1 = 120. It counts the ways to arrange n different objects in a row.

Why is 0! equal to 1?

0! is the empty product — nothing multiplied together — which is 1, just as an empty sum is 0. It also matches counting: there is exactly one way to arrange zero objects, and it keeps formulas such as n! = n × (n − 1)! and C(n, 0) = 1 consistent.

How many trailing zeros does 100! have?

24. Each trailing zero needs a factor of 10 = 2 × 5, and fives are the scarcer factor. 100! contains ⌊100/5⌋ + ⌊100/25⌋ = 20 + 4 = 24 factors of 5.

How many digits does 1000! have?

1000! has 2,568 digits and begins 4.0238726 × 10^2567. 10,000! has 35,660 digits. The calculator prints every digit.

Can I take the factorial of a negative number or a fraction?

Not with this calculator, which works with whole numbers from 0 to 10,000. The gamma function extends the factorial to fractions, with x! = Γ(x + 1); for example, (1/2)! = √π / 2 ≈ 0.8862. Negative whole numbers have no factorial.

Last reviewed October 2026 by the CalcFluent editorial team. How we check our calculators.