🧮
🧮 Math & statistics

Factorial Calculator (n!, double factorial)

Results update as you type.

Your numbers

Understanding the factorial calculator — concept and principle

The factorial of a whole number n, written n!, is the product of all whole numbers from 1 to n. It counts the number of ways to arrange n different objects in a row, so it sits at the heart of permutations, combinations, probability and series expansions. This calculator gives n! exactly up to 25!, in scientific notation for larger n, the number of digits in n!, and the double factorial n!!.

Twenty factorial as choices for each place in a queue20 × 19 × 18 × … × 1 = 2,432,902,008,176,640,000, a 19-digit number; 20!! = 3,715,891,200.20! = ways 20 people can line up20×19×18×17×…×1choices for 1st, 2nd, 3rd … last place2,432,902,008,176,640,00019 digits ≈ 2.43 × 10¹⁸20!! = 3,715,891,200double factorial: 20 × 18 × 16 × … × 2
Each place in the queue has one fewer choice; multiplied out, 20! has 19 digits.

How it is calculated

n must be a whole number from 0 up to 1,000,000; the double factorial is shown for n up to 60.

The principle

To arrange n distinct items, there are n choices for the first position, n − 1 for the second, and so on down to 1 for the last. Multiplying the choices gives n!. The rule n! = n × (n − 1)! also explains why 0! = 1: since 1! = 1 × 0!, 0! must be 1, and there is exactly one way to arrange nothing. Factorials grow faster than any exponential function. Stirling's approximation, n! ≈ √(2πn) (n/e)ⁿ, describes that growth and is already within about 0.4% at n = 20.

Worked example

  1. Input: n = 20.
  2. Multiply 1 × 2 × … × 20 = 2432902008176640000 (about 2.43 × 10¹⁸).
  3. log₁₀(20!) ≈ 18.386, so the number of digits is ⌊18.386⌋ + 1 = 19.
  4. Double factorial: 20!! = 20 × 18 × 16 × … × 2. Each factor is 2 times a number from 1 to 10, so 20!! = 2¹⁰ × 10! = 1,024 × 3,628,800 = 3715891200.
How n! changes with nHow n! changes with n02e+474e+476e+478e+471e+485101520253040Example: 2432902008176640000n
Each point is the calculator re-run with only “n” changed; the gold point is the default example. Change the inputs above and this chart follows your numbers.
nn!
5120
103628800
151307674368000
202432902008176640000
2515511210043330985984000000
302.65252860e+32
408.15915283e+47

How to read the result

The digit count shows how quickly factorials explode: 10! already has 7 digits, 20! has 19 and 100! has 158. 20! is the number of orders in which 20 people can stand in a queue. Above 25! the calculator switches to scientific notation, so only the leading digits are shown.

Common mistakes

Keep in mind: Ordinary double-precision numbers overflow beyond 170! (about 7.3 × 10³⁰⁶). From 171 on, the calculator builds the value from the log-gamma function (171! ≈ 1.241018e+309), so only the leading digits are reliable; use arbitrary-precision software when exact digits are required.

Frequently asked questions

Why is 0 factorial equal to 1?

It keeps the rule n! = n × (n − 1)! consistent and matches the fact that there is one way to arrange an empty set, which also makes formulas such as nC0 = 1 work.

How many trailing zeros does n! have?

Count the factors of 5: ⌊n/5⌋ + ⌊n/25⌋ + ⌊n/125⌋ + …. For 20! that is 4, matching the four zeros at the end of 2432902008176640000.

Is there a factorial of a decimal number?

Not in the counting sense, but the gamma function extends it; for example Γ(1.5) = (0.5)! = √π ÷ 2 ≈ 0.8862.

Sources: Donald E. Knuth, The Art of Computer Programming, Vol. 1, §1.2.5 (Permutations and Factorials) · NIST Digital Library of Mathematical Functions, §5.11 (Stirling's series for the gamma function)

Checked 8 Nov 2026. Standard formulas, computed in your browser with double-precision numbers.

🧮 All math & statistics tools →🌍 Calculators by country →