Factorial calculator
The factorial of a number, written n!, is the product of every whole number from n down to 1. It is one of the most common building blocks in combinatorics — counting permutations, combinations and arrangements — and it appears in probability, calculus (Taylor series) and statistics. This calculator returns the exact value of n! for any non-negative integer, not a rounded approximation, and shows how many digits the answer has.
How it works
The tool multiplies n × (n−1) × (n−2) × … × 2 × 1 using JavaScript’s BigInt type, which supports arbitrary-precision integers. Because ordinary floating-point numbers lose precision above 2^53, BigInt is essential for large factorials — it stores every digit exactly. By definition 0! = 1. To keep the browser responsive the exact path is capped at 5000!, and the digit count is displayed alongside the result.
Example
For n = 10: 10! = 10 × 9 × 8 × 7 × 6 × 5 × 4 × 3 × 2 × 1 = 3,628,800 (7 digits). This is the number of different ways to order 10 distinct items.
| n | n! | Digits |
|---|---|---|
| 0 | 1 | 1 |
| 5 | 120 | 3 |
| 10 | 3,628,800 | 7 |
| 13 | 6,227,020,800 | 10 |
| 20 | 2,432,902,008,176,640,000 | 19 |
Everything runs locally in your browser — the number you enter never leaves your device.