Arithmetic & Numbers

Factorial Calculator

Enter a whole number n and get n! computed with exact integer arithmetic, plus how many digits it has and why it ends in so many zeros.

A whole number from 0 to 1000
Try an example:
Answer5! = 120
  • 3 digits
  • 1 trailing zero
Step-by-step working 3 steps
  1. 1
    Definition
    n! = n × (n − 1) × … × 2 × 1,  and 0! = 1

    The factorial counts the ways to arrange n different items in a row.

  2. 2
    Multiply it out
    5! = 5 × 4 × 3 × 2 × 1 = 120
  3. 3
    Trailing zeros
    Count the factors of 5: ⌊5/5⌋ = 1

    Each factor of 5 pairs with a factor of 2 to make a trailing zero.

How to use the factorial calculator

  1. Enter a whole number from 0 to 1000.
  2. Read n! (shown in scientific form if very long).
  3. Check the digit count.
  4. See the trailing-zero count worked out.

Factorial

n! = n × (n − 1) × … × 2 × 1
0! = 1
Trailing zeros = ⌊n/5⌋ + ⌊n/25⌋ + ⌊n/125⌋ + …

n! counts the ways to arrange n distinct objects in a row.

Worked examples

Each example below is generated by the same calculator you used above, so the working always matches the answer.

5!
Answer5! = 120
  • 3 digits
  • 1 trailing zero
Step-by-step working 3 steps
  1. 1
    Definition
    n! = n × (n − 1) × … × 2 × 1,  and 0! = 1

    The factorial counts the ways to arrange n different items in a row.

  2. 2
    Multiply it out
    5! = 5 × 4 × 3 × 2 × 1 = 120
  3. 3
    Trailing zeros
    Count the factors of 5: ⌊5/5⌋ = 1

    Each factor of 5 pairs with a factor of 2 to make a trailing zero.

10!
Answer10! = 3,628,800
  • 7 digits
  • 2 trailing zeros
Step-by-step working 3 steps
  1. 1
    Definition
    n! = n × (n − 1) × … × 2 × 1,  and 0! = 1

    The factorial counts the ways to arrange n different items in a row.

  2. 2
    Multiply it out
    10! = 10 × 9 × 8 × 7 × 6 × 5 × 4 × 3 × 2 × 1 = 3,628,800
  3. 3
    Trailing zeros
    Count the factors of 5: ⌊10/5⌋ = 2

    Each factor of 5 pairs with a factor of 2 to make a trailing zero.

25!
Answer25! = 15,511,210,043,330,985,984,000,000
  • 26 digits
  • 6 trailing zeros
Step-by-step working 3 steps
  1. 1
    Definition
    n! = n × (n − 1) × … × 2 × 1,  and 0! = 1

    The factorial counts the ways to arrange n different items in a row.

  2. 2
    Multiply it out
    25! has 26 digits

    The product is computed with exact whole-number arithmetic, so no digits are rounded.

  3. 3
    Trailing zeros
    Count the factors of 5: ⌊25/5⌋ + ⌊25/25⌋ = 6

    Each factor of 5 pairs with a factor of 2 to make a trailing zero.

100!
Answer100! = 9.3326215 × 10^157
  • 158 digits
  • 24 trailing zeros
Step-by-step working 3 steps
  1. 1
    Definition
    n! = n × (n − 1) × … × 2 × 1,  and 0! = 1

    The factorial counts the ways to arrange n different items in a row.

  2. 2
    Multiply it out
    100! has 158 digits

    The product is computed with exact whole-number arithmetic, so no digits are rounded.

  3. 3
    Trailing zeros
    Count the factors of 5: ⌊100/5⌋ + ⌊100/25⌋ = 24

    Each factor of 5 pairs with a factor of 2 to make a trailing zero.

Common mistakes to avoid

Thinking 0! is 0

0! is 1, which keeps combination formulas consistent.

Using factorials of negatives or fractions

Ordinary factorials are only defined for whole numbers 0 and up.

Underestimating growth

20! is already over two quintillion; 100! has 158 digits.

Frequently asked questions

Why does 0! equal 1?

There is exactly one way to arrange zero objects: do nothing.

Where are factorials used?

In permutations, combinations, probability and series expansions.