Calculate factorial (n!) of any number with step-by-step breakdown.
The factorial of a non-negative integer n, written as n!, is the product of all positive integers from 1 to n. For example: 5! = 5 × 4 × 3 × 2 × 1 = 120. Factorials grow incredibly rapidly — 20! exceeds 2 quintillion. Our factorial calculator computes n! instantly for any non-negative integer, even very large ones.
n! = n × (n-1) × (n-2) × ... × 2 × 1. Special cases: 0! = 1 (by convention — one way to arrange zero items). 1! = 1. 2! = 2. 3! = 6. 4! = 24. 5! = 120. 10! = 3,628,800. 20! = 2,432,902,008,176,640,000. The recursive definition: n! = n × (n-1)! is foundational in computer science.
Factorials are the foundation of counting problems. Permutations (arrangements where order matters): P(n,r) = n! / (n-r)! — ways to arrange r items from n. Combinations (selections where order does not matter): C(n,r) = n! / (r! × (n-r)!) — ways to choose r items from n. These formulas are used in probability, statistics, and combinatorics.
Factorials appear in Taylor series expansions used to approximate functions: e^x = 1 + x + x²/2! + x³/3! + ... sin(x) = x − x³/3! + x⁵/5! − ... cos(x) = 1 − x²/2! + x⁴/4! − ... These infinite series are how calculators and computers internally compute transcendental functions like e^x, sin, and cos.
For very large n, computing n! directly requires enormous numbers. Stirling's approximation gives a close estimate: n! ≈ √(2πn) × (n/e)^n. This is used in statistical mechanics, information theory, and any field dealing with large combinatorial numbers. For programming, use logarithms of factorials (log(n!)) to avoid overflow when working with very large n.
Factorial of a number n (written as n!) is the product of all positive integers from 1 to n. For example, 5! = 5 × 4 × 3 × 2 × 1 = 120.
0! = 1 by mathematical convention. This is because there is exactly one way to arrange zero items: do nothing.
Factorials are used in permutations, combinations, probability calculations, Taylor series expansions, and many areas of mathematics and computer science.
Factorials grow extremely fast. 20! is already over 2 quintillion. For very large numbers, scientific notation or special big-number libraries are needed.