Combination Calculator
Use nCr = n! ÷ (r! × (n - r)!) when order does not matter and nPr = n! ÷ (n - r)! when it does. Choosing 3 from 10 gives 120 combinations but 720 permutations, because each group of 3 can be put in 3! = 6 orders. Enter n and r to get both.
Last updated by Ultra Calculator
Combinations (nCr, nPr)
How to calculate it
nCr = n! ÷ (r! × (n - r)!), nPr = n! ÷ (n - r)!
- n
- the number of different items to choose from
- r
- the number of items chosen
- nCr
- combinations, selections where order does not matter
- nPr
- permutations, arrangements where order matters
- !
- factorial, for example 4! = 4 × 3 × 2 × 1 = 24
Without repeats, nPr = r! × nCr. With repeats allowed, also called choosing with replacement, the calculator uses C(n + r - 1, r) for combinations and n^r for permutations.
Worked example
Choosing 3 from 10
10C3 = 120 groups, and 10P3 = 720 ordered arrangements. Each group of 3 can be ordered 3! = 6 ways, and 6 × 120 = 720.
| Total items (n) | 10 |
|---|---|
| Items chosen (r) | 3 |
| Calculation type | Both nCr and nPr |
| Repeats allowed? | No (without replacement) |
| Combinations (nCr) | 120 |
|---|---|
| Permutations (nPr) | 720 |
| Formula used | Without replacement: C(10, 3) = 10! ÷ (3! × 7!), and P(10, 3) = 10! ÷ 7! |
| Check: nPr = r! × nCr | P(10, 3) = 3! × C(10, 3) = 6 × 120 = 720 |
How to use this calculator
- Enter Total items (n), the number of different items, up to 170.
- Enter Items chosen (r), the number you pick.
- Choose the Calculation type: Combinations (nCr) if order does not matter, Permutations (nPr) if it does, or both.
- Set Repeats allowed? to Yes if an item can be chosen more than once.
- Read the result. Formula used shows how it was calculated.
Frequently asked questions
What is the difference between a combination and a permutation?
A combination counts selections where order does not matter, such as picking 3 people for a committee. A permutation counts arrangements where order matters, such as awarding gold, silver and bronze to 3 people. Without repeats, nPr is r! times nCr for the same n and r.
How do you calculate nCr?
Multiply the top r numbers counting down from n, then divide by r!. For 10C3: (10 × 9 × 8) ÷ (3 × 2 × 1) = 720 ÷ 6 = 120. This is the same as 10! ÷ (3! × 7!) with the shared terms cancelled.
When should I choose with replacement?
When an item can be picked again, as with PIN digits or dice rolls. Ordered picks with repeats number n^r, so a 4-digit PIN has 10^4 = 10,000 possibilities. Unordered picks with repeats number C(n + r - 1, r).
Why is nCr equal to nC(n - r)?
Without repeats, choosing r items to keep is the same as choosing n - r items to leave out. So 10C3 and 10C7 are both 120.
How many combinations are there in a 6-from-49 lottery?
49C6 = 13,983,816. Order does not matter in a lottery draw, so use combinations. For games with a bonus ball drawn from a separate pool, multiply by the number of ways to pick from that pool too.
How many 4-digit PINs have no repeated digit?
10P4 = 10 × 9 × 8 × 7 = 5,040. Allowing repeats raises this to 10,000. Set Total items to 10 and Items chosen to 4, then switch Repeats allowed? to compare.
Learn more
Does order matter?
Ask whether swapping two chosen items changes the result. A pizza with ham and mushroom is the same as one with mushroom and ham, so toppings are combinations. A race where Ana finishes first and Ben second differs from the reverse, so finishing positions are permutations.
Combinations with repeats (stars and bars)
Choosing 3 scoops from 5 flavours, with repeated flavours allowed, can be represented by 3 identical stars and 4 dividers separating the flavours. Arranging those symbols gives C(5 + 3 - 1, 3) = C(7, 3) = 35 combinations. With repeats allowed, r can be larger than n.
How permutations and combinations relate
Without repeats, every combination of r items can be arranged in r! orders, so nPr = r! × nCr. The Check row shows this relationship when you ask for both results, repeats are not allowed and r is 20 or less.
- Counting possible lottery tickets, such as 13,983,816 for a 6-from-49 game
- Working out how many ways there are to pick a team or committee
- Counting podium finishes: 8 runners can take gold, silver and bronze in 8P3 = 336 ways
- Counting PINs, codes and passwords with or without repeated characters
- Finding the denominator of a card probability, such as the 2,598,960 five-card poker hands (52C5)
Using permutations when order does not matter
Without repeats, this counts each group r! times. Picking 3 from 10 gives 120 groups, not 720.
Picking the wrong replacement setting
Lottery balls are not put back, so use No. PIN digits can repeat, so use Yes.
Thinking r can never exceed n
That is true only without replacement. With repeats, 5 scoops from 3 flavours is possible: C(7, 5) = 21 ways.
Forgetting to divide by r!
10 × 9 × 8 = 720 is 10P3. Divide by 3! = 6 to get 10C3 = 120.
- Without repeats, use the smaller of r and n - r when working by hand: 50C48 is the same as 50C2 = 1,225.
- When combinations are equally likely, divide the number of winning combinations by the total to find a probability.
- In scientific notation, e+12 means multiply by 10^12.
Methodology and sources
n and r must be whole numbers. Without replacement, nCr is built as a running product, multiplying by n, n - 1 and so on while dividing by 1, 2 and so on. Full factorials are never stored, and the result is rounded to the nearest whole number. nPr is n × (n - 1) × ... × (n - r + 1). With replacement, combinations use C(n + r - 1, r) and permutations use n^r; with nothing to choose from (n = 0), the only selection is the empty one, so r = 0 gives 1 and any larger r gives 0. Results below 10^15 are shown in full; larger results appear in scientific notation to 7 significant figures, and because standard double-precision numbers keep about 15 to 17 significant digits, large results may not be exact. Only the results you choose to show have to stay below about 1.8 × 10^308, so a combinations-only answer isn't blocked by a permutation count too large to hold. n can be up to 170, and without replacement r cannot exceed n.