n! is the product of every whole number from 1 to n, and 0! is 1. That last one is not a convention: the recurrence n! = n × (n−1)! read backwards gives 1! = 1 × 0!, so 0! must be 1. Counting says the same — there is exactly one way to arrange nothing. 20! is the largest that fits a normal calculator; everything here is computed on whole numbers, so 100!’s 158 digits are all real.
Why 0! is 1
Two independent arguments, and neither is “by convention”.
The recurrence. n! = n × (n−1)! is what defines a factorial. Read it at n = 1: 1! = 1 × 0!. Since 1! is 1, 0! has to be 1. Anything else breaks the definition at its very first step.
The counting. n! counts the orderings of n things. There is exactly ONE way to arrange nothing — the empty arrangement. Zero ways would mean the empty list cannot exist.
It is also what makes C(n, 0) = 1 come out right, and the binomial theorem, and every power series whose first term has a 0! in the denominator.
Counting the trailing zeros
100! ends in 24 zeros, and you can know that without computing 100!.
Every trailing zero needs a factor of 10, which needs a 2 and a 5. Factorials contain far more 2s than 5s, so the 5s are the limit. Count them: 20 multiples of 5 below 100, plus 4 more from the multiples of 25, which each contribute a second 5. That is 24.
This is Legendre’s formula, and the page shows the sum row by row. It works at any size — 1000! ends in 249 zeros by the same argument — and it is genuinely faster than looking, because it never builds the number.
Where a double gives up
20! is 2,432,902,008,176,640,000, which fits a JavaScript number exactly. 21! does not: it is the first factorial a double gets wrong.
Past that, floating point gives you about seventeen correct digits and an exponent. 100! shows as 9.33262154439441e+157, which is right to sixteen figures and silent about the other 142.
This page computes on integers of unlimited size, so every digit is real. It also reports the digit count, which is often the number you actually wanted — nobody needs all 2568 digits of 1000!, but knowing there are 2568 is useful.
Stirling’s approximation
n! ≈ √(2πn) × (n/e)ⁿ. It looks like an odd formula and it is remarkably good: about 8% off at n = 1, under 1% by n = 10, and under 0.1% by n = 100.
The relative error shrinks like 1/(12n), so the approximation gets better exactly where the exact computation gets harder. That is why it is the tool of choice in analysis and in algorithm cost estimates.
This page shows the approximation and the percentage it is actually off by, side by side with the exact value. An approximation quoted without its error is not much of an answer.
How fast they grow
Factorials outgrow every exponential. 2ⁿ doubles at each step; n! multiplies by n, and n keeps getting bigger.
At n = 10 they are already far apart: 2¹⁰ is 1024 and 10! is 3,628,800. By n = 100 the gap is 128 digits.
It is why brute-forcing an ordering is hopeless. Fifteen items have over a trillion arrangements; twenty have two and a half quintillion. Any algorithm that tries them all stops being usable somewhere around n = 12.
What factorials count
Arrangements. n! is the number of ways to order n distinct things. Five books on a shelf: 120 orders.
Combinations. C(n, k) = n!/(k!(n−k)!) counts choices where order does not matter. In practice nobody computes it that way — theBinomial Coefficient Calculator uses the multiplicative form, which never builds a factorial at all.
Series. eᵙ, sin x and cos x all have factorials in their denominators. It is why those series converge so quickly: the denominators outrun anything the numerators do.
Sources and methodology
Factorials, Legendre’s formula and Stirling’s approximation are all classical results.
Method. The product is computed on BigInt, so the result is exact at any size. The trailing-zero count is not read off the digits: it is Legendre’s sum of ⌊n/5^k⌋, which is why it is available even for values too large to display. Stirling’s approximation is computed in floating point and reported with the percentage error it actually made, rather than being presented as an answer. That engine is verified on every change against 68 hand-written assertions, including that every factorial to four hundred matches an independently written BigInt product and that the trailing-zero count matches a separately computed Legendre sum. The count and the per-case breakdown are published on the formula verification page.
Read the guide
Factorials usually appear on the way to a binomial coefficient, and the Binomial Coefficient Calculator computes those WITHOUT building the factorials — which is why it handles C(200, 100) instantly where the factorial route would not. The Gamma Function Calculator extends factorials to non-integers.