Skip to main content
Permutation & Combo

Permutation and Combination Calculator

Calculate nPr permutations and nCr combinations for any n and r values.

020

Maximum value: 20

Enter n (total items) and r (items chosen) to calculate

How It Works

Permutations and combinations are the two foundational counting tools of combinatorics, the branch of mathematics that answers "how many ways?". The single distinction between them is whether order matters. A permutation counts ordered arrangements โ€” picking A then B is treated as different from picking B then A. A combination counts unordered selections โ€” the group {A, B} is the same as {B, A}, so it is counted once. This calculator takes a total number of items n and a number chosen r, and returns both the permutation count (nPr) and the combination count (nCr) together, so you can compare them at a glance.

These ideas appear far beyond the maths classroom: probability and statistics, lottery and card-game odds, password and PIN strength, genetics, scheduling, tournament brackets, and any "in how many ways can weโ€ฆ" question. Anyone studying for school or competitive exams, or simply trying to reason about chances, will use these formulas constantly.

The exact formulas

Both are built from the factorial, written n!, which is the product of every whole number from 1 up to n (for example 5! = 5 ร— 4 ร— 3 ร— 2 ร— 1 = 120). By definition 0! = 1.

Permutations: nPr = n! / (n โˆ’ r)! โ€” the number of ways to arrange r items chosen from n distinct items when order matters.

Combinations: nCr = n! / (r! ร— (n โˆ’ r)!) โ€” the number of ways to choose r items from n distinct items when order does not matter.

The two are directly linked by the identity nPr = nCr ร— r!. In words: every unordered combination of r items can itself be arranged in r! different orders, so there are always r! times as many permutations as combinations. This is why nPr is never smaller than nCr.

Worked example

Imagine 5 athletes and 3 medals. If you only ask "which 3 of the 5 reach the podium" (order ignored), that is a combination: 5C3 = 5! / (3! ร— 2!) = 120 / (6 ร— 2) = 120 / 12 = 10 possible podium groups. But if you ask "who wins gold, silver, and bronze" (order matters), that is a permutation: 5P3 = 5! / 2! = 120 / 2 = 60 possible rankings. Notice the link in action: 60 = 10 ร— 3! = 10 ร— 6. Each of the 10 groups can be ordered onto the three medals in 3! = 6 ways.

Tips

The deciding question is always: does rearranging the same items create a genuinely different outcome? If yes (rankings, seating in numbered seats, PIN codes, race finishes), use permutations. If no (committees, lottery picks, a handful of toppings, a team roster), use combinations. A useful symmetry to remember is nCr = nC(n โˆ’ r): choosing which r to include is the same as choosing which n โˆ’ r to leave out, so 10C3 = 10C7.

More everyday scenarios

A few quick cases make the order-matters test concrete. A 4-digit bank PIN where digits may repeat is neither a plain permutation nor combination โ€” it is 10โด = 10,000 because repetition is allowed and order matters. Drawing 6 numbers in a lottery is a pure combination, because the balls are read back in any order: that is nCr with no regard to sequence. Seating 5 guests in 5 numbered chairs is a permutation, 5P5 = 5! = 120. Picking a 3-flavour scoop of ice cream where you only care which flavours (not the stacking order) is a combination. Training yourself to first ask "does rearranging change the answer?" settles almost every problem.

Common mistakes

The biggest error is reaching for permutations when order is irrelevant, which massively overcounts โ€” for r items you overcount by a factor of r!. Watch for the constraints too: r cannot exceed n, and both must be non-negative whole numbers. These formulas also assume the items are distinctand chosen without repetition (each item used at most once); problems that allow repeats need different formulas. Finally, factorials explode quickly, so this calculator is limited to n โ‰ค 20 to keep every result exact and avoid integer overflow (21! already exceeds JavaScript's safe integer range).

Frequently Asked Questions

In permutations, order matters โ€” choosing A then B is different from B then A. In combinations, order does not matter โ€” {A, B} and {B, A} are the same selection. Permutations are always greater than or equal to combinations for the same n and r.

Part of Statistics & Probability Calculators โ€” compare every related calculator in one place.