Permutation & Combination Calculator

Permutations and combinations

With repetition

Chance of k matches

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

Combinations nCr
n \ r123456
55101051–
101045120210252210
15151054551,3653,0035,005
20201901,1404,84515,50438,760
30304354,06027,405142,506593,775
454599014,190148,9951,221,7598,145,060
50501,22519,600230,3002,118,76015,890,700
For example 45C6 = 8,145,060. A dash means r is larger than n.

Reference table

Permutations nPr
n \ r12345
3366––
552060120120
88563361,6806,720
1010907205,04030,240
12121321,32011,88095,040
20203806,840116,2801,860,480
For example 10P3 = 10 × 9 × 8 = 720.

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.