Factorial Calculator
Calculate the factorial of any non-negative integer, with exact precision even for large numbers.
What factorial means
The factorial of a number (written n!) is the product of all positive integers from 1 up to n. For example, 5! = 5 × 4 × 3 × 2 × 1 = 120. By definition, 0! equals 1, which can seem counterintuitive but is a standard mathematical convention that makes formulas involving factorials (like combinations and permutations) work correctly.
Factorials grow extremely fast — 10! is already 3,628,800, and 20! exceeds 2.4 quintillion. This calculator uses arbitrary-precision arithmetic to compute exact results even for very large inputs, rather than losing precision the way standard calculator displays often do.
Where factorials are used
Factorials are foundational to combinatorics — calculating permutations and combinations (how many ways items can be arranged or selected) relies directly on factorial math. They also appear in probability theory, series expansions in calculus, and algorithm complexity analysis in computer science.
Because factorials grow so quickly, most factorial values beyond roughly 20! are rarely used directly in everyday calculations — they mainly appear as intermediate steps within larger formulas, like the permutation and combination formulas, where much of the huge value cancels out.
Frequently asked questions
Why does 0! equal 1?
It's a mathematical convention that keeps factorial-based formulas, like combinations and permutations, consistent and correct — treating 0! as 1 makes the general pattern work smoothly at the boundary case.
Can I calculate the factorial of a negative number?
Not with the standard factorial definition — factorial is only defined for non-negative integers in this context. (A related concept, the gamma function, extends factorial-like behavior to non-integers, but that's a more advanced topic beyond this calculator.)