Factorial Calculator (n!)
The factorial n! is the product of all whole numbers from 1 to n. It counts the number of ways to arrange things and appears throughout probability and combinatorics.
How to use the factorial calculator
Enter a whole number n from 0 to 170. The calculator shows n! and how many digits it has. Results above 15 digits are shown in scientific notation.
Factorial formula
n! = n × (n − 1) × (n − 2) × … × 2 × 1
Factorial table
| n | n! |
|---|---|
| 0 | 1 |
| 1 | 1 |
| 2 | 2 |
| 3 | 6 |
| 4 | 24 |
| 5 | 120 |
| 6 | 720 |
| 7 | 5,040 |
| 8 | 40,320 |
| 9 | 362,880 |
| 10 | 3,628,800 |
| 11 | 39,916,800 |
| 12 | 479,001,600 |
| 13 | 6,227,020,800 |
| 14 | 87,178,291,200 |
| 15 | 1,307,674,368,000 |
| 16 | 20,922,789,888,000 |
| 17 | 355,687,428,096,000 |
| 18 | 6,402,373,705,728,000 |
| 19 | 121,645,100,408,832,000 |
| 20 | 2,432,902,008,176,640,000 |
How fast factorials grow
| n | n! (approx.) | Digits |
|---|---|---|
| 25 | 1.551e+25 | 26 |
| 50 | 3.041e+64 | 65 |
| 52 | 8.066e+67 | 68 |
| 70 | 1.198e+100 | 101 |
| 100 | 9.333e+157 | 158 |
| 170 | 7.257e+306 | 307 |
52! — the number of ways to shuffle a deck of cards — has 68 digits.
Stirling’s approximation
For large n:
n! ≈ √(2πn) × (n ÷ e)n
At n = 10 it gives 3,598,696, within 0.83% of the true 3,628,800, and it gets more accurate as n grows.
Where factorials are used
- Permutations: arranging n items in order — n!. See the permutations calculator.
- Combinations: n! ÷ (r!(n − r)!). See the combinations calculator.
- Probability: binomial and Poisson distributions.
- Series: Taylor series for eˣ, sin x and cos x.
Frequently asked questions
What is a factorial?
The product of all whole numbers from 1 to n. 5! = 5 × 4 × 3 × 2 × 1 = 120.
What is 0 factorial?
0! = 1, by definition. It keeps formulas for combinations and permutations consistent.
Why is 170 the limit?
171! is larger than the biggest number standard double-precision arithmetic can store (about 1.8 × 10³⁰⁸).
Can I take the factorial of a decimal?
The gamma function extends factorials to non-integers, with n! = Γ(n + 1). The calculator returns Γ(n + 1) for decimal inputs.