Home / Math / Factorial Calculator

Factorial Calculator

Enter a whole number from 0 to 1,000 to get its factorial as an exact integer, along with the number of digits, the number of trailing zeros, scientific notation and how close Stirling's formula comes.

By Adzita Editorial Team · Updated 2026-11-03 · How we build and check our tools

What a factorial is

The factorial of a non-negative whole number n, written n!, is the product of all positive whole numbers up to n: n! = n × (n − 1) × (n − 2) × … × 2 × 1. So 5! = 5 × 4 × 3 × 2 × 1 = 120. By convention 0! = 1, which is the empty product and keeps formulas for arrangements and combinations consistent. Factorials answer the question: in how many different orders can n distinct items be placed in a line? Three items give 3! = 6 orders, and ten items give 10! = 3,628,800.

The double factorial n!! multiplies every second number instead: n!! = n × (n − 2) × (n − 4) × … down to 2 or 1. Thus 10!! = 10 × 8 × 6 × 4 × 2 = 3,840 and 7!! = 7 × 5 × 3 × 1 = 105. It is not (n!)!, a common misreading.

How fast factorials grow

Factorials grow faster than any fixed power or exponential. 20! is 2,432,902,008,176,640,000, which just fits in a signed 64-bit integer, while 21! does not. 100! has 158 digits and 1,000! has 2,568. Ordinary spreadsheet cells and standard double-precision numbers lose exactness once the value exceeds about 9 × 1015, and overflow entirely beyond 170!. This page uses big-integer arithmetic, so every digit shown is exact. Values with more than 200 digits are abbreviated to the leading and trailing digits plus the digit count.

Trailing zeros and Stirling's approximation

Each trailing zero in n! comes from a factor of 10, and each 10 pairs a 2 with a 5. Twos are plentiful, so the count of fives decides it: floor(n/5) + floor(n/25) + floor(n/125) + …. For n = 100 this gives 20 + 4 = 24 trailing zeros. The result row counts them directly from the exact value, and the two methods agree.

For large n, Stirling's formula n! ≈ √(2πn) × (n/e)n gives a quick estimate. It always falls slightly below the true value, with a relative error of roughly 1 ÷ (12n), so it is within about 0.8% at n = 10 and about 0.08% at n = 100.

Where factorials appear

Only whole numbers from 0 to 1,000 are accepted. Negative integers have no factorial, and factorials of fractions need the gamma function, which this page does not cover. For powers see the exponent calculator.

Worked example

Compute 25!, the number of ways to arrange 25 distinct items in a row. It already runs to 26 digits.

Inputs

Whole number n25
TypeFactorial n!

Result

25! = 15511210043330985984000000

1.551121 × 10^25

Exact value15511210043330985984000000
Number of digits26
Trailing zeros6
Scientific notation1.551121 × 10^25
Stirling approximation error-0.3328% (the approximation is slightly low)

Factorials up to 20

nn!
01
11
22
36
424
5120
6720
75040
840320
9362880
103628800
1139916800

Accuracy note: Results use standard double-precision arithmetic, so very large or very small values may be rounded. Check important results by another method.

Frequently asked questions

What is a factorial?

The factorial of n is the product of all whole numbers from 1 up to n. For example, 6! = 6 × 5 × 4 × 3 × 2 × 1 = 720.

Why is 0 factorial equal to 1?

It is defined as the empty product, and the definition makes formulas for combinations and series work. There is exactly one way to arrange zero items: do nothing.

How many trailing zeros does n! have?

Count the factors of 5: add floor(n/5), floor(n/25), floor(n/125) and so on. For 100! that gives 20 + 4 = 24 trailing zeros.

What is a double factorial?

The double factorial n!! multiplies every second number down from n. So 9!! = 9 × 7 × 5 × 3 × 1 = 945, and 10!! = 10 × 8 × 6 × 4 × 2 = 3,840.

Why does the calculator stop at 1,000?

The exact answer for 1,000! already has 2,568 digits. The limit keeps the page fast while still covering almost all practical uses.

Exponent CalculatorRaise a base to any power: whole, negative or fractional, with exact integers and scientific notation.Prime Factorization CalculatorPrime factors of a whole number up to 10^12, with divisor count, divisor sum and a factor table.Permutation and Combination CalculatorExact nPr, nCr and with-repetition counts for n up to 1,000, using big-integer arithmetic.Scientific Notation CalculatorConvert numbers to scientific, E and engineering notation, or back to a plain decimal.

References and sources

  1. NIST Digital Library of Mathematical Functions, section 5.11: Stirling's formula and the gamma function. Link
  2. Graham, R., Knuth, D. and Patashnik, O., Concrete Mathematics, chapter 5, on factorials and binomial coefficients.

Check primary sources for anything you rely on.