The factorial of a whole number n, written n!, is the product of every whole number from 1 up to n: 5! = 5 × 4 × 3 × 2 × 1 = 120. Factorials count the ways to arrange things — 5! is the number of orders five books can sit on a shelf — and they appear throughout probability, series and statistics.
This calculator gives n! exactly, digit for digit, for any n up to 1,000 (1,000! has 2,568 digits), together with the digit count, the value in scientific notation and Stirling’s approximation.
Factorials count arrangements: n! is the number of ways to put n different things in order. They grow faster than any exponential, which is why the calculator also shows the number of digits and the answer in scientific notation.
What is a factorial?
The factorial of a whole number n, written n! and read “n factorial”, is the product of all the whole numbers from n down to 1. So 4! = 4 × 3 × 2 × 1 = 24, and by convention 0! = 1. The exclamation mark is apt: factorials grow explosively. 10! is already 3,628,800, 20! passes two quintillion, and 100! has 158 digits — more than the number of atoms in the observable universe (about 10⁸⁰).
Factorials count arrangements. Five books can be shelved in 5! = 120 orders, because there are 5 choices for the first slot, 4 for the second, and so on. That makes them the building block of permutations and combinations, and they turn up in the binomial theorem, Taylor series (e = 1/0! + 1/1! + 1/2! + …) and probability. For large n the exact value is unwieldy, and Stirling’s approximation, n! ≈ √(2πn)(n/e)ⁿ, gives a close estimate — within 1% once n is 9 or more, and ever closer as n grows.
How to use the factorial calculator
- Enter a whole number n.
- Read n! exactly, its digit count and the approximation.
- Scroll the table for small factorials.
Formula
n! = n × (n − 1) × (n − 2) × … × 2 × 1, with 0! = 1
0! is defined as 1 so that formulas such as the number of combinations, n! ÷ (k!(n − k)!), work when k = 0 or k = n. Factorials are only defined for whole numbers; the gamma function extends them to fractions.
Stirling’s approximation, n! ≈ √(2πn) (n/e)ⁿ, is handy when n is large; its relative error is about 1 ÷ 12n, so it is within 1% from n = 9 upwards.
Worked examples
Ways to seat eight guests
- n
- 8
- 8!
- 40,320
- Number of digits
- 5
- In scientific notation
- 4.032 × 10^4
8! = 8 × 7 × 6 × 5 × 4 × 3 × 2 × 1 = 40,320. Stirling’s formula gives about 39,902, roughly 1% low.
A factorial too big for an ordinary calculator
- n
- 25
- 25!
- 15,511,210,043,330,985,984,000,000
- Number of digits
- 26
- In scientific notation
- 1.5511 × 10^25
25! = 15,511,210,043,330,985,984,000,000, a 26-digit number. Most hand calculators show it only as 1.551 × 10²⁵.
Past the limit of floating-point numbers
- n
- 200
- 200!
- 78865786736479050355…00000000000000000000 (375 digits)
- Number of digits
- 375
- In scientific notation
- 7.8866 × 10^374
200! has 375 digits and is beyond the range of a double-precision number (which gives up at 170!), but exact integer arithmetic still produces every digit.
How factorials grow
| n | n! | Digits |
|---|---|---|
| 5 | 120 | 3 |
| 10 | 3,628,800 | 7 |
| 15 | 1,307,674,368,000 | 13 |
| 20 | 2,432,902,008,176,640,000 | 19 |
| 30 | 2652528598…000000 | 33 |
| 50 | 3041409320…000000 | 65 |
| 100 | 9332621544…000000 | 158 |
How big factorials get
10! is 3,628,800, the number of ways to arrange ten books on a shelf. 52!, the number of ways to shuffle a deck of cards, is about 8.07 × 10⁶⁷, so a well-shuffled deck is almost certainly in an order no deck has ever been in before.
Common mistakes
- Thinking 0! is 0. It is 1 — there is one way to arrange an empty set, and the formulas for combinations depend on it.
- Reading n! as a number near n. 10! is not 10 or 100 but 3.6 million.
- Cancelling carelessly: 10! ÷ 5! is not 2! but 10 × 9 × 8 × 7 × 6 = 30,240.
- Taking the factorial of a fraction or a negative number. The gamma function handles non-integers; negative whole numbers have no factorial at all.
- Thinking 0! is 0. By definition 0! = 1, which keeps formulas such as nCr correct.
Frequently asked questions
What is 0 factorial?
0! = 1 by definition. There is exactly one way to arrange nothing, and the definition keeps the combination and permutation formulas valid.
How fast do factorials grow?
Faster than any exponential. 10! is 3.6 million, 20! is about 2.4 × 10¹⁸, 70! already exceeds 10¹⁰⁰ (a googol), and 170! is the largest factorial a standard double-precision number can hold.
Can I take the factorial of a decimal or a negative number?
Not with the ordinary definition. The gamma function gives Γ(x + 1) = x! for non-integers (½! = √π ÷ 2 ≈ 0.886), but negative whole numbers have no factorial.
What is a double factorial?
n!! multiplies every other number: 7!! = 7 × 5 × 3 × 1 = 105. It appears in some probability and physics formulas and is not the same as (7!)!.
Sources
- Factorial, Wolfram MathWorld
- Stirling’s Approximation, Wolfram MathWorld
- Contemporary Mathematics, 7.2 Permutations, OpenStax, Rice University
- DLMF §5.11 Asymptotic Expansions (Stirling’s series), NIST Digital Library of Mathematical Functions
Last updated · Calculations checked by automated tests· Editorial policy