alleasycalc
Suggest
Permutation and Combination Calculator

Permutation and Combination Calculator

Pick a total (n) and how many you're choosing (r) and see both answers at once: permutations, where order matters, and combinations, where it doesn't. Every result is exact, arbitrary-precision arithmetic, with the cancellation working shown rather than two enormous factorials.

Your group

How many items are in the whole group. Exact whole-number results go up to n = 1,000; past that the numbers involved stop being practical to display in full.

How many of those items you're picking. r can equal n (arrange or choose everyone) or 0 (the empty pick), and setting r bigger than n just gives 0 ways rather than an error.

Quick scenarios

Loads n and r for a few common real-world questions, all explained further down the page.

Which one do I need?

Does the order you pick items in change the outcome? Yes, first, second and third place are different, or a password read in a different order is a different password: you want permutations. No, a committee, a hand of cards or a set of lottery numbers is the same group whatever order it was drawn in: you want combinations.

Could the same item be picked more than once? If not, and it isn't for anything on this page, both answers below apply directly. If it can (a 4-digit PIN, say), you need the repetition versions of these formulas, named further down the page but not calculated here, to keep this calculator focused on picking without repeats.

Permutations and combinations, in plain terms

Both words describe ways of picking r items out of a group of n. The whole difference between them is whether the order you pick things in changes the answer. A permutation counts arrangements: 1st, 2nd and 3rd place in a race are different outcomes even with the same three runners, so swapping two of them counts as a new result. A combination counts groups: a five-card poker hand or a lottery draw is the same hand or the same draw no matter what order the cards or balls came out in, so shuffling the order changes nothing.

Every combination is really a whole bundle of permutations with the ordering thrown away. That single idea is what connects the two formulas below, and it's the one thing worth remembering if the rest of this page ever slips your mind.

The two formulas, and where they come from

The permutation formula counts ordered picks of r items from n, written nPr or P(n,r):

nPr = n! ÷ (n − r)!

In practice that division cancels almost everything away, so this calculator never actually multiplies out two huge factorials and divides them. It multiplies the r numbers counting down from n instead, which is exactly the same result reached the short way: n × (n−1) × (n−2) × … down to (n − r + 1). For 10P3 that's 10 × 9 × 8 = 720, not 10! divided by 7!.

The combination formula counts unordered picks of r items from n, written nCr, C(n,r), or "n choose r":

nCr = n! ÷ (r! × (n − r)!) = nPr ÷ r!

The second form is the one to hold onto. Every group of r items you could choose can be arranged in r! different orders (r! itself is r × (r−1) × … × 1), and the permutation count already includes every one of those orderings as a separate result. Divide the permutations by r! and every group of r! look-alike arrangements collapses down to the single unordered group they all represent. For 10 choose 3, that's 720 ÷ 3! = 720 ÷ 6 = 120: 720 ordered picks, six apiece for every one of the 120 actual three-person groups.

Worked examples: podiums, hands, lotteries and handshakes

A three-runner podium from ten racers is a permutation, because first, second and third are different prizes. 10P3 = 10 × 9 × 8 = 720 possible podiums.

A five-card poker hand from a 52-card deck is a combination: the cards you're dealt are the same hand whatever order they arrived in. 52C5 works out to 2,598,960 possible hands.

A classic 6-from-49 lottery draw, the format the UK National Lottery launched with in 1994 and that Canada's Lotto 6/49 still uses, is the standard combination worked example: 49C6 = 13,983,816. That's usually rounded to odds of about 1 in 14 million for matching all six, and it's a combination rather than a permutation because the balls landing in a different order still wins the same prize.

Handshakes at a gathering are a neat combination in disguise: with 8 people in a room, each handshake is an unordered pair, so the total is 8C2 = 28. A committee of 4 chosen from 12 candidates, with no distinct roles, is the same kind of question: 12C4 = 495 possible committees.

A 4-digit password or PIN would be a permutation question if repeats weren't allowed (order matters, and 1234 is a different code from 4321), but real PINs allow the same digit twice, which moves it into the repetition case covered below rather than the plain nPr this calculator computes.

The edge cases: r above n, r of zero, and r equal to n

Three situations are worth knowing rather than being surprised by. If r is bigger than n, both nPr and nCr are 0: you cannot arrange or choose more items than the group actually contains, and the calculator says so calmly rather than treating it as an error. If r is 0, both nPr and nCr equal 1, not 0: choosing nothing is itself one well-defined outcome, the empty selection, and there is exactly one way to do it, whatever n is. If r equals n, nPr becomes n! (every possible arrangement of the whole group) while nCr drops to exactly 1, because once order stops counting, every one of those n! arrangements is just the same single group containing everybody.

When items can repeat: two formulas this page doesn't calculate

Everything above assumes each of the n items can only be picked once. Allowing repeats is a genuinely different question with its own formulas, named here for completeness but left out of this calculator so it stays focused on the classic without-repeats case. Permutations with repetition, where order matters and items can recur (PINs, dial combinations), are counted by nr: a 4-digit PIN has 104 = 10,000 possibilities. Combinations with repetition, where order doesn't matter but the same type can be picked more than once (scoops of ice cream from a set of flavours, say), are counted by the "stars and bars" formula, C(n + r − 1, r), also called the multiset coefficient. Both are worth knowing exist; neither belongs mixed into the same form as the without-repeats case above.

Pascal's triangle and the symmetry rule

Every nCr value is an entry in Pascal's triangle: row n, position r, built by starting each row and end with a 1 and filling the middle by adding the two numbers diagonally above. That addition is not a coincidence, it's the identity C(n−1, r−1) + C(n−1, r) = C(n, r), shown live with your own numbers in the results panel above. The same triangle also explains why choosing r items from n always gives the same count as choosing the n − r you'd leave behind: picking a group and picking its leftovers are two names for the same split, so C(n, r) = C(n, n − r) every time, which the panel also checks directly rather than assuming.

Reading the results panel

Both headline numbers are exact for any n up to 1,000, computed with arbitrary-precision integer arithmetic rather than floating-point approximation, so nothing is rounded even when the numbers run into hundreds of digits. Past a dozen digits or so the panel adds a digit count next to the value, since a number that long stops being easy to read at a glance; the supporting table adds scientific notation for genuinely huge results. The chart shows a short window of Pascal's triangle's row n, centred on your r, with your chosen r picked out in green and its symmetric partner, n − r, picked out in amber when the two differ, so the shape of the row around your answer is visible rather than just described.

Questions people ask

What is the difference between a permutation and a combination?

Order. A permutation counts arrangements, so swapping the order of two chosen items gives a different result. A combination counts groups, so the same items in a different order are the same result. Ten people in a three-place race give 720 possible permutations but only 120 possible groups of three finalists.

How do you calculate permutations and combinations?

Permutations: nPr = n! ÷ (n − r)!, worked in practice as n × (n−1) × … down to r terms. Combinations: nCr = nPr ÷ r!, taking that permutation count and dividing out the r! orders each group can appear in.

Why divide by r! to get combinations from permutations?

Because every unordered group of r items shows up r! times among the permutations, once for each way those r items can be shuffled. Dividing by r! collapses each of those look-alike groups back down to the single combination they represent.

What happens if r is bigger than n?

Both nPr and nCr come out as 0. A group of n items cannot supply more than n of them, arranged or not, so 0 is the correct, calm answer rather than an error.

What is nCr when r is 0, or when r equals n?

nC0 is always 1: choosing nothing is one well-defined outcome. When r equals n, nCr is also 1, because with no items left over, every possible arrangement of the whole group counts as the same single selection.

How is the lottery odds figure worked out?

Choosing 6 numbers from 49 with order not mattering is 49C6, which comes to 13,983,816. That is usually rounded to about 1 in 14 million odds of matching all six numbers in a single ticket.

What if items can be chosen more than once?

That's a different pair of formulas: nr for permutations with repetition (order matters, repeats allowed, like PIN codes), and the "stars and bars" formula C(n + r − 1, r) for combinations with repetition (order doesn't matter, repeats allowed). This calculator covers the classic without-repetition case only, to keep the two main formulas front and centre.

All results are computed with exact arbitrary-precision integer arithmetic, not floating-point approximation, for any n up to 1,000. For working with plain factorials or ratios instead, try the exponent calculator or the ratio calculator on this site.

Report a bug

Say what went wrong and where. One sentence is plenty; we read every report.

Embed this calculator

Paste this into your page. The frame sizes itself to fit. Embedding is free while AllEasyCalc grows; the small credit link stays visible.

Email this result

The email comes from AllEasyCalc and carries a link that reopens this calculator with the numbers filled in. One-off, no mailing list.

Suggest a calculator

Name the question you want answered. If it can be worked out, it goes on the build list.