Permutation & Combination Calculator
Permutations and combinations
Combinations nCr
- Permutations nPr
- Chance of one combination
- %
- Odds: 1 in
With repetition
Ordered (n^r)
- Unordered (multisets)
Chance of k matches
Chance%
- Odds: 1 in
- Matching draws
Your inputs are saved in the address. Bookmark the page (Ctrl+D) to come back to them.
Count the ways to choose r items out of n when order matters (permutations), when it does not (combinations), and when items may be picked more than once (with repetition).
Enter n and r once at the top and every calculator uses them. For a 6-of-45 lottery you get 8,145,060 combinations, the chance that one ticket is the winning one, and the chance of matching any number of balls.
How it works
A permutation counts ordered arrangements: nPr = n! ÷ (n − r)!. A combination counts selections where order does not matter: nCr = n! ÷ (r! × (n − r)!). Picking a president and vice-president from 5 people can be done 5P2 = 20 ways; picking a two-person committee, 5C2 = 10 ways.
When items can be chosen more than once, ordered choices number n^r and unordered ones (multisets) number (n + r − 1)C r. A 4-digit PIN from 0–9 has 10^4 = 10,000 possibilities, and 4 scoops from 3 flavors can be chosen in 15 ways.
The chance of one specific combination is 1 ÷ nCr. The chance of exactly k matches counts the draws that take k of your r numbers and r − k of the other n − r, divided by all combinations (the hypergeometric distribution). Lotteries with bonus balls or extra rules need more than this formula for prize tiers.
Every count is an exact integer, not an approximation. n can be up to 1,000, and results longer than 300 digits are reported as out of range.
Worked examples
- Permutations and combinations
Choosing 6 of 45 items gives 8,145,060 combinations, or 5,864,443,200 permutations if order matters. The chance of one specific combination is 0.0000123%, or 1 in 8,145,060. - Permutations and combinations
Choosing 5 of 52 items gives 2,598,960 combinations, or 311,875,200 permutations if order matters. The chance of one specific combination is 0.0000385%, or 1 in 2,598,960. - With repetition
Choosing 4 from 10 kinds with repetition allowed gives 10,000 ordered arrangements and 715 unordered selections. - Chance of k matches
When 6 of 49 numbers are drawn, the chance that exactly 3 of your 6 picks are among them is 1.77%, or 1 in 56.66; there are 246,820 such draws.
Reference table
| n \ r | 1 | 2 | 3 | 4 | 5 | 6 |
|---|---|---|---|---|---|---|
| 5 | 5 | 10 | 10 | 5 | 1 | – |
| 10 | 10 | 45 | 120 | 210 | 252 | 210 |
| 15 | 15 | 105 | 455 | 1,365 | 3,003 | 5,005 |
| 20 | 20 | 190 | 1,140 | 4,845 | 15,504 | 38,760 |
| 30 | 30 | 435 | 4,060 | 27,405 | 142,506 | 593,775 |
| 45 | 45 | 990 | 14,190 | 148,995 | 1,221,759 | 8,145,060 |
| 50 | 50 | 1,225 | 19,600 | 230,300 | 2,118,760 | 15,890,700 |
Reference table
| n \ r | 1 | 2 | 3 | 4 | 5 |
|---|---|---|---|---|---|
| 3 | 3 | 6 | 6 | – | – |
| 5 | 5 | 20 | 60 | 120 | 120 |
| 8 | 8 | 56 | 336 | 1,680 | 6,720 |
| 10 | 10 | 90 | 720 | 5,040 | 30,240 |
| 12 | 12 | 132 | 1,320 | 11,880 | 95,040 |
| 20 | 20 | 380 | 6,840 | 116,280 | 1,860,480 |
FAQ
How do I know whether to use a permutation or a combination?
If swapping the chosen items gives a different outcome, use a permutation; if not, a combination. Awarding gold, silver and bronze is a permutation; picking three team members is a combination.
Why is 0! equal to 1?
There is exactly one way to arrange nothing. Defining 0! = 1 keeps formulas such as nC0 = nCn = 1 true, which is why r = 0 gives a result of 1.
What are the odds of winning a 6/49 lottery jackpot?
There are 49C6 = 13,983,816 combinations, so one ticket has a 1 in 13,983,816 chance of matching all six. Check the lottery operator for its actual prize rules.
When do I need combinations with repetition?
When the same kind can be picked several times and order does not matter, such as buying 5 pieces of fruit from apples, pears and oranges, or the possible totals of several dice.
Are very large results exact?
Yes. Every digit is computed as an integer, with no rounding or scientific notation. To keep results displayable, n is limited to 1,000 and results to 300 digits.