keencalculator
  1. Home
  2. Math
  3. Factorial Calculator

Factorial Calculator

Calculate n! — the product of every whole number from 1 to n. Results up to 30 digits are shown in full; larger ones, up to 5,000!, are worked out exactly and displayed in scientific notation with the digit count and the number of trailing zeros.

Quick examples

A whole number from 0 to 5,000.

Your numbers stay in your browser. Nothing is uploaded.
n!3,628,800
Scientific notation
3.6288 × 10⁶
Number of digits
7
Trailing zeros
2

Saved setups

Save a set of inputs you reuse — your usual rate, your loan, your room sizes — and load it back in one tap.

    Your recent calculations

    Results you calculate here are kept on this device so you can come back to them.

      Formula

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

      How to use it

      1. Enter a whole number from 0 to 5,000.
      2. Read n!. If it is too long to show in full, use the scientific notation and digit count.

      Worked examples

      10 factorial

      n!
      3,628,800
      Scientific notation
      3.6288 × 10⁶
      Number of digits
      7
      Trailing zeros
      2

      20 factorial

      n!
      2,432,902,008,176,640,000
      Number of digits
      19
      Trailing zeros
      4

      52 factorial — the number of ways to order a deck of cards

      n!
      8.06581752 × 10⁶⁷
      Number of digits
      68
      Trailing zeros
      12

      How fast factorials grow

      10! is 3,628,800. 20! is about 2.43 × 10¹⁸. 52!, the number of ways to order a deck of cards, is about 8.07 × 10⁶⁷. 70! is the first factorial above 10¹⁰⁰, and 170! (about 7.26 × 10³⁰⁶) is the largest that fits in ordinary double-precision arithmetic, which is why many calculators give an error beyond that.

      This calculator multiplies whole numbers exactly rather than using floating point, so it keeps going: 5,000! has 16,326 digits.

      What factorials count

      n! is the number of ways to arrange n different things in a row: 3 books can be ordered 3! = 6 ways. Factorials are the building blocks of permutations (n! ÷ (n − r)!) and combinations (n! ÷ (r! × (n − r)!)).

      0! is defined as 1 because there is exactly one way to arrange nothing, and because it makes those formulas work when r = n.

      Questions people ask

      What is 5 factorial?

      120. 5 × 4 × 3 × 2 × 1 = 120.

      What is 10 factorial?

      3,628,800.

      Why is 0! equal to 1?

      There is exactly one way to arrange zero objects — do nothing — and the pattern n! = (n + 1)! ÷ (n + 1) gives 1! ÷ 1 = 1 for n = 0.

      How many zeros are at the end of 100!?

      24. Count the factors of 5: 100 ÷ 5 = 20, plus 100 ÷ 25 = 4.

      Related calculators