Factorial Calculator: Exact Factorials With Digit Counts
Enter a whole number from 0 to 300 to get its exact factorial, the number of digits in the answer, and how many trailing zeros it ends with.
Formulas verified against standard references. Calculator logic tested with verified worked examples. Last reviewed: October 2026. Our methodology
How a Factorial Works
A factorial counts arrangements. The factorial of n, written n with an exclamation mark, is the product of every whole number from 1 up to n. So 5 factorial is 5 times 4 times 3 times 2 times 1, which equals 120. That is the number of ways to order 5 distinct items, because there are 5 choices for the first position, 4 for the second, 3 for the third, 2 for the fourth, and 1 for the last.
By definition, 0 factorial equals 1. There is exactly one way to arrange nothing, and that convention makes formulas for combinations and permutations work cleanly at the edges. Factorials grow extremely fast: 10 factorial is already 3,628,800, 20 factorial is about 2.43 times 10 to the power 18, and 100 factorial has 158 digits.
For choosing items without caring about order, a permutation and combination calculator uses factorials directly.

The Factorial Formula
The definition is a simple recurrence: n factorial equals n times the factorial of n minus 1, with 0 factorial equal to 1. So 6 factorial is 6 times 5 factorial, which is 6 times 120, which is 720. That recurrence is also how this calculator builds the answer, multiplying upward from 1 with exact integer arithmetic, so the result has no rounding error.
Trailing zeros come from factors of 10, and each factor of 10 needs one 2 and one 5. Since factors of 2 are plentiful, the count of trailing zeros is the count of factors of 5: floor of n over 5, plus floor of n over 25, plus floor of n over 125, and so on. For 20, that is 4 plus 0, which is 4, and indeed 20 factorial ends in 4 zeros.
| n | n! | Digits |
|---|---|---|
| 0 | 1 | 1 |
| 5 | 120 | 3 |
| 10 | 3,628,800 | 7 |
| 20 | 2,432,902,008,176,640,000 | 19 |

Worked Examples
Example 1: 5 factorial. Multiply 5 times 4 times 3 times 2 times 1 to get 120. Example 2: 0 factorial. By definition, the answer is 1. Example 3: 10 factorial. The product of 1 through 10 is 3,628,800, which has 7 digits and 2 trailing zeros.
Example 4: 20 factorial. The exact value is 2,432,902,008,176,640,000, with 19 digits and 4 trailing zeros. Example 5: how many ways can 4 books be ordered on a shelf. The answer is 4 factorial, which is 24.
| Problem | Answer | Check |
|---|---|---|
| 5! | 120 | 5 x 4 x 3 x 2 x 1 |
| 0! | 1 | By definition |
| 10! | 3,628,800 | 7 digits, 2 trailing zeros |
| 20! | 2,432,902,008,176,640,000 | 19 digits, 4 trailing zeros |
How Fast Factorials Grow
Factorials outgrow exponentials, which is why they appear in probability problems with surprisingly large answers. The number of ways to shuffle a deck of 52 cards is 52 factorial, a number with 68 digits, far larger than the number of atoms in the observable universe is often quoted to be, and far beyond anything a human could list.
Stirling's approximation estimates large factorials: n factorial is about the square root of 2 pi n, times n over e, all to the power n. For 20, that estimate is close to the exact value, and for larger n the relative error shrinks, which is why statisticians use it when exact values are unwieldy.
| n | Digits in n! | Trailing zeros |
|---|---|---|
| 25 | 26 | 6 |
| 50 | 65 | 12 |
| 100 | 158 | 24 |
| 300 | 615 | 74 |
Common Mistakes
The most common mistake is adding instead of multiplying: 5 factorial is not 5 plus 4 plus 3 plus 2 plus 1, which is 15, but the product, which is 120. Another mistake is starting from 0: multiplying by 0 would give 0, so the product runs from 1 to n, with 0 factorial handled separately as 1.
A third mistake is applying factorials to fractions or negatives. Factorials are defined for whole numbers from 0 upward in this calculator. The gamma function extends the idea to other values in advanced mathematics, but it is not a factorial in the ordinary sense, and it is not what counting problems need.
When to Use a Factorial Calculator
Factorials count permutations, combinations, and probability outcomes: lottery odds, seating arrangements, password possibilities, and card shuffles all start with a factorial. They also appear in series expansions in calculus, such as the Taylor series for the exponential function, where each term divides by a factorial.
For prime-related counting questions, a prime number calculator checks primality and factors. Use this factorial calculator whenever a problem asks how many orders or arrangements a set of distinct items has.

Frequently asked questions
What is a factorial?
The product of every whole number from 1 up to n. 5 factorial is 5 times 4 times 3 times 2 times 1, which equals 120.
What is 0 factorial?
1, by definition. There is exactly one way to arrange nothing, and that convention keeps combination formulas working.
What is 5 factorial?
120. It is also the number of ways to order 5 distinct items.
What is 20 factorial?
2,432,902,008,176,640,000. It has 19 digits and ends in 4 trailing zeros.
Why do factorials grow so fast?
Each step multiplies by a larger number, so growth accelerates. 10 factorial is 3,628,800, and 52 factorial has 68 digits.
How many trailing zeros does 100 factorial have?
24. Count factors of 5: 20 from multiples of 5, plus 4 from multiples of 25, which is 24.
Can I take the factorial of a negative number?
Not in ordinary counting mathematics. Factorials here are defined for whole numbers from 0 upward.