What a factorial is
The factorial of a whole number n, written n!, is the product of every whole number from 1 up to n. For example, 5! = 5 × 4 × 3 × 2 × 1 = 120. By definition, 0! = 1.
Factorials are also defined recursively: n! = n × (n − 1)!. That relationship is often quicker by hand — knowing 4! = 24, you get 5! = 5 × 24 = 120 in one step, and it also explains why 0! must equal 1 for the pattern to keep working at 1! = 1 × 0!. Factorials are the engine behind permutations and combinations, which feed straight into the probability calculator.
How to use this calculator
Enter a whole number of 0 or more. The calculator multiplies the sequence and returns n!. Because factorials grow extremely fast, values are capped at 170 — beyond that the result exceeds what a number can hold. Very large results are shown in scientific notation, which you can explore with the scientific notation calculator.
The growth is worth seeing: 5! = 120, 10! is over three million, and 20! already passes two billion billion. Factorials outpace exponential growth, which is why brute-force approaches that try every ordering become impossible for even modest values of n.
Where factorials are used
Factorials count the number of ways to arrange items: n! is the number of orderings of n distinct objects. They are the foundation of permutations and combinations in probability and are common in statistics and algebra.
Five books on a shelf can be arranged in 5! = 120 different orders, because there are five choices for the first slot, four for the next, and so on. The same building block appears inside the combination formula n! ÷ (r! × (n − r)!) when order does not matter. Factorial growth outruns any fixed power, as you can see by comparing it against the exponent calculator.
Frequently asked questions
- What is 5 factorial?
- 120. That is 5 × 4 × 3 × 2 × 1.
- What is 0 factorial?
- By definition, 0! = 1. There is exactly one way to arrange zero items.
- Can I take the factorial of a negative number?
- No. Factorials are defined only for whole numbers of 0 or more.
- Why is there a maximum of 170?
- 171! exceeds the largest number a standard computer can represent, so the result would overflow to infinity.
- Can I take the factorial of a decimal such as 2.5?
- Not with this calculator, which is limited to whole numbers. Mathematicians extend the idea to non-integers with the gamma function, but for counting problems only whole-number factorials are meaningful.