Compute n!, the product of all positive integers up to n. Essential for permutations, combinations, and probability.
Last updated: May 2026 | By Patchworkr Team
| n | n! |
|---|---|
| 0 | 1 |
| 1 | 1 |
| 2 | 2 |
| 3 | 6 |
| 4 | 24 |
| 5 | 120 |
| 10 | 3,628,800 |
The factorial of a non-negative integer $n$, written $n!$, is defined as the product of all positive integers from 1 up to $n$. This simple multiplicative definition hides a powerful combinatorial meaning: $n!$ counts the number of distinct orderings (permutations) of $n$ labeled items. Factorials grow extremely rapidly—doubling the input roughly multiplies the output by a factorial-scale factor—so even modest values of $n$ lead to very large numbers. For practical calculator use, we compute factorials using straightforward iterative multiplication for small-to-moderate inputs and display both exact and scientific notation when the result becomes large. The implementation guards against JavaScript floating-point overflow by limiting exact computation to values where native numbers remain finite (commonly up to about 170!).
Beyond counting arrangements, factorials connect to many areas of mathematics and applied science: they appear in series expansions (Taylor series), in analytic continuations through the Gamma function for non-integer arguments, and in probability when computing permutations and combinations. Approximation formulas such as Stirling's approximation provide accurate estimates for very large $n$ when exact values are impractical. In algorithms and software, factorials often signal combinatorial complexity—if a problem requires evaluating $n!$ possibilities, it may be computationally infeasible to brute force for large $n$. This calculator is designed to be an approachable, auditable tool: it presents exact results when possible, scientific formatting for readability, and clear error messages for inputs outside safe bounds.
Special Case: 0! is defined as 1.
Calculate 4!:
1. Start with n = 4
2. Multiply: 4 × 3 × 2 × 1
3. 4 × 3 = 12
4. 12 × 2 = 24
5. 24 × 1 = 24
Final Answer: 24
It is defined this way to make many formulas consistent and represents the one arrangement of zero objects.
Very rapidly — values explode combinatorially; 10! is over 3 million.
Yes, via the Gamma Function Γ(n), which generalizes factorials.
An estimate for large n: n! ≈ √(2πn) (n/e)^n, useful when exact values are impractical.
It ensures combinatorial formulas (like permutations) remain consistent (0! = 1).
Yes — in statistics, physics, probability, and algorithm analysis.
Beyond ~170, JS numbers overflow to Infinity; the tool guards against that.
Use arbitrary-precision libraries or approximations like Stirling's formula.
Related Tools