Permutation and Combination Calculator

Does order matter? Answer that and the rest is arithmetic — shown step by step.

Exact integer arithmetic, no rounding, up to n = 1000. Counting outcomes is not the same as probability — divide one outcome by the total to get the odds.

One question decides everything: does order matter?

Every counting problem in this family splits on a single test. Take the answer you are counting, shuffle the items inside it, and ask whether you now have a different answer. If yes, you want permutations. If no, you want combinations. A gold-silver-bronze podium is a permutation, because first and second are not interchangeable. A three-person committee is a combination, because the committee of Alice, Ben and Chloe is the same committee no matter which name you write first.

That one question is also why the two numbers are never far apart in structure. Permutations count arrangements; combinations count groups. Every group of r items can be arranged r! ways, so nPr is always exactly r! times bigger than nCr.

Worked example: a committee of 3 from 10 people

Order does not matter, so this is C(10, 3) = 10! / (3! x 7!) = 120. You do not need to compute 10! — cancel first. The 7! at the bottom kills everything below 8 on top, leaving (10 x 9 x 8) / (3 x 2 x 1) = 720 / 6 = 120. There are 120 possible committees.

Worked example: ranking 3 of the same 10 people

Now you are naming a chair, a deputy and a secretary. Order matters, so this is P(10, 3) = 10! / 7! = 10 x 9 x 8 = 720. Exactly six times the committee count, because each committee of three can be assigned the three roles in 3! = 6 different ways. Seeing the same 720 and 120 side by side is the fastest way to feel what the division by r! is doing.

Why the formula divides by r!

Build a permutation directly: there are 10 choices for the first pick, 9 for the second, 8 for the third — that is the falling product 10 x 9 x 8. But the committee {Alice, Ben, Chloe} appeared in that list six times, once as ABC, once as ACB, once as BAC and so on. Dividing by 3! removes the duplicates in one move. The full formula nCr = n! / (r! (n - r)!) is the same idea written with factorials: n! arranges everybody, (n - r)! cancels the arrangements of the people you did not pick, and r! cancels the order among the ones you did.

Lottery odds, worked properly

A 6/49 draw asks you to pick six numbers from 49, and the balls are drawn without replacement while your ticket does not care about order. That is C(49, 6) = 13,983,816. One ticket has a 1 in 13,983,816 chance at the jackpot — roughly 0.0000072 percent. A UK-style 6/59 game is C(59, 6) = 45,057,474, more than three times worse. A US Powerball ticket is C(69, 5) = 11,238,513 white-ball combinations multiplied by 26 red balls, giving 292,201,338.

Two things fall straight out of those numbers. First, buying ten tickets multiplies your chance by ten, not by anything more dramatic: 10 in 13,983,816 is still about 1 in 1.4 million. Second, matching some of the numbers is far more likely than matching all of them, and those partial-prize odds are also combination arithmetic: the number of tickets matching exactly 3 of the 6 drawn numbers is C(6, 3) x C(43, 3) = 20 x 12,341 = 246,820.

When repetition is allowed

Tick the repetition box when an item can be selected again. This is the correct model for dice, PINs, passwords and number plates, where the pool is not depleted by picking from it.

Permutations with repetition are simply n^r: every one of the r positions has all n options available. A 4-digit PIN drawn from 10 digits is 10^4 = 10,000. An 8-character password from 62 case-sensitive alphanumerics is 62^8 = 218,340,105,584,896 — around 2.2 x 10^14, which is why length beats cleverness in password strength.

Combinations with repetition are the less familiar case: C(n + r - 1, r), sometimes called the stars-and-bars formula. Choosing three scoops from five ice-cream flavours, where two scoops of pistachio is allowed, gives C(7, 3) = 35 rather than the C(5, 3) = 10 you would get without repeats. The same formula counts how many ways a fixed budget can be split among categories, or how many outcomes exist when rolling several identical dice and only recording the multiset of faces.

Limits and honest caveats

This calculator uses exact big-integer arithmetic, so a result like C(1000, 500) is correct to its last digit rather than a floating-point approximation — but values beyond 30 digits are shown in scientific form with the exact digit count noted underneath, because a 300-digit number is not something anyone reads. The input ceiling is n = 1000 and r = 1000, which covers every classroom and lottery question and keeps the browser responsive.

Two limits are conceptual rather than technical. First, these formulas assume all n items are distinguishable. If your set contains duplicates — the letters in BANANA, for instance — you need the multiset permutation formula n! divided by the product of each repeat count's factorial, not nPr. Second, counting outcomes is not the same as computing probability. The count is the denominator; you still need to decide how many outcomes count as a success before you have odds. Combinatorics tells you how many ways the world can turn out, not how likely any of them is.

Sources & further reading

Frequently asked questions

Combination or permutation — which one do I need?

Ask whether reordering the same items creates a different result. A 4-digit lock code is a permutation because 1234 and 4321 open different locks. Three pizza toppings are a combination because mushroom-pepper-onion is the same pizza in any order.

Why does the combination formula divide by r!?

Permutations count every ordering separately, so each group of r items is counted r! times — once for each way of shuffling it. Dividing by r! collapses those duplicates into a single group. That is why nCr is always nPr divided by r!, and why nCr is never larger than nPr.

What does 'with repetition' change?

It lets the same item be picked again, which matches dice, PIN codes and passwords. Permutations with repetition become n^r — a 4-digit PIN from 10 digits is 10^4 = 10,000. Combinations with repetition use C(n+r-1, r), the right model for things like three scoops chosen from five ice cream flavours: C(7, 3) = 35.

What are the odds of winning a 6/49 lottery?

Order does not matter on a lottery ticket, so it is C(49, 6) = 13,983,816 possible tickets. One ticket therefore has a 1 in 13,983,816 chance of matching all six numbers. Buying ten tickets makes it 10 in 13,983,816 — still about 1 in 1.4 million.