Factorial Calculator

Calculate n!, nPr (permutations), and nCr (combinations) instantly.

n! Factorial Calculator
n (whole number, 0 to 170)
r (items to choose, 0 ≤ r ≤ n)
10! =
Expansion

📖 What is a Factorial?

A factorial is denoted by an exclamation mark (n!) and represents the product of all positive integers from 1 up to n. The factorial function appears throughout mathematics - in combinatorics, probability theory, number theory, and calculus.

For example: 6! = 6 × 5 × 4 × 3 × 2 × 1 = 720. This tells us there are 720 ways to arrange 6 different objects in a sequence.

Factorials are fundamental to two key counting techniques - permutations and combinations - which are used any time you need to count the number of possible arrangements or selections from a group.

Permutations (nPr) answer the question: *In how many ways can I arrange r items from a group of n, where the order matters?* For example, the number of ways 3 runners can finish first, second, and third from a group of 10 athletes is 10P3 = 720.

Combinations (nCr) answer: *In how many ways can I choose r items from n, where order doesn't matter?* For example, the number of ways to choose 3 people for a committee from a group of 10 is 10C3 = 120 - much less than 720, because the same group of 3 people is only counted once regardless of the order they were chosen.

📐 Formula

n! = n × (n−1) × (n−2) × ... × 2 × 1
0! = 1 (by definition)
nPr = n! / (n−r)! [Permutation - order matters]
nCr = n! / (r! × (n−r)!) [Combination - order doesn't matter]

📖 How to Use This Calculator

1
Select the mode: n! Factorial, nPr Permutation, or nCr Combination.
2
Enter n - the total number of items.
3
For permutation and combination, also enter r - the number of items to select.
4
Click Calculate - the result and formula breakdown are shown.

💡 Example Calculations

Example 1 - Arranging books

1
How many ways can you arrange 8 books on a shelf?
2
8! = 8 × 7 × 6 × 5 × 4 × 3 × 2 × 1 = 40,320 ways
Try this example →

Example 2 - Lottery combination

1
In a lottery, you pick 6 numbers from 1 to 49. How many possible tickets are there?
2
49C6 = 49! / (6! × 43!) = 13,983,816 combinations
3
Each ticket has a 1-in-13.98-million chance of winning the jackpot.
Try this example →

Example 3 - Podium positions

1
In a race with 12 competitors, how many ways can the top 3 podium spots be filled?
2
12P3 = 12! / (12−3)! = 12 × 11 × 10 = 1,320 arrangements
Try this example →

Frequently Asked Questions

What is a factorial?+
A factorial (n!) is the product of all positive integers from 1 to n. For example, 5! = 5 × 4 × 3 × 2 × 1 = 120. Factorials appear in permutations, combinations, probability, and many areas of mathematics.
What is 0 factorial?+
0! = 1. This is defined by mathematical convention and is essential for the combinatorial formulas to work correctly. It represents the one way to arrange zero objects - by doing nothing.
What is the difference between nPr and nCr?+
nPr (permutation) counts ordered arrangements: how many ways to choose r items from n where order matters. nCr (combination) counts unordered selections: how many ways to choose r items from n where order doesn't matter. nCr = nPr ÷ r!
What is the largest factorial this calculator can compute?+
This calculator handles factorials up to 170! accurately. Beyond that, JavaScript's floating-point numbers overflow to Infinity. For extremely large factorials, Stirling's approximation is used in advanced mathematics.
Where are factorials used in real life?+
Factorials appear in probability (how many outcomes are possible), statistics (permutation and combination tests), cryptography (key space calculations), and computer science (algorithm complexity analysis). Shuffling a deck of cards has 52! ≈ 8×10⁶⁷ possible arrangements.
What is the difference between a permutation and a combination?+
A permutation counts ordered arrangements - the order matters. A combination counts unordered selections - the order does not matter. Example: selecting 2 students from 4 (A, B, C, D). Permutations (ordered): AB, BA, AC, CA, AD, DA, BC, CB, BD, DB, CD, DC = 12 arrangements. Combinations (unordered): AB, AC, AD, BC, BD, CD = 6 selections. nPr = n! / (n-r)! and nCr = n! / (r! x (n-r)!).
What is 0! (zero factorial)?+
0! = 1 by definition. This is not just a convention - it is mathematically necessary for formulas involving permutations and combinations to work correctly. For example, nCr when r = 0 or r = n must equal 1 (there is exactly one way to choose none or all items). If 0! were 0, these formulas would break down. The result follows from the recursive definition: n! = n x (n-1)!, so 1! = 1 x 0!, giving 0! = 1.
How are factorials used in probability?+
Factorials are the foundation of counting in probability. They appear in: (1) Combinations: nCr = n! / (r! x (n-r)!) - used to find the probability of selecting k items from n. (2) Permutations: nPr = n! / (n-r)! - used when order matters. (3) The binomial distribution formula. (4) Calculating odds in card games, lottery probabilities, and combinatorial problems. Example: the probability of being dealt a specific 5-card poker hand uses combinations from 52 cards.

What is a factorial?

A factorial (n!) is the product of all positive integers from 1 to n. For example, 5! = 5 × 4 × 3 × 2 × 1 = 120. Factorials appear in permutations, combinations, probability, and many areas of mathematics.

What is 0 factorial?

0! = 1. This is defined by mathematical convention and is essential for the combinatorial formulas to work correctly. It represents the one way to arrange zero objects - by doing nothing.

What is the difference between nPr and nCr?

nPr (permutation) counts ordered arrangements: how many ways to choose r items from n where order matters. nCr (combination) counts unordered selections: how many ways to choose r items from n where order doesn't matter. nCr = nPr ÷ r!

What is the largest factorial this calculator can compute?

This calculator handles factorials up to 170! accurately. Beyond that, JavaScript's floating-point numbers overflow to Infinity. For extremely large factorials, Stirling's approximation is used in advanced mathematics.

Where are factorials used in real life?

Factorials appear in probability (how many outcomes are possible), statistics (permutation and combination tests), cryptography (key space calculations), and computer science (algorithm complexity analysis). Shuffling a deck of cards has 52! ≈ 8×10⁶⁷ possible arrangements.

What is the difference between a permutation and a combination?

A permutation counts ordered arrangements - the order matters. A combination counts unordered selections - the order does not matter. Example: selecting 2 students from 4 (A, B, C, D). Permutations (ordered): AB, BA, AC, CA, AD, DA, BC, CB, BD, DB, CD, DC = 12 arrangements. Combinations (unordered): AB, AC, AD, BC, BD, CD = 6 selections. nPr = n! / (n-r)! and nCr = n! / (r! x (n-r)!).

What is 0! (zero factorial)?

0! = 1 by definition. This is not just a convention - it is mathematically necessary for formulas involving permutations and combinations to work correctly. For example, nCr when r = 0 or r = n must equal 1 (there is exactly one way to choose none or all items). If 0! were 0, these formulas would break down. The result follows from the recursive definition: n! = n x (n-1)!, so 1! = 1 x 0!, giving 0! = 1.

How are factorials used in probability?

Factorials are the foundation of counting in probability. They appear in: (1) Combinations: nCr = n! / (r! x (n-r)!) - used to find the probability of selecting k items from n. (2) Permutations: nPr = n! / (n-r)! - used when order matters. (3) The binomial distribution formula. (4) Calculating odds in card games, lottery probabilities, and combinatorial problems. Example: the probability of being dealt a specific 5-card poker hand uses combinations from 52 cards.