Factorial calculator — n!
The factorial of n (written n!) is the product of all positive integers from 1 to n. This calculator shows the exact value for small inputs and scientific notation for large ones.
n! =
—
Formula
n! = n × (n−1) × (n−2) × … × 2 × 1
0! = 1 (by definition)
Common values
| n | n! |
|---|---|
| 0 | 1 |
| 5 | 120 |
| 10 | 3,628,800 |
| 20 | 2.433 × 10^18 |
| 50 | 3.041 × 10^64 |
| 100 | 9.333 × 10^157 |
Frequently asked
What is a factorial?
n! = n × (n−1) × (n−2) × … × 2 × 1. By definition, 0! = 1. Factorials grow extremely fast: 10! = 3,628,800 and 100! has 158 digits.
Why does the calculator switch to scientific notation above 170?
JavaScript's floating-point numbers (IEEE 754 doubles) overflow at about 1.8 × 10^308. Since 171! ≈ 1.24 × 10^309, exact computation exceeds the representable range. The calculator uses a logarithm-based approach to show the scientific notation accurately.
What is 0! and why is it 1?
By convention, 0! = 1. This preserves the identity n! = n × (n−1)! when n = 1 (giving 1 = 1 × 0! = 1 × 1) and makes combinatorial formulas like C(n,0) = 1 work correctly.
How many digits does 100! have?
100! has 158 digits. The digit count equals floor(log10(n!)) + 1.
How do I share my calculation?
Click "Share with my numbers" to copy a URL that saves your input.