Guide
Computing n factorial exactly, with digit counts, trailing zeros and the double factorial
A factorial multiplies a whole number by every smaller positive whole number, so 5 factorial is 5 × 4 × 3 × 2 × 1, which is 120. It counts the ways to put n different things in a row, and it grows faster than almost anything else you meet in school maths. This page gives exact values, so you can see every digit instead of the rounded figure a pocket calculator shows.
How it works
The tool multiplies the numbers from 1 up to n using big integers, a number type with no fixed size. Ordinary floating-point numbers hold about fifteen significant digits, so a program that computes 25 factorial with them already gets the last digits wrong. Exact integers do not lose anything, and the page can go up to 3,000 factorial, a number with more than 9,000 digits. Short results, such as 30 factorial with its 33 digits, are written out in full. Longer ones are shown in scientific notation together with the digit count, and a text box named All digits of n! holds every digit, with a button to copy it and one to download it as a file such as factorial-100.txt.
What the results show
You get the value, the number of digits, the count of zeros at the end and the value in scientific notation. The line about ways to arrange n different things repeats the value in words that match the question most people have in mind. The double factorial, written n with two exclamation marks, multiplies every second number down from n, so 20 double factorial is 20 × 18 × 16 and so on down to 2, which is 3,715,891,200, and 7 double factorial is 7 × 5 × 3 × 1, or 105.
Trailing zeros
Each trailing zero in a factorial comes from a factor of 10, which is a pair of 2 and 5. There are always more 2s than 5s, so the number of zeros equals the number of 5s in the product. That is n divided by 5, plus n divided by 25, plus n divided by 125, and so on, each rounded down. For 100 that gives 20 + 4 = 24 zeros, and for 20 it gives 4 + 0 = 4. The tool uses this rule rather than counting digits of the huge number.
Edge cases
The input must be a whole number from 0 to 3,000, and anything else is rejected with a message. Negative numbers and fractions do not have a factorial here, since that would need the gamma function, which this page does not implement. 0 factorial and 1 factorial are both 1, and the double factorial of 0 is also 1.
A worked example
20 factorial is 2,432,902,008,176,640,000, which is 2.4329020081 × 10^18, with 19 digits and 4 zeros at the end. 52 factorial, the number of orderings of a deck of cards, is 8.065817517 × 10^67 with 68 digits and 12 trailing zeros. 100 factorial is 9.3326215443 × 10^157, a number with 158 digits and 24 trailing zeros, and its double factorial has 80 digits. 0 factorial is 1.
Limits
The page handles whole numbers up to 3,000 only, and it does not approximate larger values with Stirling’s formula. It does not compute permutations or combinations directly, so use the dedicated page when you need n choose k.
Related tools
- Permutation Calculator divides factorials to count ordered selections.
- Prime Factorization Calculator breaks an ordinary number into primes, as factorials can be broken into small ones.
- Fibonacci Calculator is the other classic sequence whose terms outgrow a normal calculator.
- Scientific Calculator gives quick rounded values when exact digits are not needed.
Checked against the current version of the Factorial Calculator on .

