Factorial Calculator

Exact n! with digit count and trailing zeros, 0 to 18.

Math and PercentUpdated 2026-10-101 min read
Factorial Calculator
Factorial
...
Size...
Trailing zeros...

What it does

A factorial counts orderings: 3 books shelve 6 ways, 10 books shelve 3,628,800 ways. Each new item multiplies the running total by its position, so values explode far faster than the input grows.

The tool above takes 0 to 18 and returns the exact value with the digit count and trailing zeros beside it. The cap keeps every digit exact inside integer precision.

The default of 10 gives 3,628,800 across 7 digits ending in 2 zeros. Zero factorial reads 1 by definition, which keeps combination formulas working when choosing everything or nothing.

Definitions follow Khan Academy combinatorics units with the same exactness rules in LibreTexts math references. Both treat 0! as 1 and count trailing zeros from factors of five.

How to use

  1. Enter a whole number from 0 to 18.
  2. Read the exact factorial first.
  3. Use digits for the size feel.
  4. Use trailing zeros for fraction and modulo work.
  5. Split bigger counts into combinations instead.

Formula

n! = n x (n-1) x ... x 2 x 1. 0! = 1. Trailing zeros from factors of 5.
n!
Orderings of n distinct items.
0!
1 by definition, the empty product.
5s
Each factor of 5 with a 2 makes a trailing zero.

Inputs past 18 are rejected because doubles stop holding every digit exactly. Combinations and permutations pages build on these values for larger pools.

Worked example

Example: 10!

Number 10.

  1. Multiply down: 10 x 9 x 8 x 7 x 6 x 5 x 4 x 3 x 2 x 1.
  2. Running: 10, 90, 720, 5040, 30240, 181440, 362880, 1814400, 3628800.
  3. Result: 3,628,800 with 7 digits.
  4. Zeros: factors of 5 in 5 and 10 give 2 trailing zeros.
  5. Tool shows 3,628,800, 7 digits, 2 trailing zeros.

Reference table

Factorials by size
nn!Digits
011
51203
103,628,8007
151,307,674,368,00013
186,402,373,705,728,00016

Limits

  • Exact range 0 to 18 only.
  • Whole numbers only; fractions need gamma math.
  • Counts orderings of distinct items alone.
  • Huge pools need combinations, not raw factorials.

Common mistakes

  • Adding instead of multiplying down the chain.
  • Reading 0! as 0 instead of 1.
  • Trusting rounded results past exact range.
  • Forgetting repeated items divide the count.
  • Mixing permutations with combinations.

Try it yourself

Quick checks. Answers sit tucked under each question.

5!?

120: 3 digits, 1 trailing zero.

0!?

1 by definition: 1 digit, no zeros.

Trailing zeros of 15!?

floor(15/5) + floor(15/25) = 3 + 0 = 3.

Questions

What is 10 factorial?

3,628,800: ten down to one multiplied.

Why is 0! equal to 1?

Empty product convention, keeping combination formulas consistent.

Why cap at 18?

Doubles hold integers exactly only to 2^53; 19! passes it.

Where do trailing zeros come from?

Paired factors of 2 and 5; fives are scarcer, so count them.

Factorial vs combinations?

Factorials order everything; combinations divide out the irrelevant order.

How fast does it grow?

Faster than exponential: 10! is millions, 18! is quadrillions.

Sources

How this page was checked. The formula above was matched against the cited sources, and the worked example was run through the tool on this page before publishing. If you spot an error, contact us so we can fix it and note the correction.