Quick Answer
n! (n factorial) is the product of all whole numbers from 1 to n. 5! = 5 × 4 × 3 × 2 × 1 = 120, and 20! = 2,432,902,008,176,640,000. 100! has 158 digits and ends in 24 zeros.
Embed this calculator
Adjust the size if needed, then copy the code below into your page or blog. The calculator will load in an iframe and stay updated automatically.
Table of Contents
- Factorial Calculator
- Quick Answer
- Related Calculators
- How This Factorial Calculator Works
- How to Use the Factorial Calculator
- Core Formulas
- Key Terms
- Worked Example
- Real-Life Examples
- Factorial vs Exponent
- Factorials from 0 to 21
- Where Factorials Are Used
- Counting Arrangements With Factorials
- Common Mistakes to Avoid
- Frequently Asked Questions
- References & Sources
How This Factorial Calculator Works
Enter a whole number n from 0 to 5,000. The calculator multiplies every whole number from 1 up to n using exact big-integer math, so no digits are lost. It shows the result, how many digits it has, how many zeros it ends in, the value in scientific notation and, for smaller n, how close Stirling's approximation comes. The full number appears in a scrolling box you can copy.
Quick explanation: factorials grow extremely fast.
- 5! = 120
- 10! = 3,628,800
- 0! = 1, by definition
How to Use the Factorial Calculator
- Enter a whole number from 0 to 5,000.
- Press Calculate.
- Read n!, its digits and trailing zeros.
- See the scientific notation for very large values.
- Copy the exact value from the box if you need it.
Core Formulas
- Factorial: n! = n × (n − 1) × ... × 2 × 1
- Recursive form: n! = n × (n − 1)!, with 0! = 1
- Trailing zeros: ⌊n/5⌋ + ⌊n/25⌋ + ⌊n/125⌋ + ...
- Stirling's approximation: n! ≈ √(2πn) × (n/e)n
Key Terms
- Factorial: the product of all whole numbers from 1 to n, written n!.
- Permutation: an ordered arrangement of items.
- Trailing zeros: the zeros at the end of a number.
- Stirling's approximation: a formula that estimates n! for large n.
- Gamma function: an extension of the factorial to non-whole numbers.
Worked Example
How many zeros are at the end of 100!?
- ⌊100/5⌋ = 20 multiples of 5
- ⌊100/25⌋ = 4 extra fives from 25, 50, 75 and 100
- Total = 20 + 4 = 24 trailing zeros
Real-Life Examples
- Seating: 8 people can sit in a row in 8! = 40,320 ways.
- Card shuffles: a 52-card deck can be ordered in 52! ways, a 68-digit number.
- Lottery odds: combinations, which use factorials, give the chance of winning.
- Puzzles: count the ways to arrange the letters of a word.
Factorial vs Exponent
- Factorial: multiplies decreasing numbers, n × (n − 1) × ...
- Exponent: multiplies the same number, n × n × ...
- Growth: n! grows faster than any fixed base to the n, such as 10n, for large n.
Factorials from 0 to 21
| n | n! | n | n! |
|---|---|---|---|
| 0 | 1 | 11 | 39,916,800 |
| 1 | 1 | 12 | 479,001,600 |
| 2 | 2 | 13 | 6,227,020,800 |
| 3 | 6 | 14 | 87,178,291,200 |
| 4 | 24 | 15 | 1,307,674,368,000 |
| 5 | 120 | 16 | 20,922,789,888,000 |
| 6 | 720 | 17 | 355,687,428,096,000 |
| 7 | 5,040 | 18 | 6,402,373,705,728,000 |
| 8 | 40,320 | 19 | 121,645,100,408,832,000 |
| 9 | 362,880 | 20 | 2,432,902,008,176,640,000 |
| 10 | 3,628,800 | 21 | 51,090,942,171,709,440,000 |
Where Factorials Are Used
- Arrangements: n! counts the ways to order n different items.
- Combinations: n! appears in nCr = n! ÷ (r!(n − r)!).
- Probability: the binomial and Poisson formulas use factorials.
- Series: ex and sin x use factorials in their Taylor series.
Counting Arrangements With Factorials
The main everyday use of n! is counting orders. If you have n different items, there are n choices for the first place, n − 1 for the second, and so on, which multiplies out to n!.
- All items: 6 books on a shelf can be arranged in 6! = 720 ways.
- Only some items: to fill 3 places from 10 people, use 10! ÷ 7! = 720.
- Repeated items: the letters of BOOK can be arranged in 4! ÷ 2! = 12 ways, because the two Os look the same.
When order does not matter, divide again by the factorial of the group size. That gives combinations, which our Combination Calculator works out step by step. Both ideas start from the same simple factorial.
Common Mistakes to Avoid
- Thinking 0! = 0. It equals 1.
- Using decimals. The factorial here is for whole numbers. Non-whole values use the gamma function.
- Rounding big results. Normal calculators lose digits after about 15 to 17 figures.
- Counting zeros by multiples of 10 only. Each factor of 5 paired with a 2 adds a zero.
- Confusing n! with n!!. The double factorial multiplies every other number.
Frequently Asked Questions
The product of all positive whole numbers up to n. 4! = 4 × 3 × 2 × 1 = 24.
1. This keeps formulas like nCr working.
3,628,800.
158.
24.
No. Factorials are defined for whole numbers 0 and up.
Not with this definition. The gamma function extends it, with Γ(n + 1) = n!.
Each step multiplies by a larger number.
5,000!, which has over 16,000 digits.
Add ⌊n/5⌋ + ⌊n/25⌋ + ⌊n/125⌋ and so on.
n! ≈ √(2πn)(n/e)ⁿ, which gets more accurate as n grows.
nCr = n! ÷ (r!(n − r)!). See our Combination Calculator.
References & Sources
| Source | Used For | Link |
|---|---|---|
| Wikipedia, Factorial | Definition, growth, trailing zeros and Stirling's approximation. | https://en.wikipedia.org/wiki/Factorial |
| OEIS, A000142: Factorial numbers | The sequence of factorials. | https://oeis.org/A000142 |