What Is a Factorial?
The factorial of a non-negative integer n, written n!, is the product of all positive integers from 1 up to n. Factorials appear throughout mathematics — especially in combinatorics, probability, algebra, and calculus — where they count the number of ways to arrange or order items. This calculator computes n! instantly for any non-negative integer.
How to Use This Calculator
Enter a whole number n (zero or greater) in the input box and the calculator returns n!. Because factorials grow extremely fast, values are accurate as exact integers for small n and are shown in standard floating-point precision for larger inputs. The result becomes very large quickly: 13! already exceeds 6 billion, and 170! is near the largest value a standard double can represent.
The Formula Explained
The defining formula is:
$$\text{n}! = 1 \times 2 \times 3 \times \cdots \times \text{n}$$
A key special case is \(0! = 1\), which holds because the product of no numbers (the empty product) is defined as 1. This convention keeps combinatorial formulas consistent — for example, there is exactly one way to arrange zero objects.
Worked Example
Suppose you want 5!. Multiply step by step: \(1 \times 2 = 2\), then \(2 \times 3 = 6\), then \(6 \times 4 = 24\), then \(24 \times 5 = 120\). So \(5! = 120\). This means there are 120 different ways to arrange 5 distinct items in a row.
FAQ
Why is 0! equal to 1? By the empty-product convention and because it makes the permutation and combination formulas work consistently for all values.
Can I compute the factorial of a negative or decimal number? Not with this tool. Standard factorials are defined only for non-negative integers. The gamma function generalizes factorials to other numbers, but that is beyond this calculator's scope.
Why is there a maximum input? Factorials grow so fast that values above 170! overflow standard double-precision arithmetic, so the input is capped at 170.