How to use the permutation and combination calculator
- Enter n, the number of items you choose from, and r, how many you choose.
- Choose what you are counting: combinations if order doesn’t matter, permutations if it does, and whether items can repeat. The table shows all four counts at once.
- Follow the steps, or type your items to see every arrangement listed. The last panel counts the arrangements of a word’s letters.
Permutations or combinations: does order matter?
Both count ways of choosing r things from n. The difference is whether the order of the choice matters.
- Permutations count ordered arrangements. Gold, silver and bronze for 3 of 10 runners: who gets which medal matters, so there are 10 × 9 × 8 = 720 ways.
- Combinations count unordered selections. 3 toppings from 10 for a pizza: mushrooms, olives and peppers is the same pizza in any order, so there are 120 ways, the 720 orders divided by the 3 × 2 × 1 = 6 orders of each set of three.
A quick test: if swapping two of the chosen items gives a different result, it is a permutation.
The formulas
- Permutations: nPr = n! / (n − r)!
- Combinations: nCr = n! / (r! (n − r)!), also written C(n, r) or as n over r in brackets, and read “n choose r”.
- Permutations with repetition: nʳ
- Combinations with repetition: (n + r − 1)! / (r! (n − 1)!)
The exclamation mark is the factorial: n! = n × (n − 1) × … × 2 × 1, so 5! = 120, and 0! is defined as 1. In practice, most of each factorial cancels: 10! / 7! leaves just 10 × 9 × 8. The calculator shows this cancelled form in its steps.
When items can repeat
If an item can be chosen more than once, the counts grow. A 4-digit PIN is a permutation with repetition: each digit can be any of 10, so there are 10⁴ = 10,000 PINs. Choosing 3 scoops of ice cream from 5 flavors, where two scoops can be the same flavor and the order in the bowl doesn’t matter, is a combination with repetition: C(5 + 3 − 1, 3) = C(7, 3) = 35 ways. This is often worked out with the “stars and bars” picture: 3 stars for the scoops and 4 bars to split them into 5 flavors, arranged in a row of 7.
Arranging the letters of a word
A word with all different letters can be arranged in n! ways: STOP has 4! = 24. When letters repeat, swapping two identical letters doesn’t make a new word, so divide by the factorial of each letter’s count. MISSISSIPPI has 11 letters, with 4 I’s, 4 S’s and 2 P’s, so it has 11! / (4! × 4! × 2!) = 34,650 different arrangements.
Probability and odds
Counting is the first step of many probability questions: when every outcome is equally likely, the chance of one particular outcome is 1 divided by the number of outcomes. In a lottery that draws 6 numbers from 49, the order doesn’t matter, so there are 49C6 = 13,983,816 possible tickets, and one ticket has a 1 in 13,983,816 chance of matching all six. There are 52C5 = 2,598,960 different 5-card hands from a standard deck. The Common Core high school standards include this use directly: “use permutations and combinations to compute probabilities of compound events and solve problems” (standard HSS-CP.B.9).
The multiplication rule behind both
Both formulas come from one idea, the multiplication rule: if one choice can be made in a ways and a second in b ways, the two together can be made in a × b ways. A restaurant with 3 starters, 5 mains and 4 desserts offers 3 × 5 × 4 = 60 different three-course meals. A permutation applies the rule with one option fewer each time, so 10 runners can take gold, silver and bronze in 10 × 9 × 8 = 720 ways. A combination then divides by the number of orders of each group, 3! = 6 for a group of 3, which leaves 120. When a problem has several separate steps, such as choosing 2 of 6 men and 2 of 5 women for a team, count each step and multiply: 6C2 × 5C2 = 15 × 10 = 150.
Pascal’s triangle and symmetry
The combinations nCr are the numbers in Pascal’s triangle: row n, position r, counting from 0. Each number is the sum of the two above it, which is the rule nCr = (n − 1)C(r − 1) + (n − 1)Cr. Choosing r items to take is the same as choosing n − r to leave behind, so nCr = nC(n − r): 10C3 and 10C7 are both 120. And because each item is either chosen or not, all the combinations of n items add up to 2ⁿ.
Common mistakes
- Using a permutation when order doesn’t matter. A hand of cards, a committee or a lottery ticket is the same whatever order it was picked in, so it is a combination. Using nPr instead counts every order of each hand separately and gives an answer r! times too big.
- Forgetting repeats. Codes, PINs and passwords usually let a symbol appear again, so they are nʳ, not nPr. A 4-digit PIN with no repeated digit would have only 10 × 9 × 8 × 7 = 5,040 choices, about half the full 10,000.
- Choosing more than there are. Without repeats you can’t choose 5 items from 3, so the count is 0, not an error.
- Mixing up n and r. n is the size of the group you choose from and r is how many you take, so r can’t be more than n unless repeats are allowed.
Big numbers, exactly
Factorials grow fast. 20! is already 2,432,902,008,176,640,000, and the number of ways to shuffle a deck of 52 cards, 52!, has 68 digits. Ordinary calculators round these to a few digits. This calculator works with whole numbers of any size, so it gives the exact count for n and r up to 1,000, along with a short scientific-notation version of very long answers.
Your data stays on your device
Everything is worked out in your browser. Nothing you type is sent anywhere or stored.
Frequently asked questions
What is the difference between a permutation and a combination?
In a permutation the order matters; in a combination it doesn’t. Picking a president, secretary and treasurer from 10 people is a permutation, 720 ways, because the jobs differ. Picking a committee of 3 is a combination, 120 ways, because the same three people make the same committee in any order.
What is the formula for nCr?
nCr = n! / (r! (n − r)!), where n! means n × (n − 1) × … × 1. For 10C3: 10! / (3! × 7!) = (10 × 9 × 8) / (3 × 2 × 1) = 720 / 6 = 120.
What is the formula for nPr?
nPr = n! / (n − r)!, which is the first r terms of n × (n − 1) × (n − 2) × …. For 10P3: 10 × 9 × 8 = 720.
How many 4-digit PINs are there?
10,000. Each of the 4 digits can be any of 10, and digits can repeat, so there are 10⁴ = 10,000, from 0000 to 9999. That is a permutation with repetition.
Why is 0! equal to 1?
There is exactly one way to arrange nothing: do nothing. Defining 0! = 1 also keeps the formulas working, so that choosing all n items, nCn = n! / (n! × 0!), comes out as 1.
Is anything I type saved or sent?
No. Everything is worked out in your browser and nothing you type is sent anywhere or stored.