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.
Reference values
| 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 |
| 52 | 8.07 × 10⁶⁷ | 68 |
| 100 | 9.33 × 10¹⁵⁷ | 158 |
For n = 10: 10! = 10 × 9 × 8 × 7 × 6 × 5 × 4 × 3 × 2 × 1 = 3,628,800 (7 digits). This is the number of distinct orderings of 10 items — for example, the number of ways to arrange 10 runners at the start of a race.
Where factorials come up
Permutations — the number of ways to arrange n distinct items in order is n!. If you have 5 books to place on a shelf, there are 5! = 120 possible arrangements.
Combinations (choosing k from n) — the binomial coefficient “n choose k” is n! ÷ (k! × (n−k)!). Factorials appear three times in this formula, which is why a factorial calculator is a natural companion to combination problems.
Probability — many probability calculations involve counting arrangements. For example, the probability that a randomly shuffled deck of 52 cards comes out in a specific order is 1 ÷ 52!, an astronomically small number with 68 digits.
Taylor series in calculus — the expansion of functions like e^x and sin(x) uses factorials in the denominator of each term (e^x = 1 + x/1! + x²/2! + x³/3! + …). The factorial makes the series converge by shrinking each term faster than the powers grow.
Statistics — the Poisson distribution, the binomial distribution, and many combinatorial statistics formulas have factorials in them.
Why BigInt matters for large factorials
A standard JavaScript number (64-bit floating point, IEEE-754) can only represent integers exactly up to 2^53 − 1, which is about 9 quadrillion. Already by n = 18, the factorial exceeds that ceiling, and floating-point would start rounding. The tool uses BigInt, which allocates as many bits as the number needs, storing every digit of even a 16,000-digit result exactly. This is the difference between getting an exact answer and getting a rounded estimate — which matters if you are computing combination counts for cryptographic or statistical purposes.
Everything runs locally in your browser — the number you enter never leaves your device.