How it works
n factorial is the product of every whole number from 1 to n:
n! = n × (n − 1) × (n − 2) × … × 2 × 1 0! = 1
It counts the ways to arrange n different things in a line. 0! is defined as 1, which keeps formulas like n! = n × (n − 1)! and the combination formula working.
Worked example
How many ways can 5 books be arranged on a shelf? 5! = 5 × 4 × 3 × 2 × 1 = 120. A shuffled deck of 52 cards can be in 52! ≈ 8.065817517 × 1067 orders.
Why is 3! equal to 6?
Write out every order of three letters: ABC, ACB, BAC, BCA, CAB and CBA. There are 3 choices for the first place, 2 for the second and 1 for the last, so 3! = 3 × 2 × 1 = 6. Each new item multiplies the count again, which is why n! = n × (n − 1)!. Knowing 6! = 720 gives 7! = 7 × 720 = 5,040.
How fast do factorials grow?
| n | n! | Digits |
|---|---|---|
| 5 | 120 | 3 |
| 10 | 3,628,800 | 7 |
| 12 | 479,001,600 | 9 |
| 13 | 6,227,020,800 | 10 |
| 20 | 2,432,902,008,176,640,000 | 19 |
| 21 | 51,090,942,171,709,440,000 | 20 |
| 69 | ≈ 1.711224524 × 1098 | 99 |
| 70 | ≈ 1.197857167 × 10100 | 101 |
These limits matter in programming. 12! fits in an unsigned 32-bit integer (up to 232 − 1 = 4,294,967,295), but 13! does not. 20! is the largest factorial below 263 − 1 ≈ 9.22 × 1018, the top of a signed 64-bit integer. 70! is the first factorial above 10100, so a display with only two exponent digits cannot show it.
Factorials of fractions: the gamma function
For whole numbers, n! = Γ(n + 1), and Γ(1) = 1, which gives 0! = 1. The gamma function also has values between the whole numbers. For example, Γ(1/2) = √π ≈ 1.772453851. That is how a factorial of a fraction is defined, using x! = Γ(x + 1).
The gamma function has poles at 0, −1, −2, and so on. That is why (−1)!, (−2)! and every other negative whole number have no factorial. This calculator works with whole numbers only, so an entry such as 3.5 shows an error.
Common mistakes
- Taking 0! as 0. It is 1.
- Working out both factorials in a fraction. Cancel instead: 100! ÷ 98! = 100 × 99 = 9,900.
- Reading 2 × 3! as (2 × 3)!. The first is 12, the second is 6! = 720.
- Confusing n! with the double factorial n!!, which multiplies every second number: 7!! = 7 × 5 × 3 × 1 = 105.
Tips
- Factorials grow very fast: 20! is already over 2.4 × 10¹⁸.
- Factorial is only defined here for whole numbers 0, 1, 2, …
- For arrangements of only some of the items, use permutations (nPr).
Questions
Why is 0! equal to 1?
There is exactly one way to arrange nothing, and defining 0! = 1 keeps n! = n × (n − 1)! true for n = 1.
What is the factorial of a negative number?
It is not defined for negative integers.
How big can n be here?
Up to 1000. 1000! has 2,568 digits, so the result is shown in scientific notation.
How do you compute a factorial?
Multiply every whole number from n down to 1. You can also reuse the last answer: 7! = 7 × 6! = 7 × 720 = 5,040.
Why is 52 factorial so special?
52! is about 8.07 × 10⁶⁷, the number of orders for a deck of cards. The number is so large that a well-shuffled deck is almost certainly in an order nobody has seen before.
Can you take the factorial of a decimal?
Not with this calculator. The factorial of a non-integer x is defined through the gamma function as Γ(x + 1), and the factorial of a negative whole number is undefined.
Sources
- NIST Digital Library of Mathematical Functions, §5.4 Gamma Function: Special Values and Extrema. Eq. 5.4.1 (Γ(1) = 1, n! = Γ(n + 1)), Eq. 5.4.6 (Γ(1/2) = √π). Checked 22 November 2026.
- NIST Digital Library of Mathematical Functions, §5.2 Gamma Function: Definitions. Eq. 5.2.1 (Euler's integral) and the statement on poles at z = 0, −1, −2, …. Checked 22 November 2026.