Factorial Calculator

Enter a whole number and press Calculate. The answer and the working behind it will show up here.

— —
Working out

What n! means

The factorial of n, written n!, is n multiplied by every whole number below it, down to 1.

n! = n × (n − 1) × (n − 2) × … × 2 × 1
  • n = any whole number, 0 or more
  • ! = is read “factorial”

5! = 5 × 4 × 3 × 2 × 1 = 120. It counts something real: the number of ways to line up n different things. Four people can stand in a row in 4! = 24 different orders.

Why 0! is 1

There is exactly one way to arrange nothing: do nothing. Also, the rule n! = n × (n − 1)! should keep working all the way down. For n = 1 it says 1! = 1 × 0!, and since 1! = 1, then 0! has to be 1.

How fast it grows

Each step multiplies the whole total, so factorials explode. 10! = 3,628,800. 20! = 2,432,902,008,176,640,000, about 2.4 × 10¹⁸. A pack of 52 cards can be shuffled in 52! ways, a number with 68 digits, so any well-shuffled deck is almost certainly in an order that has never existed before.

Trailing zeros without multiplying

Each trailing zero comes from a factor 10, which is a 2 × 5. There are always more 2s than 5s, so just count the 5s. Add up n ÷ 5, n ÷ 25, n ÷ 125 and so on, keeping only whole parts. For 25!: 5 + 1 = 6 zeros. For 100!: 20 + 4 = 24 zeros.

Where factorials appear

Permutations and combinations are built from factorials: nPr = n! ÷ (n − r)!. They also show up in probability and in the series that define sin, cos and e. Factorials are only defined for whole numbers 0 and above in school maths. This calculator gives exact answers for 0 to 2,000.