Skip to content

Factorial calculator (n!)

Calculate the factorial of a number (n!) and see the product expansion for small numbers.

5!
120
Expansion5 × 4 × 3 × 2 × 1 = 120

A factorial multiplies all integers from 1 to n. By definition, 0! = 1. Above ~18! the exact value exceeds computer precision and is shown in scientific notation.

Guide What is a factorial (n!)

How the calculation works

The factorial of a number n, written n!, is the product of all positive integers from 1 to n:

n! = n × (n−1) × … × 2 × 1

Step-by-step example

5! = 5 × 4 × 3 × 2 × 1 = 120. Since 4! = 24, you can reuse: 5! = 5 × 4!.

What it counts

Factorial tells how many ways n distinct items can be ordered (permutations). Ordering 5 books: 5! = 120. It's the basis of combinatorics and probability.

It grows fast

10! already exceeds 3.6 million; 20! passes 2 quintillion.

Examples

  • 6! = 720 (6 × 120).
  • Anagrams of a 4-distinct-letter word: 4! = 24.

Frequently asked questions

Why is 0! = 1?

Because there is exactly one way to arrange "nothing" — the empty list. It also keeps combination formulas consistent.

Factorial of a negative or decimal?

Not in the basic sense. Math uses the gamma function, a generalization, for those.

Factorial vs permutation?

n! is ordering ALL n items. Permutations of n taken k at a time use a ratio of factorials.

Why does 0! equal 1?

Combinatorially there is exactly one way to arrange nothing; and n! = n × (n−1)! only holds at n = 1 if 0! is 1.

Arrangement versus combination?

Order. It matters in arrangements (podium, password) and not in combinations (committee, hand of cards).

Why can't it compute very large factorials?

Because the value overflows common numeric types: precision is lost around 18! and overflow occurs near 171!.

Is a shuffled deck really unique?

Practically yes. 52! ≈ 8 × 10⁶⁷ orderings, more than the estimated atoms in the Milky Way.

Related calculators

More Math calculators

See all →

Updated on June 30, 2026 · by Rafael Rossi · Methodology & sources