Factorial Calculator
Compute n! with exact BigInt precision — plus permutations, combinations & Stirling's approximation
Step-by-step expansion
| k | k! | Digits | Scientific |
|---|
What is a Factorial Calculator?
A factorial calculator computes the value of n! (n factorial) — the product of every positive integer from 1 up to n. This tool goes far beyond a simple multiplication: it uses JavaScript's native BigInt arithmetic to return exact integer results for every n from 0 to 170, displays the full digit count, converts the answer to scientific notation, shows a step-by-step expansion, and offers advanced features including permutations P(n,r), combinations C(n,r), a scrollable factorial table, and Stirling's approximation with percentage error.
Whether you are a student working through a Class 11 combinatorics problem, preparing for JEE, studying probability theory, or simply curious about how astronomically large 100! is (it has 158 digits), this calculator handles every case instantly in your browser with no server calls and no data stored.
Factorial Formula & Examples
The factorial of a non-negative integer n is defined recursively and iteratively:
0! = 1 (by definition — the empty product)
1! = 1
5! = 5 × 4 × 3 × 2 × 1 = 120
10! = 3,628,800
The factorial function grows faster than any polynomial or exponential function. 20! already exceeds 2.4 × 1018, while 100! ≈ 9.33 × 10157 — a number with 158 digits that dwarfs the number of atoms in the observable universe (estimated at around 1080).
Factorials in Permutations & Combinations
The two most fundamental counting techniques in combinatorics are both expressed using factorials:
C(n, r) = n! / (r! × (n − r)!) [unordered selections]
Permutations count the number of ways to arrange r items chosen from n distinct items where order matters. For example, the number of ways to award gold, silver, and bronze medals from 10 athletes is P(10, 3) = 10! / 7! = 720.
Combinations count selections where order does not matter. Choosing a 3-person committee from 10 candidates gives C(10, 3) = 10! / (3! × 7!) = 120 possible committees.
Factorial Table: 0! to 20!
| n | n! | Digits | Scientific |
|---|---|---|---|
| 0 | 1 | 1 | 1.00 × 100 |
| 1 | 1 | 1 | 1.00 × 100 |
| 2 | 2 | 1 | 2.00 × 100 |
| 3 | 6 | 1 | 6.00 × 100 |
| 4 | 24 | 2 | 2.40 × 101 |
| 5 | 120 | 3 | 1.20 × 102 |
| 6 | 720 | 3 | 7.20 × 102 |
| 7 | 5,040 | 4 | 5.04 × 103 |
| 8 | 40,320 | 5 | 4.03 × 104 |
| 9 | 362,880 | 6 | 3.63 × 105 |
| 10 | 3,628,800 | 7 | 3.63 × 106 |
| 11 | 39,916,800 | 8 | 3.99 × 107 |
| 12 | 479,001,600 | 9 | 4.79 × 108 |
| 13 | 6,227,020,800 | 10 | 6.23 × 109 |
| 14 | 87,178,291,200 | 11 | 8.72 × 1010 |
| 15 | 1,307,674,368,000 | 13 | 1.31 × 1012 |
| 16 | 20,922,789,888,000 | 14 | 2.09 × 1013 |
| 17 | 355,687,428,096,000 | 15 | 3.56 × 1014 |
| 18 | 6,402,373,705,728,000 | 16 | 6.40 × 1015 |
| 19 | 121,645,100,408,832,000 | 18 | 1.22 × 1017 |
| 20 | 2,432,902,008,176,640,000 | 19 | 2.43 × 1018 |
Worked Examples
Real-World Uses of Factorials
- Card shuffling: A standard deck of 52 cards has 52! ≈ 8.07 × 1067 possible orderings. Every time you shuffle a deck, you almost certainly create a unique arrangement that has never existed before in human history.
- Probability: Computing the probability that n events occur in a specific order requires dividing by n! to remove the effect of ordering.
- JEE and CBSE: Class 11 and 12 boards dedicate an entire chapter to permutations and combinations. Factorial notation is used in nearly every problem in that chapter.
- Password and PIN combinations: Calculating how many distinct 4-digit PINs can be formed from 10 digits without repetition is P(10, 4) = 5,040.
- Statistical physics: The Boltzmann entropy formula uses factorials via Stirling's approximation when counting microstates of a system.
- Binomial theorem: The coefficients in (a + b)n are combinations C(n, k) — each defined using three factorials.