Factorial Calculator (n!)
Calculate n factorial (n!) instantly with the full multiplication chain shown. Handles huge results in scientific notation and explains why 0! equals 1.
How to use this calculator
Type any whole number n from 0 to 5000. The calculator multiplies every integer from n down to 1, shows the full chain for small n (or an abbreviated chain for large n), and gives you the exact value — with a scientific-notation summary once the number of digits gets out of hand.
What is a factorial?
The factorial of a non-negative whole number n, written n!, is the product of every positive integer from n down to 1:
There's also a recursive way to describe the same idea — each factorial reuses the one before it:
Why 0! = 1
It looks strange at first — how can "multiplying nothing" give 1 instead of 0? Two reasons make it the right convention:
- Empty product. A factorial is a product of a list of numbers. When the list is empty (n = 0, there is nothing from 0 down to 1 to multiply), the standard convention for an empty product is 1 — the same way an empty sum is defined as 0. It's the multiplicative identity: multiplying by "nothing" should leave the starting value (1) unchanged.
- The recursion needs it. The rule must hold at : . Since , that forces .
There's also a counting argument: the number of ways to arrange zero items is 1 — there is exactly one arrangement of an empty set (do nothing).
Factorials grow explosively
Every step multiplies by a bigger number than the last, so factorials outrun even exponential growth:
| n | n! |
|---|---|
| 5 | 120 |
| 10 | 3,628,800 |
| 13 | 6,227,020,800 |
| 20 | 2,432,902,008,176,640,000 |
| 100 | ≈ 9.3326 × 10¹⁵⁷ (158 digits) |
By , the result already tops 6 billion. By , it's past . This is exactly why "try every possible ordering" algorithms (brute-force permutation search) become computationally hopeless once a list has more than about 15-20 items — the number of orderings is n!.
Where factorials show up
- Counting arrangements (permutations). n! is the number of ways to put n distinct objects in a row. Permutations and combinations (#DM02) both build directly on factorials.
- Probability and statistics. Binomial coefficients, hypergeometric distributions, and many combinatorial probability formulas divide out factorials.
- Series expansions. Taylor series such as use factorials in every term's denominator.
Worked example — 5!
- Definition: multiply every integer from 5 down to 1.
So 5! = 120.
Frequently asked questions
- What is 0 factorial (0!)?
- 0! = 1, by definition. A factorial is the product of the integers from n down to 1; with zero integers to multiply, the product is defined as 1 — an *empty product*. This also keeps the recursive rule working correctly at , since .
- What is 5 factorial?
- 5! = 5 \times 4 \times 3 \times 2 \times 1 = 120.
- How do you calculate a factorial?
- Multiply every whole number from n down to 1. For example . There is also a recursive shortcut: , reusing the previous factorial.
- Why do factorials grow so fast?
- Each step multiplies by a larger number than the one before, so factorials grow faster than any exponential function. already exceeds 6 billion, and is over — larger than the number of seconds since the universe began. That explosive growth is why algorithms that check every permutation of a list become impossibly slow past roughly 15-20 items.
- What is a factorial used for?
- Factorials count arrangements. The number of ways to order n distinct items in a row is n!, which is the building block behind permutations () and combinations (). They also show up in probability, statistics, and series expansions such as .
- Can you take the factorial of a negative number or a fraction?
- Not with this simple product definition — factorials here are only defined for non-negative whole numbers (0, 1, 2, 3, …). Negative integers make the recursive definition divide by zero, and non-integers require the more advanced Gamma function, which this calculator does not compute.
- What's the largest factorial this calculator can compute?
- Up to 5000!, which already has over 16,000 digits. Every result is computed with exact big-integer arithmetic — no floating-point rounding — and results over 15 digits are also shown in scientific notation so they stay readable.