Factorial Calculator
Exact n! with digit count and trailing zeros, 0 to 18.
What it does
A factorial counts orderings: 3 books shelve 6 ways, 10 books shelve 3,628,800 ways. Each new item multiplies the running total by its position, so values explode far faster than the input grows.
The tool above takes 0 to 18 and returns the exact value with the digit count and trailing zeros beside it. The cap keeps every digit exact inside integer precision.
The default of 10 gives 3,628,800 across 7 digits ending in 2 zeros. Zero factorial reads 1 by definition, which keeps combination formulas working when choosing everything or nothing.
Definitions follow Khan Academy combinatorics units with the same exactness rules in LibreTexts math references. Both treat 0! as 1 and count trailing zeros from factors of five.
How to use
- Enter a whole number from 0 to 18.
- Read the exact factorial first.
- Use digits for the size feel.
- Use trailing zeros for fraction and modulo work.
- Split bigger counts into combinations instead.
Formula
- n!
- Orderings of n distinct items.
- 0!
- 1 by definition, the empty product.
- 5s
- Each factor of 5 with a 2 makes a trailing zero.
Inputs past 18 are rejected because doubles stop holding every digit exactly. Combinations and permutations pages build on these values for larger pools.
Worked example
Example: 10!
Number 10.
- Multiply down: 10 x 9 x 8 x 7 x 6 x 5 x 4 x 3 x 2 x 1.
- Running: 10, 90, 720, 5040, 30240, 181440, 362880, 1814400, 3628800.
- Result: 3,628,800 with 7 digits.
- Zeros: factors of 5 in 5 and 10 give 2 trailing zeros.
- Tool shows 3,628,800, 7 digits, 2 trailing zeros.
Reference table
| n | n! | Digits |
|---|---|---|
| 0 | 1 | 1 |
| 5 | 120 | 3 |
| 10 | 3,628,800 | 7 |
| 15 | 1,307,674,368,000 | 13 |
| 18 | 6,402,373,705,728,000 | 16 |
Limits
- Exact range 0 to 18 only.
- Whole numbers only; fractions need gamma math.
- Counts orderings of distinct items alone.
- Huge pools need combinations, not raw factorials.
Common mistakes
- Adding instead of multiplying down the chain.
- Reading 0! as 0 instead of 1.
- Trusting rounded results past exact range.
- Forgetting repeated items divide the count.
- Mixing permutations with combinations.
Try it yourself
Quick checks. Answers sit tucked under each question.
5!?
120: 3 digits, 1 trailing zero.
0!?
1 by definition: 1 digit, no zeros.
Trailing zeros of 15!?
floor(15/5) + floor(15/25) = 3 + 0 = 3.
Questions
What is 10 factorial?
3,628,800: ten down to one multiplied.
Why is 0! equal to 1?
Empty product convention, keeping combination formulas consistent.
Why cap at 18?
Doubles hold integers exactly only to 2^53; 19! passes it.
Where do trailing zeros come from?
Paired factors of 2 and 5; fives are scarcer, so count them.
Factorial vs combinations?
Factorials order everything; combinations divide out the irrelevant order.
How fast does it grow?
Faster than exponential: 10! is millions, 18! is quadrillions.