🔢 Permutations & Combinations Calculator

Last updated: February 10, 2026

Permutations & Combinations Calculator

Calculate nPr (order matters) and nCr (order doesn't matter) with full factorial steps.

PERMUTATION

Order matters — AB and BA are counted as different arrangements.

COMBINATION

Order doesn't matter — AB and BA count as the same group.

How to Calculate Permutations and Combinations (And Know Which One You Actually Need)

There is a question that trips up students, statisticians, and curious minds alike: when you are picking items from a group, does the order of picking matter? That single question separates permutations from combinations, and getting it wrong means your answer could be off by a factor of hundreds or even thousands.

This guide walks you through the logic behind both formulas, shows you how to expand them step by step, and gives you the mental toolkit to instantly recognize which calculation a problem is asking for.

The Fundamental Difference: Order vs. Selection

Imagine you have five runners — Alice, Bob, Carol, Dave, and Eve — competing in a race. You want to know how many ways the top three finishing positions (gold, silver, bronze) can be awarded.

Here, order absolutely matters. Alice winning gold and Bob winning silver is completely different from Bob winning gold and Alice winning silver, even though the same two people are involved. When order matters, you are counting permutations.

Now change the scenario: you are picking three of those five runners to form a relay team. There is no "first pick" or "second pick" — you just need three people on the team. Alice-Bob-Carol and Carol-Bob-Alice are the same team. Here, order does not matter. You are counting combinations.

That shift in thinking — from arrangement to selection — is the entire foundation of combinatorics.

The Permutation Formula: nPr

When you need to count ordered arrangements of r items chosen from a pool of n distinct items, you use the permutation formula:

nPr = n! / (n − r)!

The exclamation mark is the factorial symbol. The factorial of a number is the product of every positive integer from 1 up to that number. So 5! = 5 × 4 × 3 × 2 × 1 = 120.

Let us work through the race example. With n = 5 runners and r = 3 podium spots:

5P3 = 5! / (5 − 3)! = 5! / 2! = (5 × 4 × 3 × 2 × 1) / (2 × 1) = 120 / 2 = 60

Notice the shortcut: the (n−r)! in the denominator cancels out the lower part of n!, leaving only the top r terms. So 5P3 is simply 5 × 4 × 3 = 60. You are counting how many choices you have for the first spot (5), then the second (4, since one runner is already placed), then the third (3).

The Combination Formula: nCr

For unordered selections, you divide the permutation result by r! — the number of ways those r chosen items could be internally rearranged (since those rearrangements are all the same combination).

nCr = n! / (r! × (n − r)!)

Using the relay team example (same n = 5, r = 3):

5C3 = 5! / (3! × 2!) = 120 / (6 × 2) = 120 / 12 = 10

The ratio tells the story: 5P3 = 60 and 5C3 = 10, and 60 / 10 = 6 = 3! That makes perfect sense — each group of 3 people can be arranged in 3! = 6 different orders, so the permutation count is exactly 6 times the combination count.

Walking Through the Factorial Expansion

The factorial expansion is not just busywork — it shows you exactly where the numbers come from, which matters enormously when you are checking your work or explaining a solution.

Take 10C4 (choosing 4 items from 10, where order does not matter):

10C4 = 10! / (4! × 6!)

Instead of computing massive factorials, cancel the 6! against the top of 10!:

= (10 × 9 × 8 × 7 × 6!) / (4! × 6!) = (10 × 9 × 8 × 7) / (4 × 3 × 2 × 1) = 5040 / 24 = 210

This cancellation trick makes even large calculations manageable by hand. You only multiply the top r terms of n! and divide by r!.

Edge Cases Worth Knowing

A few values behave in ways that surprise people:

Choosing zero items: Both nP0 and nC0 equal 1. There is exactly one way to choose nothing — the empty selection. This feels strange but is mathematically consistent, because 0! is defined as 1.

Choosing all items: nCn = 1 as well. There is only one way to select every item from a pool — take them all. nPn = n!, because you are counting every possible arrangement of all n items.

r greater than n: This is impossible. You cannot choose 7 people from a group of 5. Both nPr and nCr equal 0 when r > n.

Real-World Problems and Which Formula to Use

The fastest way to decide between permutation and combination is to ask: if I swap two of my chosen items, do I get a different valid outcome? If yes, use permutations. If no, use combinations.

Use nPr when:

  • Assigning ranked positions (1st, 2nd, 3rd place)
  • Creating passwords or PIN codes (0-1-2-3 and 3-2-1-0 are different PINs)
  • Scheduling tasks in a specific sequence
  • Arranging books on a shelf where position matters
  • Seating people in numbered chairs

Use nCr when:

  • Selecting a lottery ticket (the numbers {3, 7, 14, 22} are the same regardless of draw order)
  • Picking a committee or team from a larger group
  • Choosing toppings for a pizza
  • Dealing cards (a poker hand is the same regardless of deal order)
  • Sampling items for quality control

The Relationship Between nPr and nCr

There is a clean algebraic relationship worth memorizing:

nPr = nCr × r!

Every combination becomes a family of r! permutations when you consider all possible orderings of the chosen items. This relationship is a useful sanity check: multiply your combination answer by r! and you should get your permutation answer exactly.

For example: 10C4 = 210, and 10P4 = 210 × 4! = 210 × 24 = 5040. Verify: 10P4 = 10 × 9 × 8 × 7 = 5040. It checks out.

How to Use the Calculator Effectively

Enter your total pool size as n and the number of items you are selecting as r. The calculator uses JavaScript's BigInt to handle arbitrarily large factorials with exact integer precision — no rounding errors. Results include the full factorial expansion so you can follow every multiplication step.

For very large inputs (n approaching 170), the numbers become astronomically large — 52C5 for a five-card poker hand is already 2,598,960, and values grow rapidly from there. The calculator handles these cleanly up to n = 170, which covers virtually every real-world combinatorics problem you will encounter in statistics, probability, and data analysis.

The plain-language context section at the bottom of each result explains the practical meaning of both numbers together, including why nPr is always a multiple of nCr by exactly r! — making it easier to double-check your intuition before using the answer in further calculations.

FAQ

What is the difference between a permutation and a combination?
A permutation counts arrangements where order matters — selecting A then B is different from selecting B then A. A combination counts selections where only the group matters, not the sequence. The classic test: if swapping two chosen items gives a distinct valid outcome, it is a permutation; if it gives the same result, it is a combination.
Why is nPr always larger than or equal to nCr?
Because nPr = nCr × r!. Every combination of r items can be internally rearranged in r! different sequences, each counting as a separate permutation. Since r! is always at least 1, nPr is always at least as large as nCr, and strictly larger whenever r > 1.
What does 0! equal, and why does nC0 = 1?
By mathematical definition (and necessity for consistent formulas), 0! = 1. As a result, nC0 = n! / (0! × n!) = n! / (1 × n!) = 1. This makes intuitive sense too: there is exactly one way to choose zero items from any set — the empty selection.
How do I calculate combinations for large numbers like 52C5 (poker hands)?
Use the cancellation shortcut: write out only the top r terms of n! divided by r!. For 52C5: (52 × 51 × 50 × 49 × 48) / (5 × 4 × 3 × 2 × 1) = 311,875,200 / 120 = 2,598,960. This avoids computing the full 52! and is how this calculator works internally.
Can r be greater than n in permutation or combination problems?
No. You cannot choose more items than exist in your pool. If r > n, both nPr and nCr are defined as 0 — there are zero ways to perform an impossible selection. The calculator will flag this as an error and explain why.
When would I use combinations in real life outside of math class?
Combinations appear constantly in practical scenarios: calculating how many possible lottery tickets exist, determining the number of unique 5-card poker hands, figuring out how many ways to form a project team of 4 from 10 employees, or counting how many different pizza orders are possible when choosing 3 toppings from 12 available options.