Skip to content
Calculator.hair

Permutation and Combination Calculator

Permutations, nPr
30
nPr working
6P2 = 6! ÷ (6 − 2)!
Combinations, nCr
15
nCr working
6C2 = 6! ÷ (2! × (6 − 2)!)
Permutations with repetition, nʳ
36
Combinations with repetition
21

Enter the size of a set and how many items to choose, and this permutation and combination calculator gives the number of ordered arrangements (nPr) and unordered selections (nCr), with the factorial working.

Permutations and combinations both count the ways to pick r items from a set of n distinct items. The difference is whether order matters. A permutation is an arrangement, so choosing Ann then Ben is different from choosing Ben then Ann. A combination is just a group, so those two choices are the same. For the default n = 6 and r = 2, there are 30 permutations but only 15 combinations, because each pair of items can be ordered in two ways.

Both counts are built from the factorial, written n! and defined as the product of all whole numbers from 1 to n. So 5! = 5 × 4 × 3 × 2 × 1 = 120. By convention 0! = 1, which keeps the formulas consistent when r = 0 or r = n. Factorials grow astonishingly fast: 10! is 3,628,800 and 20! already exceeds 2.4 quintillion, so the calculator uses exact big-integer arithmetic.

Two variations appear in the results. If an item can be used more than once, as with the digits of a PIN, the number of ordered sequences is simply nʳ. If repeats are allowed and order does not matter, as when choosing 3 scoops from 6 ice-cream flavors, the count is the combination C(n + r − 1, r).

Permutations

To count permutations, fill r positions one at a time. The first position can take any of the n items, the second any of the remaining n − 1, and so on, down to n − r + 1 choices for the last position. Multiplying these gives n × (n − 1) × … × (n − r + 1), which is the same as n! ÷ (n − r)!. The notation varies: nPr, P(n, r), ₙPᵣ and Pⁿᵣ all mean the same thing.

Example: a club of 10 members elects a president, a vice president and a treasurer, and no one may hold two offices. The number of possible slates is 10 × 9 × 8 = 720, or 10! ÷ 7!. Order matters here because being president is different from being treasurer.

When r = n, every item is used and the count is n!, the number of ways to arrange the whole set in a line. Six books can be lined up on a shelf in 6! = 720 ways, and a standard deck of 52 cards can be shuffled into 52! ≈ 8.07 × 10⁶⁷ orders, a number so large that a well-shuffled deck has almost certainly never been in that exact order before.

If some items are identical, swapping them does not create a new arrangement, so divide by the factorial of each group's size. The letters of BANANA can be arranged in 6! ÷ (3! × 2!) = 60 distinct ways, since there are three A's and two N's.

When repetition is allowed, each of the r positions has all n choices, giving nʳ arrangements. A four-digit PIN using digits 0 to 9 has 10⁴ = 10,000 possibilities, and an eight-character password drawn from 62 letters and digits has 62⁸, about 218 trillion.

nrnPrnCr
522010
623015
6312020
103720120
525311,875,2002,598,960

Combinations

A combination counts selections where order is irrelevant. Every group of r items can be arranged in r! orders, and all of those arrangements are included in nPr, so dividing by r! removes the duplicates: nCr = n! ÷ (r! × (n − r)!). It is also written C(n, r) or as the binomial coefficient (n choose r).

Example: a pizza shop offers 8 toppings and you may choose 3. The order in which toppings go on does not matter, so the number of different pizzas is 8! ÷ (3! × 5!) = 56. A five-card poker hand drawn from 52 cards can be any of 52C5 = 2,598,960 hands.

Combinations are symmetric: choosing r items to keep is the same as choosing n − r items to leave out, so nCr = nC(n − r). There is exactly one way to choose nothing and one way to choose everything. The values also form Pascal's triangle, where each number is the sum of the two above it, reflecting the identity nCr = (n − 1)C(r − 1) + (n − 1)Cr.

Lotteries are a classic use. In a game where you pick 6 numbers from 49, the number of possible tickets is 49C6 = 13,983,816, so a single ticket has about a 1 in 14 million chance of matching all six. Combinations also give the coefficients of the binomial expansion of (a + b)ⁿ and the probabilities of the binomial distribution.

Frequently asked questions

What is the difference between a permutation and a combination?

Permutations count ordered arrangements; combinations count unordered groups. Choosing 2 of 6 items gives 30 permutations but 15 combinations.

What is the formula for nPr?

nPr = n! ÷ (n − r)!. For 6P2 that is 720 ÷ 24 = 30.

What is the formula for nCr?

nCr = n! ÷ (r! × (n − r)!). For 6C2 that is 720 ÷ (2 × 24) = 15.

Why is 0! equal to 1?

There is exactly one way to arrange nothing, and defining 0! = 1 keeps formulas such as nCn = 1 and nC0 = 1 correct.

How many combinations does a 6/49 lottery have?

49C6 = 13,983,816 possible tickets.

Updated by Calculator.hair. How we build and check our calculators