The factorial of a whole number n, written n!, is the product of every positive integer from 1 up to n: n! = 1 × 2 × 3 × ... × n. For example, 5! = 1 × 2 × 3 × 4 × 5 = 120. By definition 0! = 1, and factorials grow extremely fast — 10! is already 3,628,800.
Factorial Calculator — compute n! for any whole number
The factorial of 5.
Quick examples
How it's calculated
- n! = 1 × 2 × 3 × ... × n
- n
- = 5
- 120
How it works
The factorial of a non-negative whole number n, written n! (read "n factorial"), is what you get by multiplying together all the whole numbers from 1 up to n:
n! = 1 × 2 × 3 × ... × n
So 4! = 1 × 2 × 3 × 4 = 24. There's one special case fixed by definition: 0! = 1. That isn't arbitrary — it's the value that makes the counting formulas factorials appear in (permutations and combinations) work consistently, and it matches the "empty product" convention that multiplying no numbers gives 1.
Factorials count the number of ways to arrange n distinct things in order: there are 5! = 120 orderings of five books on a shelf. That's why they show up throughout probability and combinatorics.
Worked example
Compute 5!:
5! = 1 × 2 × 3 × 4 × 5 = 120
A useful shortcut is that each factorial builds on the last: n! = n × (n − 1)!. Since 5! = 120, you get 6! = 6 × 120 = 720 without starting over, and 7! = 7 × 720 = 5,040. The growth is explosive — 10! = 3,628,800 and 13! = 6,227,020,800.
Frequently asked questions
What is a factorial used for?
- Counting arrangements and selections. n! is the number of ways to put n distinct items in order, so it's the backbone of permutations, combinations and much of probability. It also appears in series expansions in calculus (like e^x and sine), where each term is divided by a factorial.
Why is 0! equal to 1?
- Because there's exactly one way to arrange nothing — the empty arrangement — and because the recursive rule n! = n × (n − 1)! only stays consistent at n = 1 if 0! = 1 (since 1! = 1 × 0!). It also matches the "empty product" convention, where multiplying no factors together gives the multiplicative identity, 1.
Can you take the factorial of a negative or decimal number?
- Not with the plain definition used here — factorials are defined for non-negative whole numbers. There is a generalisation, the **gamma function**, that extends the idea to fractions and negatives (for instance (½)! involves √π), but that's a different, more advanced object. This calculator handles whole numbers from 0 upward.
How big do factorials get?
- Astonishingly big, very quickly: 20! is about 2.4 × 10¹⁸, and 100! has 158 digits. Because ordinary computer numbers can't hold exact integers beyond about 9 × 10¹⁵ (2⁵³), the results here are exact up to 18! and then rounded to floating-point precision for larger n; the input is capped at 170, beyond which the value would overflow to infinity.
What does the "!" symbol mean?
- It's the factorial sign, introduced by Christian Kramp in 1808. Written after a number it means "multiply this number by every whole number below it down to 1". It has nothing to do with the exclamation mark's ordinary meaning — 5! is "five factorial", equal to 120, not emphasis.
What's the difference between a permutation and a factorial?
- A factorial n! counts the arrangements of **all** n items. A permutation counts the arrangements of just **some** of them — r chosen from n — and is built from factorials as n! ÷ (n − r)!. So the factorial is the special case where you arrange the whole set at once.
How we know this is right
- Last reviewed
- Aug 4, 2026
- Precision
- Rounded to 0 decimal places.
Sources
- Wolfram MathWorld Factorial — Wolfram MathWorld: "The factorial n! is defined for a positive integer n as n! = n·(n−1)···2·1"; and 0! = 1 · Reviewed Aug 4, 2026