About the Factorial Calculator
A factorial multiplies every whole number from your number down to one. Five factorial, written 5!, is 5 × 4 × 3 × 2 × 1 = 120.
The definition is trivial. What is not trivial is how fast it grows. Ten factorial is about 3.6 million. Twenty factorial is over two quintillion. Seventy factorial has more digits than there are atoms in the observable universe, by most estimates. Nothing else in elementary arithmetic accelerates like this.
That growth creates a practical problem. An ordinary calculator stores numbers as double-precision floats, which hold about 15 significant digits. From 18! onward the digits it shows are wrong, and from 171! it gives up and reports infinity. Ask most calculators for 100! and you get 9.33262154 × 10¹⁵⁷ — a rounded approximation of a number that has 158 exact digits.
This calculator uses arbitrary-precision integers, so every digit it reports is correct.
How to Use the Factorial Calculator
Factorial takes a whole number from 0 to 2000 and returns n! exactly. Very long results are shortened for display, with the full digit count shown.
Double factorial multiplies every second number: 7!! = 7 × 5 × 3 × 1 = 105. This is not the factorial applied twice, which is a common misreading.
Ratio of two factorials computes a! ÷ b!. This is the mode worth knowing about, because almost everything cancels: 100! ÷ 97! is just 100 × 99 × 98. Both factorials separately are astronomical; the ratio is a three-term multiplication. This is how combinatorics formulas are actually evaluated.
Alongside the answer you get the digit count and the number of trailing zeros.
How Factorials Are Calculated
The definition is recursive:
n! = n x (n-1)!
0! = 1
Each factorial is the previous one multiplied by n. Working up from the base case: 1! = 1, 2! = 2, 3! = 6, 4! = 24, 5! = 120.
Why 0! = 1 is the question everyone asks, and there are two good answers.
The counting answer: n! is the number of ways to arrange n objects in order. There is exactly one way to arrange nothing — the empty arrangement — so 0! = 1.
The pattern answer: dividing n! by n gives (n−1)!.
4! / 4 = 24 / 4 = 6 = 3!
3! / 3 = 6 / 3 = 2 = 2!
2! / 2 = 2 / 2 = 1 = 1!
1! / 1 = 1 / 1 = 1 = 0!
Continuing the pattern forces 0! to be 1. It is not a convention imposed from outside; it is the only value that keeps everything else consistent.
Trailing zeros have a neat closed form. Each zero at the end comes from a factor of 10, which needs a 2 and a 5. In any factorial, factors of 2 are far more plentiful than factors of 5, so the number of fives is the binding constraint. Legendre's formula counts them:
zeros in n! = floor(n/5) + floor(n/25) + floor(n/125) + ...
For 100!: 20 + 4 + 0 = 24 trailing zeros. You can state that without computing the 158-digit number at all.
Factorial Formula
n! = n x (n-1) x (n-2) x ... x 2 x 1
0! = 1
n!! = n x (n-2) x (n-4) x ... double factorial
a! / b! = a x (a-1) x ... x (b+1) for a >= b
Trailing zeros in n!:
floor(n/5) + floor(n/25) + floor(n/125) + ...
Factorials are the engine of combinatorics:
Permutations: nPr = n! / (n-r)!
Combinations: nCr = n! / (r! x (n-r)!)
Both are ratios, which is exactly why the ratio mode matters. Computing 52! to work out a card-hand probability is unnecessary and slow; the cancellation leaves a handful of terms.
Step-by-Step Example
Calculate 10!.
10 x 9 = 90
90 x 8 = 720
720 x 7 = 5040
5040 x 6 = 30240
30240 x 5 = 151200
151200 x 4 = 604800
604800 x 3 = 1814400
1814400 x 2 = 3628800
10! = 3,628,800. Note the two trailing zeros, and check them against Legendre: floor(10/5) = 2. Correct.
Now the ratio case. How many ways can three people finish first, second and third out of a hundred runners? That is 100 ÷ 97 factorial:
100! / 97! = 100 x 99 x 98 = 970,200
Three multiplications. Computing 100! first — a 158-digit number — and then dividing by another 152-digit number would give the same answer by an absurd route. Almost all of it cancels before you start.
Finally, watch where ordinary calculators break:
20! = 2,432,902,008,176,640,000 (exact, 19 digits)
21! = 51,090,942,171,709,440,000 (exact, 20 digits)
A double-precision float holds about 15-16 significant digits. From 18! onward the low-order digits are lost, so a standard calculator showing 21! as 5.109094217170944e+19 has quietly discarded the last four digits.
Understanding Your Result
The result is the exact value. Anything over 60 digits is abbreviated for display, with the beginning, the end and the total length shown — the full number for 1000! would fill several screens and communicate nothing.
The number of digits is often the more useful figure for large n. 1000! has 2,568 digits, which tells you the scale without any need for the digits themselves.
The trailing zeros count comes from Legendre's formula rather than from inspecting the answer, so it is available even for values too large to print.
Some anchors for the growth rate:
10! = 3.6 million
15! = 1.3 trillion
20! = 2.4 quintillion
52! = the number of ways to shuffle a deck of cards
(about 8 x 10^67 — more than the atoms in our galaxy)
That last one is worth sitting with. A properly shuffled deck has almost certainly never been in that order before in human history.
When Should You Use This Calculator?
Combinatorics. Permutations and combinations are factorial ratios. How many ways to pick a committee, order a playlist, deal a hand.
Probability. Card, lottery and birthday problems all reduce to counting arrangements.
Checking a homework answer exactly. When a question asks for a specific factorial value, an approximation in scientific notation does not count.
Series expansions. Taylor and Maclaurin series have factorials in every denominator, which is what makes them converge.
Understanding scale. Comparing 52! against physical quantities is the clearest demonstration of what combinatorial explosion means.
Algorithm analysis. An O(n!) algorithm is unusable past about n = 12, and seeing the numbers makes that concrete.
Common Mistakes
Thinking 0! should be 0. It is 1, for both the counting reason and the pattern reason given above. This trips up nearly everyone once.
Trying to take a factorial of a negative number. Undefined. Counting down in whole steps from −3 never reaches 1. The gamma function extends factorials to fractions and complex numbers, but negative whole numbers remain poles where the function is undefined.
Reading n!! as (n!)!. A double factorial steps by two: 7!! = 105. The factorial of 7! would be the factorial of 5040, which has over sixteen thousand digits.
Computing full factorials for a ratio. Never evaluate 52! to find a combination. Cancel first — the surviving terms are few and small.
Trusting a float for anything past 18!. The digits look authoritative and are wrong. If exactness matters, you need arbitrary-precision arithmetic.
Counting trailing zeros by looking for tens. The count depends on fives, not tens. 25 contributes two fives on its own, which is why the formula has that second term.
Underestimating the growth. People routinely propose brute-force solutions that enumerate all n! arrangements. At n = 20 that is 2.4 quintillion cases; at current speeds it would take longer than the age of the universe.