Factorial Calculator (n!, Permutations nPr, Combinations nCr)

Precisely calculate the factorial n! of a non-negative integer n. Also supports permutations (nPr) and combinations (nCr), using BigInt for exact integer results with no digit limit. Includes a factorial reference table for 0-20.

Factorial reference table for 0-20

A table listing the values of 0! through 20!. Note that 20! already has 19 digits.

n n!
0 1
1 1
2 2
3 6
4 24
5 120
6 720
7 5,040
8 40,320
9 362,880
10 3,628,800
11 39,916,800
12 479,001,600
13 6,227,020,800
14 87,178,291,200
15 1,307,674,368,000
16 20,922,789,888,000
17 355,687,428,096,000
18 6,402,373,705,728,000
19 121,645,100,408,832,000
20 2,432,902,008,176,640,000

Tips

  • Factorial (n!) is the product of every integer from 1 to n. For example, 5! = 5x4x3x2x1 = 120. By special definition, 0! = 1.
  • Permutation (nPr) counts the ways to choose r items from n distinct items and arrange them in order. Because order matters, the result is always at least as large as the corresponding combination. For example, 5P2 = 5x4 = 20.
  • Combination (nCr) counts the ways to choose r items from n distinct items without regard to order. For example, 5C2 = 10 (dividing 5P2 = 20 by the 2! = 2 ways to reorder the 2 chosen items).
  • Factorials grow extremely fast: 20! already has 19 digits, and 100! has 158 digits. This tool uses BigInt, so it computes exact values with no rounding error even for large n.
  • If n is too large (above 10,000), the tool returns an error due to computation cost — a practical limit to prevent the browser from becoming unresponsive.

Frequently Asked Questions

0! = 1 is defined by mathematical convention. It's natural if you think of it as "there is exactly one way to arrange an empty set" (the one way of arranging nothing). It's also the definition required for the recursive property n! = n x (n-1)! to hold even at n=1.

A permutation (nPr) counts the ways to "choose and arrange" items, so order matters (AB and BA are different). A combination (nCr) counts the ways to "just choose" items, so order does not matter (AB and BA are the same). This means nCr is always less than or equal to nPr, with the relationship nCr = nPr / r!.

It supports integers up to 10,000. 10,000! is a massive number with over 35,000 digits, and going beyond that could make the browser sluggish due to display and computation cost, so a practical limit is enforced.

Beyond permutation and combination calculations, factorials play a foundational role across many areas of mathematics, including probability theory (dice and card combinations), statistics (formulas for the binomial and Poisson distributions), and Taylor series expansions (factorials appear in the series expansion of functions like e^x).
ツールくん

Side Note — Why is the factorial symbol an exclamation mark?

The "!" symbol for factorial is generally credited to the French mathematician Christian Kramp, who introduced it in a book published in 1808. Before that, mathematicians used a variety of ad hoc notations with no agreed-upon standard. Various explanations exist for Kramp's choice, but a popular one is that it captures the sense of "astonishment" at how quickly factorial values explode in size.

This explosive growth is also captured by Stirling's approximation (n! ~ sqrt(2*pi*n) * (n/e)^n), which is widely used for approximate calculations across statistics, probability theory, and combinatorics. For values of n too large to compute n! exactly, this approximation plays a genuinely practical role.

The ideas behind permutations and combinations underlie everyday probability problems, from calculating lottery odds to counting the number of ways to shuffle a deck of cards (a standard 52-card deck has 52! possible orderings, roughly 8x10^67). The combination count nCr also appears as the entries of Pascal's Triangle and is closely tied to the binomial theorem (the expansion of (a+b)^n).