Factorial Calculator

Exact n! for whole numbers 0–1,000, with steps and trailing zeros.

Calculator

How to Use the Factorial Calculator

  1. Enter a whole number n from 0 to 1,000.
  2. Click Calculate to compute n! exactly.
  3. Read the full value, its digit count, the scientific form and the number of trailing zeros; the multiplication steps are listed up to 20!.
  4. Click Copy to copy every digit.
Example: 5! = 5 × 4 × 3 × 2 × 1 = 120. Trailing zeros: 1.

By O.E. — Partner, chairman of the board and CEO of a metal products manufacturer for 21 years; the company exports to 45 countries.

Drafted with AI assistance; calculations checked against primary sources and tested with the site's own code. About FlowUtil

Last reviewed

How the Factorial Is Calculated

n! = n × (n − 1) × … × 2 × 1, with 0! = 1 and 1! = 1; equivalently n! = n × (n − 1)!, so 10! = 10 × 362,880 = 3,628,800.

Trailing zeros: every trailing zero comes from a factor 10 = 2 × 5, and a factorial always has more factors of 2 than of 5, so the number of zeros equals the number of 5s in its prime factorization — one for each multiple of 5, one more for each multiple of 25, another for each multiple of 125, and so on: ⌊n/5⌋ + ⌊n/25⌋ + ⌊n/125⌋ + … (Legendre's formula for the prime 5).

Why 0! = 1: there is exactly one way to arrange zero objects, and n! = n × (n − 1)! gives 1! = 1 × 0!, which only works if 0! = 1. The same value makes the combination formula C(n, 0) = 1 correct.

Exact arithmetic: ordinary calculator arithmetic (64-bit floating point) keeps only about 16 significant digits, so from 23! on it cannot hold the exact value. This calculator multiplies whole numbers of unlimited length, so every digit of 1000! (2,568 digits) is correct. The digit count and a short scientific form (for example 9.3326 × 10^157 for 100!) are shown next to the full value.

SymbolMeaning
nA whole number from 0 to 1,000
n!Product of all whole numbers from 1 to n
Γ(n + 1)Gamma function; equals n! for whole numbers and extends it to non-integers

Worked Examples

  1. 1Arranging people: in how many orders can 8 people stand in a line?

    8! = 8 × 7 × 6 × 5 × 4 × 3 × 2 × 1

    8! = 40,320 · Trailing zeros: ⌊8/5⌋ = 1

    40,320 different orders — and it ends in exactly one zero.

  2. 2Trailing zeros of 25!.

    ⌊25/5⌋ + ⌊25/25⌋ = 5 + 1

    25! = 15,511,210,043,330,985,984,000,000 (26 digits) · Trailing zeros: 6

    Note the jump: 24! has 4 trailing zeros, 25! has 6, because 25 = 5 × 5 contributes two factors of 5.

  3. 3Shuffling a deck of cards: 52!.

    52! = 52 × 51 × … × 1; zeros ⌊52/5⌋ + ⌊52/25⌋ = 10 + 2

    52! ≈ 8.0658 × 10^67 (68 digits) · Trailing zeros: 12

    Every thorough shuffle almost certainly produces an order of the deck that has never existed before.

Using Factorials: Permutations and Combinations

Most practical uses of factorials are ratios, which are far smaller than the factorials themselves. Cancel before multiplying: 10! ÷ 7! = 10 × 9 × 8 = 720 without computing either factorial in full.

QuestionFormulaExample
Orders of all n itemsn!8 runners finish in 8! = 40,320 possible orders
Ordered picks of r from n (permutations)P(n, r) = n! ÷ (n − r)!Gold, silver, bronze among 10 runners: 10! ÷ 7! = 720
Unordered picks of r from n (combinations)C(n, r) = n! ÷ (r! × (n − r)!)5-card poker hands: 52! ÷ (5! × 47!) = 2,598,960

Which Values Can I Enter?

  • Whole numbers from 0 to 1,000Decimals (5.5), negative numbers and scientific notation (1e2) are rejected with a message.
  • Non-integer "factorials"0.5! is defined through the gamma function: Γ(1.5) = √π ÷ 2 ≈ 0.8862. This calculator handles whole numbers only.
  • Estimating sizeStirling's formula n! ≈ √(2πn) (n/e)ⁿ is within 1% from n = 10 (−0.83%) and within 0.5% by n = 20 (−0.42%).
  • StepsThe multiplication is written out term by term up to 20!.

Reading the Result

Digit count grows faster than n: 10! has 7 digits, 20! has 19, 52! has 68, 100! has 158, 170! has 307 and 1000! has 2,568.

The trailing-zero count comes straight from the formula above, not from scanning the digits — useful in number puzzles and programming exercises.

Common Mistakes

  • Thinking 0! = 0It is 1, by definition and by the arrangement argument.
  • Huge factorials on a floating-point calculatorFrom 23! upward the exact value no longer fits and the last digits are rounded away. Cancel first, or use exact arithmetic.
  • Counting zeros with ⌊n/5⌋ onlyMultiples of 25, 125… add extra zeros: 100! has 20 + 4 = 24, not 20.
  • Confusing n! with nⁿ5! = 120, while 5⁵ = 3,125.

Sources

Frequently Asked Questions

What is a factorial?

The product of all whole numbers from 1 to n: 5! = 5 × 4 × 3 × 2 × 1 = 120.

What is 0!?

1. There is exactly one way to arrange nothing, and the rule n! = n × (n − 1)! requires 1! = 1 × 0!, which only works if 0! = 1.

What is 10!?

3,628,800.

What is 20!?

2,432,902,008,176,640,000.

How many trailing zeros does 100! have?

24: ⌊100/5⌋ + ⌊100/25⌋ = 20 + 4.

How many digits does 52! have?

68. It is about 8.0658 × 10^67, the number of possible orders of a 52-card deck.

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

Not with the ordinary definition. The gamma function extends it to non-integers (n! = Γ(n + 1), so 0.5! = √π ÷ 2 ≈ 0.8862); it is undefined for negative whole numbers.

How are factorials used in probability?

To count outcomes: permutations P(n, r) = n! ÷ (n − r)! and combinations C(n, r) = n! ÷ (r! (n − r)!). There are 2,598,960 possible five-card poker hands.

Why does a normal calculator show a rounded value?

Ordinary calculators use 64-bit floating point, which keeps about 16 significant digits; from 23! on the exact value no longer fits and the last digits are rounded away (and 171! overflows completely). This calculator multiplies whole numbers of unlimited length, so every digit is exact.

Why is there a limit of 1,000?

It only keeps the page fast and readable: 1000! already has 2,568 digits. The arithmetic itself is exact at any size.