Combination & Permutation Calculator

Calculate nCr and nPr with full step-by-step factorial working — free and instant, no paywall.

Step-by-Step Working nCr & nPr Factorial Breakdown Instant Results
Share this tool

The total number of items in the pool

How many items are selected or ordered

What to Calculate

Expression

Quick Load:

Calculating...

Enter n and r above to calculate combinations (nCr), permutations (nPr), or both — with full step-by-step factorial working.

Does Order Matter?

The single question that decides which formula to use.

Combination — nCr

C(3,2) = 3

Order does NOT matter

Choose 2 from {A, B, C}

{A,B} {A,C} {B,C}

{A,B} = {B,A} — same group → 3 outcomes

Permutation — nPr

P(3,2) = 6

Order DOES matter

Arrange 2 from {A, B, C}

AB BA AC CA BC CB

AB ≠ BA — different orderings → 6 outcomes

Combination Formula

C(n, r) = n! r! × (n−r)!

Permutation Formula

P(n, r) = n! (n−r)!

What Are Combinations and Permutations?

Combinatorics is the branch of mathematics concerned with counting, arranging, and selecting objects. Two of its most fundamental tools are combinations and permutations. A combination counts the number of ways to choose a group of items from a larger set when the order of selection does not matter. A permutation counts the number of ways to arrange items when order does matter.

Consider five coloured balls: red, blue, green, yellow, and orange. If you reach in and grab two balls from a bag, the pair {red, blue} is the same as {blue, red} — that is a combination. But if you are picking first place and second place in a race, red-then-blue is a different result from blue-then-red — that is a permutation. The only difference between the two scenarios is whether the sequence matters.

Both formulas are derived from the same building block: the factorial function. The factorial of a positive integer n, written n!, is the product of every whole number from 1 up to n. The definitions 0! = 1 and 1! = 1 are conventions that make the formulas work correctly at the boundary cases where r = 0 or r = n.

The nCr Formula — How to Calculate Combinations

The formula for combinations is:

C(n, r) = n! / (r! × (n−r)!)

Where n is the total number of items in the pool and r is how many you are choosing. The denominator contains two factorials: r! accounts for all the orderings of the chosen group that should be treated as identical, and (n−r)! removes the unchosen items. Dividing by both collapses all duplicate orderings into a single outcome, which is exactly what a combination requires.

As an example: C(5,2) = 5! / (2! × 3!) = 120 / (2 × 6) = 120 / 12 = 10. There are 10 ways to pick 2 items from 5 when the order you pick them in does not change which group you end up with.

The nPr Formula — How to Calculate Permutations

The formula for permutations is:

P(n, r) = n! / (n−r)!

This is the same as the combination formula but without dividing by r!. That missing r! is the critical difference: permutations keep every distinct ordering as a separate outcome, while combinations collapse all orderings of the same group into one.

As an example: P(5,2) = 5! / (5−2)! = 120 / 6 = 20. There are 20 ordered pairs you can form by picking 2 items from 5. Notice that P(5,2) = 20 = 2 × C(5,2) = 2 × 10. The relationship P(n,r) = C(n,r) × r! always holds — permutations are combinations multiplied by the number of orderings of the chosen group.

Combinations vs Permutations — When Does Order Matter?

The fastest way to decide which formula to use is to ask: does the order of selection change the outcome?

Use Combinations (nCr) when:

  • • Picking lottery numbers
  • • Choosing team members
  • • Selecting a committee
  • • Drawing cards from a deck

Use Permutations (nPr) when:

  • • Creating a password or PIN
  • • Ranking contestants in order
  • • Assigning distinct job titles
  • • Arranging items in a sequence

A popular memory trick: a "combination lock" is actually a permutation lock. The code 1-2-3 and the code 3-2-1 open different safes, so order is very much required. The name is a historical misnomer that has stuck for centuries.

Step-by-Step Example: C(10,3) and P(10,3)

Let us work through both for n = 10 and r = 3.

C(10,3) — How many ways to choose 3 from 10?

Step 1 — 10! = 10 × 9 × 8 × 7 × 6 × 5 × 4 × 3 × 2 × 1 = 3,628,800

Step 2 — 3! = 3 × 2 × 1 = 6

Step 3 — (10−3)! = 7! = 7 × 6 × 5 × 4 × 3 × 2 × 1 = 5,040

Step 4 — C(10,3) = 3,628,800 / (6 × 5,040) = 3,628,800 / 30,240 = 120

There are 120 ways to choose 3 items from 10 when order does not matter.

P(10,3) — How many ways to arrange 3 from 10?

Step 1 — 10! = 3,628,800

Step 2 — (10−3)! = 7! = 5,040

Step 3 — P(10,3) = 3,628,800 / 5,040 = 720

There are 720 ways to arrange 3 items from 10 when order matters. Notice: 720 = 6 × 120, and 6 = 3! — permutations always equal C(n,r) × r!.

Real-World Uses of Combinations and Permutations

Combinations and permutations appear constantly in probability, statistics, game theory, and everyday life.

Lottery Odds

A 6/49 lottery requires choosing 6 numbers from 49. Since order does not matter, there are C(49,6) = 13,983,816 possible tickets — roughly 1 in 14 million odds of the jackpot.

Poker Hands

A 5-card hand drawn from a standard 52-card deck gives C(52,5) = 2,598,960 possible hands. Every probability result in poker is built on this number.

Phone PINs

A 4-digit PIN from digits 0–9 with no repeats (order matters) gives P(10,4) = 5,040 possibilities — far fewer than most people assume.

Seating Plans

Arranging 5 people across 5 chairs gives P(5,5) = 5! = 120 arrangements. Assigning only 3 of those 5 to specific chairs gives P(5,3) = 60.

Common Mistakes in Combinatorics

Mixing up nCr and nPr is the most frequent error. If you need ordered arrangements and accidentally use C(n,r), your answer will be too small by a factor of r!. Always ask "does the order of selection change the outcome?" before choosing a formula.

Forgetting that 0! = 1 leads to errors when r = 0 or r = n. When r = n, the denominator contains (n−r)! = 0! = 1, which is correct and finite — not zero. Plugging 0 into the denominator would cause a division-by-zero error.

Computing n! in full before dividing creates problems for large n. The factorial of 40 has 47 digits, making it impractical to compute by hand. The better approach is the multiplicative formula C(n,r) = (n × (n−1) × … × (n−r+1)) / r!, which works with much smaller intermediate values. This calculator uses exact big-integer arithmetic so results are always precise.

Combination & Permutation Calculator FAQ

What is the difference between a combination and a permutation?

A combination counts the number of ways to choose items when order does not matter — C(n,r) = n! / (r! × (n−r)!). A permutation counts the number of ways to arrange items when order does matter — P(n,r) = n! / (n−r)!. For example, {A,B} and {B,A} are the same combination but different permutations.

How do I calculate nCr step by step?

First compute n!, then r!, then (n−r)!. Finally apply the formula: C(n,r) = n! / (r! × (n−r)!). For C(5,2): 5! = 120, 2! = 2, 3! = 6, so C(5,2) = 120 / (2 × 6) = 10. This calculator shows every step automatically.

How do I calculate nPr step by step?

Compute n! and (n−r)!, then apply P(n,r) = n! / (n−r)!. For P(5,2): 5! = 120, 3! = 6, so P(5,2) = 120 / 6 = 20. You can also compute it as the falling factorial: n × (n−1) × … × (n−r+1) = 5 × 4 = 20.

Why does 0! equal 1?

By convention, 0! is defined as 1 so that the combination and permutation formulas remain valid when r = 0 or r = n. It also follows naturally from the recurrence relation n! = n × (n−1)!: setting n=1 gives 1! = 1 × 0!, so 0! must equal 1.

What do n and r stand for in nCr and nPr?

n is the total number of items available in the pool — sometimes called the 'population'. r is the number of items you are selecting or arranging — sometimes called 'choices' or 'picks'. The constraint r ≤ n must always hold; you cannot choose more items than exist in the pool.

Can r be greater than n in combinations?

No. If r > n, the formula produces (n−r)! with a negative argument, which is undefined. Mathematically, you cannot choose more items than are available. The result is considered zero by convention in some contexts, but this calculator returns a validation error to prevent confusion.

How many 5-card poker hands are possible?

C(52,5) = 2,598,960. A standard deck has 52 cards and you draw 5; since the order of the cards in your hand does not matter, this is a combination. Of these hands, 4 are royal flushes, 36 are straight flushes, 624 are four-of-a-kind, and so on.