Factorial Calculator
Calculate factorial (n!) of a number
What is it?
The factorial of a non-negative integer n, written n!, is the product of all positive integers less than or equal to n. It's fundamental to permutations, combinations, and probability calculations.
Formula
n! = n × (n−1) × (n−2) × ... × 2 × 1
Formula Explanation
Factorial counts the number of ways to arrange n distinct items in a sequence: there are n choices for the first position, (n−1) remaining choices for the second, and so on down to 1 — multiplying all these choices together gives n!.
Example Calculation
5! = 5 × 4 × 3 × 2 × 1 = 120.
How to Use
- Enter a non-negative whole number.
- Click Calculate Factorial.
- View the factorial result.
Benefits
- Instantly computes exact factorial values without manual multiplication.
- Correctly handles the special case of 0! = 1.
- Flags inputs beyond safe precision limits instead of returning a wrong answer.
Use Cases
- Calculating permutations and combinations for probability problems.
- Counting the number of ways to arrange a set of items.
- Evaluating terms in Taylor series or other calculus expansions.
What Your Result Means
The result is the exact number of ways to arrange n distinct items in order. Factorials grow extremely quickly — even relatively small values of n produce enormous results.
Tips
- Remember that 0! = 1 by definition, not 0.
- Factorials grow faster than exponential functions, so results become huge very quickly.
- Use factorials together with the Permutation or Combination calculators for counting problems.
Common Mistakes
- Assuming 0! equals 0 instead of the correct value, 1.
- Trying to compute the factorial of a negative number, which is undefined.
- Expecting precise results beyond 170!, where JavaScript's number precision breaks down.
FAQs
What is 0!?
0! is defined as 1 by mathematical convention, which keeps formulas involving factorials (like permutations and combinations) consistent.
Why is there a limit of 170?
Factorials grow extremely fast — 171! exceeds the maximum value JavaScript can represent precisely as a number, so results beyond 170! would be inaccurate.
Where are factorials used?
Factorials are used in permutations, combinations, probability theory, and series expansions in calculus.
Can I calculate the factorial of a decimal number?
This calculator only supports non-negative whole numbers — factorials of non-integers require the more advanced Gamma function.
How fast do factorials grow?
Very fast — 10! is already 3,628,800, and 20! exceeds 2.4 quintillion, illustrating how quickly factorial values expand.
Results are exact for n up to 170; beyond that, JavaScript number precision is insufficient.
Last updated: July 25, 2026