Permutation and Combination Calculator
Permutation and Combination Calculator
Count the ways to choose or arrange r items from n: combinations when order does not matter, permutations when it does, with or without repetition. Answers are exact to the last digit, with the factorial working, the odds of one particular outcome and, for small cases, every arrangement listed.
Filling the slots
Row of Pascal’s triangle
Every arrangement
Permutations without repetition: n! ÷ (n − r)!. Combinations without repetition: n! ÷ (r! (n − r)!). Permutations with repetition: n to the power r. Combinations with repetition: (n + r − 1)! ÷ (r! (n − 1)!). All counts use exact whole number arithmetic, so even 1000 choose 500, a number with 300 digits, is exact; very long answers are also shown in scientific notation. n can be up to 10,000. The CSV, image and printed report contain the values you entered, nothing preloaded.
How to use this tool
Enter n, the number of items you are choosing from, and r, how many you pick. Then answer the two questions that decide the formula: does the order of the picks matter, and can the same item be picked more than once? The answer updates as you type, and for small cases every arrangement is listed so you can check the count by eye.
The setting people most often get wrong is order. A lottery draw, a poker hand or a committee is a combination, because the same items in a different order are the same result. A race finish, a PIN or a password is a permutation, because changing the order changes the outcome.
What the calculation is doing
Every formula here comes from filling slots. For an ordered pick without repeats, the first slot has n choices, the second n − 1, and so on for r slots, which gives P(n, r) = n! ÷ (n − r)!. For 10 items and 3 slots that is 10 x 9 x 8 = 720.
A combination ignores order, so each group of r has been counted r! times, once for every way to arrange it. Dividing by r! gives C(n, r) = n! ÷ (r! (n − r)!), and 720 ÷ 6 = 120. With repeats, every slot keeps all n choices, giving n to the power r, and combinations with repeats use the stars and bars count, C(n + r − 1, r).

Why the numbers grow so fast
Factorials outrun every other everyday function. 10! is 3,628,800, and 52!, the number of orders a deck of cards can be shuffled into, is about 8.07 x 10 to the power 67. A well shuffled deck is almost certainly in an order that no deck has been in before. Ordinary calculators give up at 171!, which is larger than the biggest number they can hold, so this tool works with exact whole numbers instead.
Combinations have a neat structure. Choosing 3 to keep from 10 is the same as choosing 7 to leave out, so C(10, 3) = C(10, 7) = 120, and the counts rise to a peak at r = n/2 before falling again. Each count is also the sum of two smaller ones, C(n, r) = C(n − 1, r − 1) + C(n − 1, r), because a group either includes a particular item or it does not. That rule builds Pascal’s triangle, shown under the calculator for your n.
Counts worth knowing
| Situation | Count | Ways |
|---|---|---|
| Poker hands, 5 cards from 52 | 52 choose 5 | 2,598,960 |
| 6 from 49 lottery | 49 choose 6 | 13,983,816 |
| Powerball, 5 from 69 and 1 from 26 | 69 choose 5, times 26 | 292,201,338 |
| 4 digit PIN, repeats allowed | 10 to the power 4 | 10,000 |
| 4 digit PIN, all digits different | P(10, 4) | 5,040 |
| 3 letter code | 26 to the power 3 | 17,576 |
| Top 3 finishers from 8 runners | P(8, 3) | 336 |
| Handshakes among 20 people | 20 choose 2 | 190 |
| 3 scoops from 31 flavours, repeats allowed | 31 multichoose 3 | 5,456 |
| Orders of a 52 card deck | 52! | 8.06581 x 1067 |
A worked example you can check on paper
How many 5 card poker hands come from a 52 card deck? The order cards arrive in does not matter and a card cannot appear twice, so this is 52 choose 5. Multiply the top five numbers: 52 x 51 x 50 x 49 x 48 = 311,875,200. That is the count of ordered deals.
Each hand can be dealt in 5! = 120 orders, so divide: 311,875,200 ÷ 120 = 2,598,960 hands. The chance of being dealt one particular hand, say the royal flush in spades, is 1 in 2,598,960. There are four royal flushes, so the chance of any royal flush is 4 in 2,598,960, or 1 in 649,740.
Mistakes that catch people out
Calling a lock a combination. A 3 number lock cares about order and allows repeats, so it has n to the power 3 settings, not n choose 3.
Using a combination when the positions differ. Choosing a chair, secretary and treasurer from 10 people is P(10, 3) = 720, not 120, because swapping two people swaps their jobs.
Forgetting repeats. A password can reuse letters; a hand of cards cannot. The count changes by orders of magnitude, so decide first.
Counting one outcome instead of a type. The chance of one particular hand is 1 in the total, but the chance of any flush needs the number of flushes on top. Count the favourable outcomes before dividing.
Trusting a calculator overflow. Many calculators show an error or a rounded value for large factorials. Exact answers need exact arithmetic, or cancelling before multiplying as in the worked example.
Popular calculations
Each opens the calculator with those numbers filled in, and they can be changed once it is open.
Combinations, n choose r
Permutations, nPr
Permutations with repetition
Combinations with repetition
How this was checked
Every count uses exact whole number arithmetic, so nothing is rounded until the scientific notation shown for very long answers. For every n up to 8 and r up to 5, in all four modes, the arrangements were generated one by one and counted, and the totals matched the formulas in all 216 cases. Pascal’s rule and the symmetry C(n, r) = C(n, n − r) were checked for every n up to 60, and known values such as 2,598,960 poker hands and 13,983,816 lottery tickets were confirmed.
Every address in the lists above was then opened and checked for a distinct title, the right answer, charts that render, and clean CSV, image and print output containing only that calculation, at desktop, tablet and phone widths.
Common questions
What is the difference between a permutation and a combination?
A permutation counts arrangements, where order matters: ABC and CBA are different. A combination counts selections, where order does not matter: ABC and CBA are the same group. For 3 items from 10 there are 720 permutations but only 120 combinations, because each group of 3 can be ordered 6 ways.
How do you calculate n choose r?
Use C(n, r) = n! ÷ (r! (n − r)!). In practice, multiply the top r numbers counting down from n and divide by r!. For 10 choose 3: (10 x 9 x 8) ÷ (3 x 2 x 1) = 720 ÷ 6 = 120.
How many 4 digit combinations are there from 0 to 9?
It depends on the rules. If digits can repeat and order matters, as with a PIN or a lock, there are 10 to the power 4 = 10,000. If the 4 digits must all differ, there are 5,040 ordered codes, or 210 unordered sets.
Why is 0! equal to 1?
There is exactly one way to arrange nothing, and defining 0! = 1 keeps the formulas working at the edges: C(n, 0) and C(n, n) both come out as 1, which matches the single way to choose none or all of the items.
What are combinations with repetition?
They count selections where the same item can be picked more than once and order does not matter, such as 3 scoops from 10 flavours. The stars and bars method turns it into an ordinary choose: C(n + r − 1, r), which is 220 for 3 scoops from 10 flavours.
What are the odds of winning a 6 from 49 lottery?
There are 49 choose 6 = 13,983,816 possible tickets and one winning combination, so the chance is 1 in 13,983,816, about 0.0000072%. Order does not matter because the drawn numbers are sorted before they are compared.
Related Calculators and Reference
- Random Number Generator: draw the numbers these formulas count, with or without repeats.
- Percentage Calculator: turn odds of 1 in N into a percentage.
- Fraction Calculator: work with probabilities as fractions.
- Scientific Calculator: factorials inside longer expressions.
- Dice Probability Calculator: counting in action, the exact chance of any dice total.
- Binomial Distribution Calculator: the binomial probabilities those counts feed.
- Probability of Two Events Calculator: turn counts of outcomes into the chance of both, either or neither of two events.
- NIST DLMF 26.3: Binomial Coefficients: the formal definitions and identities behind n choose r.
