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.

Loading calculator…

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.

Tip: Factorial is the building block behind permutations and combinations: the number of ways to arrange n distinct items is exactly n!.

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:

n!=n×(n1)×(n2)××2×1n! = n \times (n-1) \times (n-2) \times \cdots \times 2 \times 1

There's also a recursive way to describe the same idea — each factorial reuses the one before it:

n!=n×(n1)!n! = n \times (n-1)!

Why 0! = 1

It looks strange at first — how can "multiplying nothing" give 1 instead of 0? Two reasons make it the right convention:

  1. 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.
  2. The recursion needs it. The rule n!=n×(n1)!n! = n \times (n-1)! must hold at n=1n = 1: 1!=1×0!1! = 1 \times 0!. Since 1!=11! = 1, that forces 0!=10! = 1.

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:

nn!
5120
103,628,800
136,227,020,800
202,432,902,008,176,640,000
100≈ 9.3326 × 10¹⁵⁷ (158 digits)

By n=13n = 13, the result already tops 6 billion. By n=20n = 20, it's past 2.4×10182.4 \times 10^{18}. 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 ex=n=0xnn!e^x = \sum_{n=0}^{\infty} \frac{x^n}{n!} use factorials in every term's denominator.

Worked example — 5!

  1. Definition: multiply every integer from 5 down to 1.
  2. 5!=5×4×3×2×15! = 5 \times 4 \times 3 \times 2 \times 1
  3. 5×4=205 \times 4 = 20
  4. 20×3=6020 \times 3 = 60
  5. 60×2=12060 \times 2 = 120
  6. 120×1=120120 \times 1 = 120

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 n!=n×(n1)!n! = n \times (n-1)! working correctly at n=1n = 1, since 1!=1×0!=1×1=11! = 1 \times 0! = 1 \times 1 = 1.
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 7!=7×6×5×4×3×2×1=50407! = 7 \times 6 \times 5 \times 4 \times 3 \times 2 \times 1 = 5040. There is also a recursive shortcut: n!=n×(n1)!n! = n \times (n-1)!, 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. 13!13! already exceeds 6 billion, and 20!20! is over 2.4×10182.4 \times 10^{18} — 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 (nPrnPr) and combinations (nCrnCr). They also show up in probability, statistics, and series expansions such as ex=xnn!e^x = \sum \frac{x^n}{n!}.
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.

Related calculators