ConvertThemAll

Factorial calculator

The product of every whole number from 1 to n, computed exactly.

Formula Maths

n!

n!: 2432902008176640000

All digits
2432902008176640000
Number of digits
19
Trailing zeros
4

How it works

n! (n factorial) multiplies all the whole numbers from 1 up to n. By definition 0! = 1.

The calculator multiplies with exact big integers, so nothing is rounded. Factorials grow very fast: 70! already has over 100 digits.

The trailing zeros come from factors of 10, that is pairs of 2 and 5. There are always more 2s, so counting the 5s gives the number of zeros.

Formula

n! = 1 × 2 × 3 × … × n
0! = 1
zeros = ⌊n/5⌋ + ⌊n/25⌋ + ⌊n/125⌋ + …

Worked example

5! = 1 × 2 × 3 × 4 × 5 = 120. 20! = 2432902008176640000, which has 19 digits and ⌊20/5⌋ = 4 trailing zeros.

Questions people ask

Why is 0! equal to 1?

There is exactly one way to arrange zero objects, and the rule n! = n × (n − 1)! needs 1! = 1 × 0!, so 0! must be 1.

Can I take the factorial of a decimal or negative number?

Not with the ordinary factorial, which is for whole numbers from 0. The gamma function extends it to other numbers, but this calculator does not.

What are factorials used for?

Counting arrangements: n! is the number of orders n different items can be put in. They also appear in permutations, combinations and series.