Permutation and Combination Calculator (nPr and nCr)
Enter n, the number of items to choose from, and r, how many you pick. You get permutations (order matters) and combinations (order does not), with and without repeats.
Last reviewed
Picking 3 from 10
P = 720
C = 120 when the order does not matter
| Picks | Order matters | Order does not matter |
|---|---|---|
| No repeats | 720 | 120 |
| Repeats allowed | 1,000 | 220 |
- 10!
- 3,628,800
- 3!
- 6
- (10 − 3)!
- 5,040
Permutations count ordered arrangements (a race result, a PIN). Combinations count unordered groups (a hand of cards, a committee). All values are exact whole numbers, not rounded.
Two questions decide everything
To count the ways of picking r things from n, ask:
- Does the order matter? If picking A then B is different from B then A, it is a permutation. If only the group counts, it is a combination.
- Can the same thing be picked again? If yes, it is “with repetition”. If not, it is “without”.
That gives four cases, and the calculator shows all four.
| Picks | Order matters | Order does not matter |
|---|---|---|
| No repeats | nPr = n! ÷ (n − r)! | nCr = n! ÷ (r! × (n − r)!) |
| Repeats allowed | nʳ | C(n + r − 1, r) |
Factorials
The factorial of n, written n!, is n × (n − 1) × … × 2 × 1. It is the number of ways to put n different things in a row. 0! is defined as 1.
| n | n! |
|---|---|
| 0 | 1 |
| 1 | 1 |
| 2 | 2 |
| 3 | 6 |
| 4 | 24 |
| 5 | 120 |
| 6 | 720 |
| 7 | 5,040 |
| 8 | 40,320 |
| 9 | 362,880 |
| 10 | 3,628,800 |
| 11 | 39,916,800 |
| 12 | 479,001,600 |
Factorials grow very fast. 20! is 2,432,902,008,176,640,000 and 25! has 26 digits. The calculator keeps every digit.
Permutations: order matters
Eight runners finish a race, and you want the number of ways the first three places can be filled. The winner can be any of 8, the second any of the other 7, the third any of the other 6:
8 × 7 × 6 = 336, which is 8! ÷ 5! = 40,320 ÷ 120.
Other cases: a 5-person line can be ordered 5! = 120 ways. Seating 5 people round a table gives (5 − 1)! = 24, since rotating everyone by one seat does not change the arrangement.
Combinations: order does not matter
For a committee of 3 from those 8 people, the order of the three does not matter. Each group of 3 appears 3! = 6 times in the 336 ordered lists, so
C(8, 3) = 336 ÷ 6 = 56.
More examples:
- Poker hands: C(52, 5) = 2,598,960 five-card hands.
- A 6-from-49 lottery: C(49, 6) = 13,983,816 possible draws, so one ticket has a 1 in 13,983,816 chance of matching all six.
Combinations are symmetric: C(n, r) = C(n, n − r). Choosing the 3 people for a committee is the same as choosing the 5 to leave out, so C(8, 3) = C(8, 5) = 56. They are also the entries of Pascal’s triangle, where each is the sum of the two above it: C(n, r) = C(n − 1, r − 1) + C(n − 1, r).
With repetition
- Order matters: each of the r picks has n choices, so nʳ. A 4-digit PIN: 10⁴ = 10,000. An 8-letter lowercase password: 26⁸ = 208,827,064,576.
- Order does not matter: C(n + r − 1, r). Three scoops chosen from 4 flavours, with repeats allowed: C(6, 3) = 20. Two items chosen from 5 types: C(6, 2) = 15.
Common mistakes
- Using the wrong one. Ask whether swapping two picks gives a different outcome. If so, use a permutation.
- Counting the order when it does not matter (or the reverse). The permutation count is always r! times the combination count.
- Forgetting that r cannot exceed n without repeats. You cannot pick 5 different items from 3.
- Mixing up nʳ and n!. nʳ allows repeats and has r picks. n! uses each item exactly once.
- Using a calculator with limited digits. A normal calculator rounds 52! to a few digits, and the result is no longer exact. This one is exact.
Related calculators
- Big number calculator, which also does factorials and powers.
- Statistics calculator and random number generator.
- Exponent calculator, fraction calculator and percentage calculator.
How it is calculated
All values are exact whole numbers in arbitrary-size integer arithmetic. nPr is the product of the r numbers from n − r + 1 up to n. nCr is built up one step at a time as C(n, k) = C(n, k − 1) × (n − k + 1) ÷ k, using the smaller of r and n − r, and each division is exact. With repeats, nʳ is a power and the unordered count is C(n + r − 1, r). Numbers over 18 digits are shown to five significant figures with a digit count, and in full under “Show in full”.
Frequently asked questions
What is the difference between a permutation and a combination?
In a permutation the order matters, so ABC and CBA are different. In a combination only the group matters, so they are the same. Picking 3 from 8 gives 336 permutations but only 56 combinations, because each group of 3 can be ordered in 6 ways.
What are the formulas for nPr and nCr?
nPr = n! ÷ (n − r)! and nCr = n! ÷ (r! × (n − r)!). So nCr = nPr ÷ r!. For n = 10 and r = 3, nPr = 10 × 9 × 8 = 720 and nCr = 720 ÷ 6 = 120.
How many five-card poker hands are there?
C(52, 5) = 2,598,960. The order you are dealt the cards does not matter, only which five you hold, so it is a combination. Counting the order too gives P(52, 5) = 311,875,200, which is 120 times as many.
What changes when repeats are allowed?
If the same item can be picked again and order matters, the count is n^r: a 4-digit PIN has 10⁴ = 10,000 possibilities. If order does not matter, it is C(n + r − 1, r): three scoops from 4 flavours, repeats allowed, is C(6, 3) = 20.
What is 0! and why is it 1?
By definition 0! = 1. It is the number of ways to arrange nothing, which is exactly one way (do nothing). It also keeps the formulas working: C(n, 0) = n! ÷ (0! × n!) = 1, because there is one way to choose none.
Why does it say "not possible" when r is bigger than n?
Without repeats you cannot pick 5 different items from 3, so nPr and nCr are 0 ways and shown as not possible. With repeats you can, so the repeat counts are still shown: 3^5 = 243 ordered, and C(7, 5) = 21 unordered.
Related calculators
- Big Number CalculatorEnter whole numbers of any size, up to 10,000 digits, and choose an operation.
- Statistics CalculatorEnter your numbers, separated by commas, spaces or new lines.
- Random Number GeneratorSet a minimum and maximum, how many numbers you want and whether repeats are allowed, then press Generate.
- Exponent CalculatorEnter a base and an exponent.
- Fraction CalculatorEnter two fractions, mixed numbers, whole numbers or decimals and choose an operation.
- Percentage CalculatorPick the question you are actually asking.
- Factor CalculatorEnter a whole number to list all its factors and factor pairs.
- Greatest Common Factor CalculatorEnter two to six whole numbers.