Permutation and Combination Calculator

Enter the total number of items (n) and how many to choose (r). The calculator shows both permutations (nPr) and combinations (nCr) side by side, with the formula substituted and full step-by-step working. Toggle 'Allow repetition' to switch to the with-replacement formulas.

What are permutations and combinations?

Permutations and combinations come from combinatorics — the branch of math that counts how many ways things can be arranged or chosen. The core distinction is simple:

  • Permutations count arrangements where order matters. Ranking three finishers in a race — gold, silver, bronze — is a permutation because swapping any two changes the outcome.
  • Combinations count selections where order does not matter. Picking three players for a team is a combination — the team is the same regardless of the order you named them in.

A classic naming trap: a “combination lock” is actually a permutation lock. The digits 1‑2‑9 do not open a lock set to 2‑9‑1, so order clearly matters. Real mathematical combinations ignore order.

Permutations and combinations, piece by piece

Four archetypes cover almost every counting problem: ordered vs unordered, each with or without repetition. Each card names the formula the calculator applies and walks through one small example.

Permutations — order matters

Line up r positions from n items. Each pick reduces the pool by one, giving a shrinking chain of choices that the factorial ratio packages up.

nPr = n! / (n − r)!
1110×order matters · choices shrink
Example
Given
n = 11, r = 2 (captain, VC)
Substitute
11 · 10
Answer
110

Combinations — order does not matter

Every unordered group of r items can be arranged in r! different orders, so combinations equal permutations divided by r!.

nCr = n! / (r! · (n − r)!)
nCr = nPr / r!throw away the r! reorderings
Example
Given
n = 8 toppings, r = 3
Substitute
(8·7·6) / (3·2·1)
Answer
56

Permutations with repetition — nʳ

When items can repeat, every slot is an independent choice from all n items. The counts just multiply.

count = nʳ
10101010each slot independent: 10⁴
Example
Given
10 digits, 4-slot PIN
Substitute
10 · 10 · 10 · 10
Answer
10,000

Combinations with repetition — stars and bars

Unordered but items can repeat. Represent choices as r stars split across n bins by (n−1) bars — pick r star positions from (n+r−1).

count = (n + r − 1)Cr
|★★||||(n+r−1)Cr places r stars in n bins
Example
Given
5 flavours, 3 scoops
Substitute
7C3 = 7! / (3!·4!)
Answer
35

Features of this calculator

  • Computes permutations (nPr) and combinations (nCr) in one pass
  • Shows each formula with the actual numbers substituted, not just the final answer
  • Optional 'Allow repetition' toggle switches to n^r and (n+r−1)Cr — a genuine improvement over calculators that only mention these in text
  • Step-by-step working for both permutations and combinations
  • Live diagram of the r slots, matching the mode you chose
  • BigInt arithmetic — exact answers for large n and r without floating-point drift

Frequently asked questions

+What is the difference between a permutation and a combination?

Permutations care about the order of the selection — ABC and CAB count as different. Combinations only care about which items were chosen — {A, B, C} is one group no matter what order you name it in.

+Why is nCr always smaller than or equal to nPr?

Every combination of r items can be arranged in r! different orders. nPr counts each of those orderings separately, while nCr counts them once. So nCr = nPr / r!, which is never larger than nPr.

+What does 0! equal, and why?

0! = 1. Defining it this way keeps the formulas consistent: nP0 = n!/n! = 1 (one way to choose nothing) and nC0 = 1 (one empty selection). It also makes the recursion n! = n × (n−1)! work down to n = 1.

+How large can n and r be here?

The calculator uses BigInt arithmetic, so answers stay exact up to n = 500. With repetition, r is capped at 60 so the n^r expansion remains fast to render.

+Is a combination lock really a combination?

No. Order matters (1‑2‑9 will not open a lock set to 2‑9‑1) and digits can repeat, so a combination lock is actually a permutation with repetition. A true mathematical combination would open regardless of the order you entered the numbers in.

Related calculators