Skip to content
MoneyDeck

Factorial Calculator

Compute n! exactly — every digit — even for very large n

Updated · Free, no signup

Exact value

3628800

Scientific notation

3.6288 × 10^6

Number of digits

7

Trailing zeros

2

Expansion

10! = 10 × 9 × 8 × 7 × … × 2 × 1
  • 10! ends in 2 zeros — one for every factor of 5 in 1…10 (⌊n/5⌋ + ⌊n/25⌋ + …).
  • There are 3,628,800 ways to arrange 10 distinct items in a row.

Digits in k! as k grows

About the Factorial Calculator

This factorial calculator computes n! — the product of all whole numbers from 1 to n — exactly, digit for digit. Ordinary calculators overflow at 170! and lose precision long before that, but this tool uses arbitrary-precision integers, so 100! comes back with all 158 digits and even 5,000! (more than 16,000 digits) is exact.

Factorials are the building blocks of counting: n! is the number of ways to arrange n distinct items, and they appear in permutations, combinations, probability, Taylor series and the binomial theorem. Alongside the exact value you get scientific notation, the number of digits, and the number of trailing zeros, a favourite puzzle in maths contests and coding interviews.

Switch to double factorial (n!!) to multiply every second number instead — n × (n − 2) × (n − 4) × … — which shows up in combinatorics and in integrals of powers of sine and cosine. By definition 0! = 1 and 0!! = 1.

How to use the factorial calculator

  1. 1Enter a whole number n from 0 to 5,000.
  2. 2Choose ordinary factorial n! or double factorial n!!.
  3. 3Copy the exact value with the copy button, or use the scientific notation.
  4. 4Check the digit count and trailing zeros for puzzles and proofs.

Formula and method

n! = n × (n − 1) × (n − 2) × … × 2 × 1, 0! = 1 n!! = n × (n − 2) × (n − 4) × …

The factorial multiplies every whole number from 1 up to n. It grows faster than any exponential: 10! is 3,628,800 and 20! already has 19 digits. The calculator multiplies with arbitrary-precision integers, so no digits are rounded away, and 0! is defined as 1 because there is exactly one way to arrange nothing.

Trailing zeros come from factors of 10 = 2 × 5; since factors of 2 are plentiful, the count equals the number of 5s in n!, given by ⌊n/5⌋ + ⌊n/25⌋ + ⌊n/125⌋ + …. The chart uses the log-gamma function, where log₁₀(n!) + 1 rounded down gives the number of digits.

n
A non-negative whole number
n!
n factorial: the product 1 × 2 × … × n
n!!
Double factorial: product of every second number down from n

Worked examples

10 factorial

10! = 10 × 9 × 8 × … × 1 = 3,628,800. It has 7 digits and 2 trailing zeros, from the factors 5 and 10.

20 factorial

20! = 2,432,902,008,176,640,000, the largest factorial that fits in a signed 64-bit integer. It ends in ⌊20/5⌋ = 4 zeros.

100 factorial

100! ≈ 9.3326 × 10¹⁵⁷ and has 158 digits. It ends in ⌊100/5⌋ + ⌊100/25⌋ = 20 + 4 = 24 zeros.

Double factorial 9!!

9!! multiplies every second number: 9 × 7 × 5 × 3 × 1 = 945.

Frequently asked questions

Why is 0 factorial equal to 1?+

There is exactly one way to arrange zero objects (do nothing), and defining 0! = 1 keeps formulas like n! = n × (n − 1)! and C(n, 0) = 1 consistent. It is also what the gamma function gives, since Γ(1) = 1.

What is 100 factorial?+

100! is approximately 9.3326 × 10¹⁵⁷, a 158-digit number ending in 24 zeros. It begins 93326215443944152681… — use the calculator to copy every digit.

How many trailing zeros does n! have?+

Count the factors of 5: ⌊n/5⌋ + ⌊n/25⌋ + ⌊n/125⌋ + …. For example 1000! has 200 + 40 + 8 + 1 = 249 trailing zeros. Factors of 2 are always more common, so 5s set the limit.

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

The ordinary factorial is only defined for whole numbers 0, 1, 2…. The gamma function extends it to decimals (Γ(n + 1) = n!), for example 0.5! = √π ÷ 2 ≈ 0.8862, but negative integers have no factorial.

What is the largest factorial a normal calculator can show?+

Most calculators and spreadsheets use 64-bit floating point, which overflows after 170! ≈ 7.26 × 10³⁰⁶. Exact integer digits are lost much earlier, above about 22!, which is why this calculator uses arbitrary precision.

Related tools