Factorial Calculator
Enter a whole number to find the product of every positive integer up to it.
What this calculator does
Enter a whole number n and the calculator returns n factorial: the product of every whole number from 1 through n. At the default of 5 the answer is 120, because 1 × 2 × 3 × 4 × 5 = 120. The input accepts values from 1 to 170; above 170 the result exceeds what standard computer arithmetic can represent, and the calculator reports an overflow instead of a wrong number.
How the factorial is defined
The factorial of n counts ordered arrangements, and it follows a step-down rule: n factorial equals n times (n−1) factorial, so each value builds on the previous one. Five factorial is 5 × 4 factorial = 5 × 24 = 120, and the same chain runs all the way down to 1.
Zero factorial is defined as 1, not 0. The convention makes sense in the step-down rule: 1 factorial = 1 × 0 factorial forces 0 factorial = 1. It also keeps counting formulas intact, since choosing all n items from n should give exactly 1 arrangement, not zero. Probability and combination formulas quietly depend on this definition.
Worked example: 5 factorial, step by step
Start with 1. Multiply by 2 to get 2. Multiply by 3 to get 6. Multiply by 4 to get 24. Multiply by 5 to get 120. That is four multiplications for n = 5, and in general n − 1 of them. You can check the result by dividing back down: 120 ÷ 5 = 24, which is 4 factorial, and 24 ÷ 4 = 6, which is 3 factorial. Each step down divides by the next smaller integer, which is the step-down rule in action.
How fast factorial grows
| n | n! |
|---|---|
| 0 | 1 |
| 1 | 1 |
| 5 | 120 |
| 10 | 3,628,800 |
| 12 | 479,001,600 |
| 15 | 1,307,674,368,000 |
| 20 | 2,432,902,008,176,640,000 |
| 52 | ≈ 8.07 × 1067 |
Each multiplication uses a larger number than the one before, so growth outruns ordinary exponentials. Ten factorial already tops 3.6 million, and twenty factorial is about 2.4 quintillion. Past 20 the value overflows a 64-bit signed integer, which tops out near 9.2 × 1018, so 21 factorial and beyond require floating-point or arbitrary-precision arithmetic. A full deck of 52 cards has more possible orders than any everyday comparison can make intuitive.
Where factorials appear
Arrangements are the core use. Five people can line up in 5 factorial = 120 different orders, and a photo of 4 friends has 24 possible arrangements. Permutations extend this: the number of ordered 3-item codes drawn from 10 digits is 10 × 9 × 8 = 720, which is why code-strength estimates grow so quickly with length.
Probability leans on the same machinery. The number of 5-card poker hands from a 52-card deck is 52 divided by (5 factorial times 47 factorial), which works out to 2,598,960 hands. Taylor series in calculators and spreadsheets carry factorials in every term, and AP Statistics and SAT probability questions in 2026 still expect you to set up these fractions by hand.
Why the calculator stops at 170
Standard computer arithmetic represents numbers up to roughly 1.8 × 10308. The value 170 factorial is about 7.26 × 10306 and fits, while 171 factorial is about 1.24 × 10309 and overflows to infinity. For anything larger you need an arbitrary-precision library; 1000 factorial, for example, has 2,568 digits. Within the 170 limit the calculator stays exact, because it never rounds a product that fits.
Common mistakes
- Treating 5 factorial as 5 × 5 = 25; the definition gives 1 × 2 × 3 × 4 × 5 = 120
- Setting zero factorial to 0; the definition gives 1, and counting formulas rely on it
- Cancelling across addition: 5 factorial plus 4 factorial is 120 + 24 = 144, which is not a single factorial
- Dividing in the wrong order: 10 factorial divided by 7 factorial is 10 × 9 × 8 = 720, while the reverse is a small fraction
- Entering 171 or higher and expecting a number; the calculator reports overflow instead of a wrong value
The 5 × 5 error usually comes from confusing a factorial with a square, so anchor the definition with the small cases: 2 factorial is 2, 3 factorial is 6 and 4 factorial is 24. If a probability answer seems orders of magnitude too small, check whether a factorial was evaluated as a square or a double.
Factorials in coursework and work
In 2026 classrooms the factorial shows up wherever order matters: SAT and ACT probability items, AP Statistics counting problems, and discrete math units on permutations. A typical question asks how many ways 6 runners can finish a race, and the answer is 6 factorial = 720, because each finishing position removes one runner from a pool of 6, then 5, then 4.
Outside class, the factorial hides inside password and code analysis. An 8-symbol sequence using 8 distinct symbols without repeats has 8 factorial = 40,320 orderings, and security estimates multiply that across symbol sets. The same explosion explains why exhaustive search dies quickly and why combinatorial optimization exists as a field at all.
Frequently asked questions
How do I calculate 5 factorial?
Multiply 1 × 2 × 3 × 4 × 5 = 120. Equivalently, 5 × 24 (four factorial) = 120, using the step-down rule.
What is 0 factorial?
It equals 1 by definition. The step-down rule forces it: 1 factorial = 1 × 0 factorial, so 0 factorial must be 1. Counting formulas for choosing items also require the value to be 1.
What is the largest factorial this calculator can handle?
170 factorial, about 7.26 × 10306. At 171 the product exceeds the floating-point ceiling of roughly 1.8 × 10308 and the result would be infinity.
How many digits does 100 factorial have?
158 digits. The full value begins 93,326,215,443… and ends in 24 trailing zeros, one for each factor of 10 in the product.
Where do factorials show up in probability?
In counting outcomes: a 52-card deck yields 2,598,960 distinct 5-card hands once factorials cancel. Lottery odds, seating arrangements and race finishes all reduce to factorial ratios.
What is the difference between 5 factorial and 5 squared?
Five factorial is 1 × 2 × 3 × 4 × 5 = 120, while 5 squared is 5 × 5 = 25. The factorial multiplies every integer up to n, not n by itself.
How do I simplify 10 factorial divided by 7 factorial?
Cancel the shared 1 × 2 × … × 7 and you are left with 10 × 9 × 8 = 720. This is exactly the permutation count for arranging 3 items out of 10.
Why does factorial grow so fast?
Every step multiplies by a bigger number than the last: by 10 the value already passes 3.6 million, and by 20 it is about 2.4 quintillion. Growth compounds on a rising base at every step.
What is 12 factorial?
479,001,600. It is the number of ways to arrange 12 distinct items, such as 12 books on a shelf, and it is the largest factorial that still fits in a 32-bit signed integer.
Method and sources
- Factorial: n! = 1 x 2 x ... x n, with 0! = 1 by convention.