Factorial Calculator
n! — the product of all whole numbers from 1 to n — exact up to 170 and in scientific notation beyond, with the number of digits and trailing zeros.
n! = n × (n − 1) × … × 2 × 1, with 0! = 1.
How the factorial calculator works
n! = n × (n − 1) × … × 2 × 1, with 0! = 1. It counts the ways to arrange n distinct things in a row. Factorials grow faster than any exponential: 20! is already 2.4 × 10¹⁸, and 171! exceeds the largest double-precision number, so larger values are shown via Stirling's approximation of log₁₀.
Formula: n! = n × (n−1) × … × 1; 0! = 1
Worked examples
| Inputs | n! | Note |
|---|---|---|
| 10! | 3628800 | 3,628,800 |
| 20! | 2.432902e18 | 2.43 × 10¹⁸ |
| 0! | 1 | 1 by definition |
| 100! | 9.332622e157 | 158 digits |
FAQFrequently asked questions
Why is 0! equal to 1?
There is exactly one way to arrange nothing; it also makes the formulas for permutations and combinations work.
How large can factorials get?
170! ≈ 7.3 × 10³⁰⁶ is the largest that fits a double; the calculator shows bigger ones in scientific notation via logarithms.
Where are factorials used?
Counting arrangements (permutations), combinations, probability, Taylor series and the gamma function.
Why do factorials end in zeros?
Each pair of factors 2 and 5 makes a 10; the count of trailing zeros is ⌊n/5⌋ + ⌊n/25⌋ + ….
What is the factorial of a fraction?
The gamma function extends factorials: Γ(n + 1) = n!, and Γ(½) = √π.
Where these figures come from
- NIST Digital Library of Mathematical Functions — reference definitions for elementary and special functions
- Wolfram MathWorld — definitions and formulas for every topic on this page
- NIST/SEMATECH e-Handbook of Statistical Methods — the statistical formulas (mean, variance, z, confidence intervals, sample size)
- National curriculum in England — Mathematics — the terms and methods taught in UK schools
Last checked: September 2026. Formulas are fixed by mathematics and do not change with tax years or regulations.