Factorial Calculator
n! (n factorial) means multiply every whole number from 1 up to n: 5! = 5 × 4 × 3 × 2 × 1 = 120. Factorials grow astonishingly fast — 20! is already over 2 quintillion — so this calculator uses exact integer arithmetic and shows every digit, not a rounded approximation.
Enter a whole number from 0 to 170 and get the exact factorial, the number of digits and the trailing zeros.
Result
How It Works
The factorial of a whole number n is the product of every whole number from 1 to n: n! = 1 × 2 × 3 × … × n. So 5! = 5 × 4 × 3 × 2 × 1 = 120. By definition 0! = 1 — the empty product — which also keeps the rule n! = n × (n − 1)! working all the way down: 1! = 1 × 0! forces 0! to be 1.
Factorials grow faster than almost anything you meet in everyday maths. 10! is 3,628,800, 20! is over 2 quintillion, and 100! has 158 digits. That growth is why exactness matters: ordinary floating-point arithmetic rounds after about 16 digits, so a standard calculator's answer for 25! is already wrong in its last digits. This page multiplies exact integers (BigInt), so every digit shown is correct.
Trailing zeros are counted by factors of 5. Each trailing zero needs one factor of 2 and one factor of 5; 2s are plentiful, so the count is the number of 5s in 1 × 2 × … × n: floor(n/5) + floor(n/25) + floor(n/125) + … For 100! that is 20 + 4 = 24 trailing zeros.
Worked Examples
5! = 5 × 4 × 3 × 2 × 1 = 120.
20! = 2,432,902,008,176,640,000 — 19 digits, with 4 trailing zeros.
100! has 158 digits and 24 trailing zeros.
170! ≈ 7.257416 × 10³⁰⁶ — 307 digits, the largest factorial this calculator shows.
Assumptions
- n must be a whole number from 0 to 170. Decimals, negative numbers and numbers above 170 show a clear message instead of a wrong answer.
- Exact integer arithmetic throughout. The value shown is the true factorial, digit for digit — never a floating-point approximation.
- Trailing zeros are counted by factors of 5 (Legendre's formula), which is exact for every n.
- Scientific notation is rounded to 6 decimal places and marked with ≈ — it is a compact way to read a huge number, not the exact value.
Last reviewed: 15 November 2026.
Built and tested by SumKitTool — see how we check our numbers.
How to Use This Calculator
Enter a whole number from 0 to 170. The exact factorial, digit count and trailing zeros update live as you type.
- Enter n — any whole number from 0 to 170.
- Read the exact value in the headline (for very large factorials the headline shows scientific notation and the exact value is in the table).
- Check the digit count and trailing zeros in the table below.
The Reset button restores the worked example (20! = 2,432,902,008,176,640,000).
Tips and Practical Advice
- 0! = 1 trips people up. It is not 0 — it is the empty product, and combinatorics depends on it: there is exactly one way to arrange zero objects.
- 52! counts the shuffles of a deck of cards — it has 68 digits, so every shuffle you deal is almost certainly one nobody has ever seen before.
- For arrangements and selections, use the Permutation and Combination Calculator — it applies n! for you instead of making you divide huge factorials by hand.
- Do not trust a phone calculator past 21! — its last digits are rounded guesses. This page shows the exact integer up to 170!.
Frequently Asked Questions
What is a factorial?
The factorial of a whole number n, written n!, is the product of every whole number from 1 to n. So 5! = 5 × 4 × 3 × 2 × 1 = 120. Factorials count arrangements: n! is the number of ways to order n different objects.
Why is 0! equal to 1?
By definition, and because it keeps the maths consistent: n! = n × (n − 1)!, so 1! = 1 × 0! forces 0! to be 1. It also matches combinatorics — there is exactly one way to arrange zero objects: the empty arrangement.
Why does this calculator stop at 170!?
Two reasons. First, 171! is larger than the biggest number standard floating-point arithmetic can hold (about 1.8 × 10³⁰⁸), so ordinary calculators overflow. Second, exact values beyond 170! run past 300 digits. 170! itself is about 7.257416 × 10³⁰⁶.
How many trailing zeros does 100! have?
24. Trailing zeros come from factors of 10, and each 10 needs a 2 and a 5 — 5s are scarcer, so you count them: 100 ÷ 5 = 20, plus 100 ÷ 25 = 4, giving 24. This calculator counts them the same way for any n up to 170.
Last updated: