Factorial Calculator

The factorial of a whole number n, written n!, is the product of all whole numbers from n down to 1, so 5! = 120. Factorials grow extremely fast and count the ways to arrange things. This calculator gives exact values using whole-number arithmetic, counts the digits, and explains the trailing zeros.

Try:

How to use the factorial calculator

  1. Enter a whole number n from 0 to 3000.
  2. Press Calculate.
  3. Read n!, its number of digits and its trailing zeros.

Formula

n!=n×(n−1)×⋯×2×1n! = n \times (n-1) \times \cdots \times 2 \times 1
0!=10! = 1

Worked example: 5!

  • n: 5

✓ Answer checked

5!=1205! = 120
Number of digits
3
Trailing zeros
1
Step-by-step working (2 steps)
  1. Multiply down to 1 Factorial

    n! means n × (n − 1) × … × 2 × 1. By definition 0! = 1.

    5!=5×4×3×2×15! = 5 \times 4 \times 3 \times 2 \times 1
  2. Trailing zeros Legendre's formula

    Each factor of 10 needs a 2 and a 5; there are fewer 5s, so count them.

    ⌊5/5⌋+⌊5/25⌋+⋯=1\lfloor 5/5 \rfloor + \lfloor 5/25 \rfloor + \cdots = 1
Formulas used
n!=n×(n−1)×⋯×1n! = n \times (n-1) \times \cdots \times 1
0!=10! = 1
How this was checked
  • ✓ The exact value ends in 1 zeros, matching the count of factors of 5.

Frequently asked questions

What is 0 factorial?

0! = 1. There is exactly one way to arrange nothing, and this makes formulas for combinations work.

How many zeros are at the end of 100!?

24, because 100! contains 24 factors of 5 (and plenty of 2s), and each 2 × 5 makes a 10.

What are factorials used for?

Counting arrangements and combinations, probability, and series such as eˣ = Σ xⁿ/n!.

Related calculators

Related guides