❗ Factorial Calculator
By ToolNimba Math Team · Updated 2026-06-19
Enter a whole number n from 0 to 10000 to compute n!. By definition 0! = 1.
The factorial of a non-negative integer n, written n!, is the product of every whole number from 1 up to n. So 5! = 5 × 4 × 3 × 2 × 1 = 120. Factorials grow astonishingly fast, which is why a calculator helps. Enter any whole number from 0 upward and this tool returns n! computed exactly (no rounding), shows how many digits the answer has, and writes out the full expansion for small values. Everything runs in your browser, so nothing you type is sent anywhere.
What is the Factorial Calculator?
A factorial counts the number of ways to arrange n distinct objects in a row. With 3 books there are 3! = 6 possible orderings; with 5 books there are 5! = 120. That single idea, the number of arrangements (permutations), is why the factorial shows up all over probability, combinatorics, statistics and algebra. The formal definition is recursive: n! = n × (n − 1)!, with the base case 0! = 1. Each value is just the previous value multiplied by the next integer.
The reason 0! is defined as 1 trips a lot of people up. There is exactly one way to arrange zero objects (the empty arrangement), so the count is 1, not 0. The same value also keeps the recursive rule and formulas like the binomial coefficient consistent. Treat 0! = 1 as a definition that makes everything else work, not as something you derive by multiplying.
Factorials grow faster than any exponential. 10! is already 3,628,800 and 20! has 19 digits, while 100! has 158 digits. That explosive growth is exactly why ordinary floating-point arithmetic fails: a normal JavaScript number cannot represent integers above about 9 quadrillion without losing precision, so 21! onward would come back rounded and wrong. This calculator uses BigInt, an arbitrary-precision integer type, so every digit of the answer is exact no matter how large n is.
When to use it
- Counting permutations: how many ways n distinct items can be ordered (n!).
- Working out combinations and binomial coefficients, where factorials appear in the formula C(n, k) = n! / (k!(n − k)!).
- Computing probabilities in statistics, such as those built on the binomial or Poisson distributions.
- Checking homework or exam answers in algebra, discrete math and probability courses.
- Exploring how fast factorials grow compared with squares, cubes and powers of two.
How to use the Factorial Calculator
- Type a non-negative whole number into the n field (for example 5, 10 or 100).
- Read n! in the result box; the answer is computed exactly, with no rounding.
- Check the digit count shown beneath the result to see how large the number is.
- For small n, read the expansion (for example 5! = 5 × 4 × 3 × 2 × 1 = 120) to see how it is built.
- Use Copy to grab the full result, or the quick-pick buttons to try common values.
Formula & method
Worked examples
Compute 5! by hand to see how the product is built up.
- Start from the definition: 5! = 5 × 4 × 3 × 2 × 1.
- Multiply step by step: 5 × 4 = 20.
- 20 × 3 = 60.
- 60 × 2 = 120.
- 120 × 1 = 120 (multiplying by 1 changes nothing).
Result: 5! = 120
Use the recursive rule to get 6! from 5! without starting over.
- The rule is n! = n × (n − 1)!, so 6! = 6 × 5!.
- You already know 5! = 120.
- Multiply: 6! = 6 × 120 = 720.
- Check against the full product: 6 × 5 × 4 × 3 × 2 × 1 = 720. It matches.
Result: 6! = 720
Count how many ways 4 people can stand in a queue.
- Ordering 4 distinct people is a permutation, so the count is 4!.
- There are 4 choices for the first spot, then 3 left, then 2, then 1.
- Multiply the choices: 4 × 3 × 2 × 1.
- 4 × 3 = 12, then 12 × 2 = 24, then 24 × 1 = 24.
Result: 4! = 24 different queues
Factorials of 0 through 15 (and how quickly they grow)
| n | n! | Number of digits |
|---|---|---|
| 0 | 1 | 1 |
| 1 | 1 | 1 |
| 2 | 2 | 1 |
| 3 | 6 | 1 |
| 4 | 24 | 2 |
| 5 | 120 | 3 |
| 6 | 720 | 3 |
| 7 | 5,040 | 4 |
| 8 | 40,320 | 5 |
| 9 | 362,880 | 6 |
| 10 | 3,628,800 | 7 |
| 11 | 39,916,800 | 8 |
| 12 | 479,001,600 | 9 |
| 13 | 6,227,020,800 | 10 |
| 14 | 87,178,291,200 | 11 |
| 15 | 1,307,674,368,000 | 13 |
How big larger factorials get
| n | Number of digits in n! | Starts with |
|---|---|---|
| 20 | 19 | 2,432,902,008,176,640,000 |
| 25 | 26 | 15,511,210,043… |
| 50 | 65 | 30,414,093,201… |
| 100 | 158 | 93,326,215,443… |
Common mistakes to avoid
- Thinking 0! equals 0. By definition 0! = 1, not 0. There is exactly one way to arrange nothing (the empty arrangement), and this value keeps formulas like combinations consistent. It is a definition, not a multiplication, so do not try to compute it as a product.
- Taking the factorial of a negative number or a fraction. The plain factorial is only defined for non-negative integers. There is no value for (−3)! or 2.5! in ordinary arithmetic. (The gamma function extends factorials to other numbers, but that is a different, more advanced tool.)
- Trusting a normal calculator for large factorials. Standard floating-point numbers lose precision above about 9 quadrillion, so many calculators return 21! and beyond as rounded approximations in scientific notation. This tool uses exact BigInt arithmetic, so every digit is correct.
- Confusing n! with n² or with multiplication by n. A factorial multiplies every integer down to 1, so it grows far faster than squaring. 5! = 120 but 5² = 25, and the gap widens explosively as n rises.
Glossary
- Factorial
- The product of all positive integers up to and including n, written n!. For example 4! = 4 × 3 × 2 × 1 = 24.
- n!
- The notation for the factorial of n, read aloud as "n factorial".
- Permutation
- An ordered arrangement of objects. The number of permutations of n distinct objects is n!.
- Empty product
- The product of no factors, defined to equal 1, which is why 0! = 1.
- BigInt
- A data type for arbitrarily large whole numbers with no rounding, used here so even huge factorials are exact.
- Combination
- A selection of items where order does not matter, counted with factorials as C(n, k) = n! / (k!(n − k)!).
Frequently asked questions
What is a factorial?
A factorial of a non-negative integer n, written n!, is the product of every whole number from 1 up to n. For example 5! = 5 × 4 × 3 × 2 × 1 = 120. It counts the number of ways to arrange n distinct objects in order.
Why is 0! equal to 1?
0! is defined as 1 because there is exactly one way to arrange zero objects: the empty arrangement. Setting 0! = 1 also keeps the recursive rule n! = n × (n − 1)! and formulas like the binomial coefficient working correctly. It is a definition that makes everything else consistent.
How do you calculate a factorial by hand?
Multiply every integer from n down to 1. For 6! you compute 6 × 5 × 4 × 3 × 2 × 1, which builds up as 6 × 5 = 30, 30 × 4 = 120, 120 × 3 = 360, 360 × 2 = 720, 720 × 1 = 720. You can also use the shortcut n! = n × (n − 1)! if you already know the previous factorial.
Can you take the factorial of a negative number or a decimal?
No. The ordinary factorial is only defined for non-negative whole numbers, so values like (−3)! or 2.5! have no factorial in basic arithmetic. The gamma function generalizes factorials to other numbers, but that is a separate, more advanced concept not covered by this calculator.
How large a factorial can this calculator handle?
It accepts any whole number n from 0 up to 10,000 and returns the exact result. The cap keeps the page responsive, since the digit count itself becomes enormous (10,000! has more than 35,000 digits). Because the tool uses BigInt, every digit it shows is precise, with no rounding.
Why does my phone calculator give a different, rounded answer?
Most calculators use floating-point numbers, which cannot store integers above roughly 9 quadrillion exactly, so they round large factorials and often display them in scientific notation. This tool computes with BigInt, an exact integer type, so it returns the full, correct value digit for digit.