Work out how many ways you can choose r items from a set of n. Choose whether order matters — a podium finish (permutation) or a lottery ticket (combination) — and whether items can repeat, and the calculator gives the exact count, even for very large numbers.
What are permutations and combinations?
Permutations and combinations count the ways of choosing r items from a set of n. A permutation is an ordered arrangement — first, second and third place in a race — so swapping two items gives a different outcome. A combination is an unordered selection, such as the numbers on a lottery ticket, where only which items are chosen matters.
Both come from the multiplication principle. For the first pick there are n choices, then n − 1, and so on, giving nPr = n × (n − 1) × … × (n − r + 1) = n! ÷ (n − r)!. Each group of r items can be put in r! orders, so dividing by r! removes the duplicates and gives nCr. The number nCr is also the binomial coefficient, the entry in row n of Pascal’s triangle.
How to use the permutation and combination calculator
- Enter n, the number of items to choose from, and r, how many you pick.
- Choose whether the order matters and whether items can repeat.
- Read the count. Answers over 15 digits are shown in scientific notation with the number of digits.
Formula
nPr = n! ÷ (n − r)! · nCr = n! ÷ (r! × (n − r)!)
With repetition allowed, the number of ordered arrangements is nʳ and the number of unordered selections is (n + r − 1)! ÷ (r! × (n − 1)!).
Every combination of r items can be arranged in r! orders, so nPr = nCr × r!.
Worked examples
Gold, silver and bronze from 10 runners
- Total items (n)
- 10
- Items chosen (r)
- 3
- Does order matter?
- Yes — permutations (nPr)
- Can an item be chosen more than once?
- No (without repetition)
- Permutations (nPr)
- 720
- Combinations (nCr)
- 120
Order matters, so count permutations: 10 × 9 × 8 = 720 possible podiums.
A 6-from-49 lottery ticket
- Total items (n)
- 49
- Items chosen (r)
- 6
- Does order matter?
- No — combinations (nCr)
- Can an item be chosen more than once?
- No (without repetition)
- Combinations (nCr)
- 13,983,816
- Permutations (nPr)
- 10,068,347,520
The order the balls are drawn doesn’t matter: 49C6 = 49! ÷ (6! × 43!) = 13,983,816, so one ticket has a 1 in 13,983,816 chance of the jackpot.
A 4-digit PIN
- Total items (n)
- 10
- Items chosen (r)
- 4
- Does order matter?
- Yes — permutations (nPr)
- Can an item be chosen more than once?
- Yes (with repetition)
- Permutations with repetition (nʳ)
- 10,000
- Combinations with repetition
- 715
Each of the 4 positions can be any of 10 digits, and digits can repeat, so there are 10⁴ = 10,000 PINs.
Which formula to use
| Order matters? | Repetition? | Formula | Example (n = 5, r = 3) |
|---|---|---|---|
| Yes | No | n! ÷ (n − r)! | 60 |
| No | No | n! ÷ (r!(n − r)!) | 10 |
| Yes | Yes | nʳ | 125 |
| No | Yes | (n + r − 1)! ÷ (r!(n − 1)!) | 35 |
Counting the complement: the birthday problem
Some questions are easier to answer by counting what you don’t want. The chance that at least two of 23 people share a birthday is 1 minus the chance that all 23 differ. The number of ways to give 23 people different birthdays is the permutation 365P23, out of 365²³ possibilities in all, which leaves a 50.7% chance of a shared birthday. Most people guess far lower.
Common mistakes
- Using permutations when order doesn’t matter, which overcounts by a factor of r!.
- Forgetting whether items can repeat — a PIN allows repeated digits, a race result doesn’t.
- Computing huge factorials separately and dividing; cancel first (nPr is just the product of the top r terms of n!).
Frequently asked questions
What is the difference between a permutation and a combination?
In a permutation the order matters (ABC and CBA are different); in a combination it doesn’t (ABC and CBA are the same group). There are always at least as many permutations as combinations.
How many 5-card poker hands are there?
Choosing 5 cards from 52 where order doesn’t matter: 52C5 = 2,598,960 hands.
What is 0! (zero factorial)?
By definition 0! = 1, so there is exactly one way to choose nothing: nC0 = 1.
How many ways can I arrange letters when some repeat?
Divide n! by the factorial of each letter’s count. MISSISSIPPI has 11 letters with four I’s, four S’s and two P’s, so there are 11! ÷ (4! × 4! × 2!) = 34,650 distinct arrangements.
Sources
- Combination, Wolfram MathWorld
- Permutation, Wolfram MathWorld
- Digital Library of Mathematical Functions, §26.3: Binomial Coefficients, National Institute of Standards and Technology (NIST)
Last updated · Calculations checked by automated tests· Editorial policy