Permutation and Combination Calculator

Compute nPr and nCr exactly, with factorial expansions and step-by-step working.

Choose r from n

Size of the full set

How many you pick

Permutation vs Combination — at a glance

PropertyPermutationCombination
Does order matter?Yes — every arrangement is unique.No — only the set of chosen items matters.
FormulanPr = n! / (n − r)!nCr = n! / (r! · (n − r)!)
RelationshipnPr = nCr × r!nCr = nPr / r!
Identity (r = n)n! arrangements of all items.Exactly 1 (everyone is in).
Identity (r = 0)1 (the empty arrangement).1 (choosing nothing).
Classic exampleFinishing positions in a race.Hands dealt in poker.
Use when…Sequences, rankings, codes, schedules.Teams, samples, sets, lottery picks.

Order matters vs order doesn't matter

Permutation — order matters

With letters A, B, C, all six orderings count separately:

ABCACBBACBCACABCBA

3P3 = 3! = 6 different arrangements.

Combination — order doesn't matter

The same letters collapse to a single unordered group:

{ A, B, C }

3C3 = 1 unique selection — six permutations divided by 3! = 6.

Four worked examples

Top-3 finish from 8 sprinters

8P3 = 8 × 7 × 6 = 336

Gold, silver, and bronze are different positions, so order matters. Use a permutation.

Choose 5 players from 11

11C5 = 11! / (5! · 6!) = 462

The captain just needs a starting five — no positions yet. Order does not matter, so it's a combination.

4-digit PIN from 10 digits, no repeats

10P4 = 10 × 9 × 8 × 7 = 5,040

1234 and 4321 are different PINs. Every ordering counts, so it's a permutation.

Lottery — pick 6 from 49

49C6 = 13,983,816

The lottery machine doesn't care which ball is drawn first. Order is irrelevant, so this is a combination.

Core formulas you should know

Permutation

nPr = n! / (n − r)!

6P2 = 6! / 4! = 30

Combination

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

6C2 = 6! / (2! · 4!) = 15

Bridge between them

nPr = nCr × r!

30 = 15 × 2!

Symmetry of nCr

nCr = nC(n−r)

10C3 = 10C7 = 120

Boundary identities

nP0 = nC0 = 1, nPn = n!, nCn = 1

5P0 = 1, 5P5 = 120, 5C5 = 1

Pascal's rule

nCr = (n−1)C(r−1) + (n−1)Cr

5C2 = 4C1 + 4C2 = 4 + 6 = 10

Sum of all subsets

Σ nCr = 2ⁿ for r = 0…n

5C0+5C1+5C2+5C3+5C4+5C5 = 32 = 2⁵

With repetition (perm)

n^r (repetition allowed)

Three-letter codes from 26 letters = 26³

What is a permutation and combination calculator?

A permutation and combination calculator answers two related counting questions at once. Given a set of n items and a sub-set size r, the permutation result nPr is the number of ordered arrangements of r items chosen from n, and the combination result nCr is the number of unordered selections. Both values fall out of factorials and are linked by the identity nPr = nCr × r!.

This calculator uses arbitrary-precision arithmetic so values like 52C5, 100P10, or 49C6 are computed exactly — not as floating-point approximations. It returns both answers, the factorial expansions, and a step-by-step worked solution that mirrors how you'd solve the same problem on paper. Pair it with the probability calculator and the exponent calculator when you move on to probability spaces and counting with repetition.

How permutations and combinations work

Permutations count ordered arrangements

Filling r distinct positions from n candidates gives n choices for the first slot, n − 1 for the second, and so on down to n − r + 1. The product is the falling factorial — also written n! / (n − r)!. Permutations always grow at least as fast as factorials, which is why nPr explodes quickly with n.

Combinations count unordered selections

When the order of the chosen r items does not matter, every group has been over-counted by r! (the number of ways to arrange those r items). Dividing the permutation count by r! removes the duplication, giving the combination formula nCr = n! / (r!·(n − r)!).

Factorials are the building block

n! = n × (n − 1) × … × 1. It counts the number of orderings of n distinct items. 0! is defined to be 1 — the empty sequence is itself an ordering. The calculator expands every factorial in the answer so the substitution into the formula is visible.

One formula, two interpretations

Because nPr = nCr × r!, every combination problem secretly knows the answer to the matching permutation problem and vice versa. Multiplying or dividing by r! moves between the two answers — handy when an exam asks for one but you derived the other.

6 ways to use this calculator

1

Probability denominators

Most discrete-probability questions reduce to dividing one nCr by another. Use the calculator to evaluate both numerator and denominator exactly, then plug them into the probability calculator for the final ratio.

2

Combinatorics homework

From the binomial theorem to the inclusion–exclusion principle, factorial fractions reappear constantly. The factorial breakdown panel shows the expansion line-by-line so you can copy the canonical form into your working.

3

Lottery and gambling odds

Compute 49C6, 39C5, and other lottery counts to see why every jackpot is rare. The exact arbitrary-precision integer keeps you from rounding to 13.9 million when the answer is 13,983,816.

4

Password strength sanity check

Permutations with no repetition (nPr) underestimate password counts because real passwords allow repeats; permutations with repetition (n^r) overestimate. Use both as bounds to argue about brute-force costs.

5

Tournament bracket sizes

Single-round-robin schedules, knockout pairings, and Swiss draws all reduce to counting pairs (nC2) or arrangements (nPr). The calculator lets you sanity-check seedings before tournament day.

6

Sampling without replacement

Surveys, opinion polls, and quality-control sampling all draw an unordered group from a finite population. nCr gives the total number of possible samples; the probability calculator handles the rest.

Best practices for counting problems

Begin every problem by asking one question: does the order of the chosen items carry meaning? If swapping two items changes the answer (e.g. gold and silver medals, password digits, schedule slots), you need a permutation. If swapping changes nothing (e.g. a poker hand, a committee, a lottery draw), use a combination. Most textbook mistakes come from skipping this step.

When r is large compared to n, prefer the symmetry identity nCr = nC(n − r). It keeps the numbers manageable: writing 100C97 as 100C3 turns a 97-term factorial into a three-term product. The same trick is used inside the calculator to avoid building huge intermediate factorials when r ≪ n already.

For probability problems, build both the favourable count and the sample-space count using the same kind of object — both ordered or both unordered. Mixing them is the classic source of off-by-r! errors on exam questions.

Why permutations and combinations matter

Games, sports, and lotteries

Every gambling odd, tournament bracket, or fixture list rests on combinatorial counts. A standard 49-ball lottery has C(49, 6) = 13,983,816 possible draws — the inverse of which is the jackpot probability when each ticket picks a different sextuple.

Computer science and search

Binary-search analysis uses 2^n. Sorting bounds use n!. Hashing collision rates use C(n, 2). Cryptographic key spaces are essentially n^r. Discrete-mathematics combinatorics is the language algorithm designers reach for when reasoning about scale.

Statistics and experimentation

Choosing samples without replacement is governed by hypergeometric counts — all built on nCr. Multinomial coefficients (a permutation-with-repeats generalisation) describe contingency tables and ANOVA group assignments.

Security and access control

Password length policies, multi-factor token spaces, and seed-phrase wallets all argue in terms of permutations with repetition (n^r). The calculator's permutation result is the without-repetition lower bound — the safer thing to quote in a threat model.

Where counting problems get tricky

Repetition allowed

If items can be chosen more than once, the formulas change. Permutations with repetition give n^r; combinations with repetition give (n + r − 1)C r. The calculator assumes no repetition by default — match the problem wording before plugging in.

Identical items in the set

When the n items aren't all distinct (e.g. arrangements of the letters in MISSISSIPPI), divide by the factorial of each repeat-count. The standard nPr formula assumes the n items are all different.

r > n is impossible without repetition

You can't choose more items than the set contains. The calculator rejects r > n; if your problem really does allow more picks than items, it's a with-repetition problem and you need n^r or (n + r − 1)C r instead.

Probability vs counting

nCr counts outcomes; it isn't a probability. To get a probability, divide the favourable count by the size of the sample space — and make sure both counts are built from the same kind of object (ordered or unordered).

Core formulas

Factorial

n! = n · (n − 1) · … · 1

Number of ways to order n distinct items. 0! = 1.

Permutation

nPr = n! / (n − r)!

Ordered arrangements of r items from n.

Combination

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

Unordered selections of r items from n.

Bridge identity

nPr = nCr · r!

Each combination has r! orderings, which is exactly the over-count.

Symmetry of nCr

nCr = nC(n − r)

Choosing the r you keep is the same as choosing the n − r you leave behind.

Pascal's identity

nCr = (n−1)C(r−1) + (n−1)Cr

Each row of Pascal's triangle is built from the row above.

Sum of all subsets

Σ nCr = 2ⁿ for r = 0…n

A set of n elements has 2^n subsets in total.

Permutations with repeats

n^r

Each of r slots independently picks one of n items.

Combinations with repeats

(n + r − 1)C r

Multisets — items can appear more than once in the chosen group.

Binomial theorem

(x + y)^n = Σ nCk · x^(n−k) · y^k

The combinatorial coefficients are precisely the binomial coefficients.

Boundary values

nP0 = nC0 = 1, nPn = n!, nCn = 1

Useful sanity checks when r is at either extreme.

Multinomial coefficient

n! / (k₁! · k₂! · … · kₘ!)

Number of arrangements of n items split into m groups of sizes k₁…kₘ.

Common mistakes

  1. 1

    Using nPr when the problem asks for nCr

    If two students get an A and the question is "how many ways can the teacher pick those two", the order is irrelevant — use a combination. nPr is r! times too big. Always ask "does swapping two picks change the answer?" before applying a formula.

  2. 2

    Forgetting that 0! = 1

    When r = n, the formula contains 0! in the denominator. 0! is defined to equal 1 — not 0 — so the answers nPn = n! and nCn = 1 fall out correctly. Treating 0! as 0 produces a divide-by-zero error.

  3. 3

    Mixing repetition rules

    Pure nPr and nCr assume the n items are all different and each can be picked at most once. If the problem allows repeats (digits of a PIN, characters of a password, balls drawn with replacement), use n^r or (n + r − 1)C r instead.

  4. 4

    Using floating-point factorials

    Computing 30! in standard JavaScript loses precision because the result exceeds 2^53. The calculator works in BigInt throughout, so 100! and 200C100 come out as exact integers — no rounding artefacts.

  5. 5

    Counting outcomes vs probabilities

    nCr is an integer count, not a probability between 0 and 1. To get a probability, divide by the size of the sample space — typically another permutation or combination of the same shape.

  6. 6

    Letting r exceed n by accident

    If the problem genuinely allows more picks than items, the right formula is with-repetition (n^r or multiset C). The calculator flags r > n as an input error so you re-read the problem before continuing.

Real-life applications

Sports tournaments

A round-robin between n teams plays nC2 matches. A single-elimination bracket of 2^k teams requires k rounds. Top-3 podium finishes from 8 athletes give 8P3 = 336 possible podiums — the back-of-an-envelope way to size a championship draw.

Password security

A six-character password using a 95-character alphabet with repeats allowed has 95^6 ≈ 7.4 · 10^11 possibilities; without repeats only 95P6 ≈ 7.0 · 10^11. Security policies typically argue with the larger n^r number because real users reuse characters.

Committee selection

Picking a five-person committee from 20 staff has 20C5 = 15,504 possibilities. If the roles inside the committee matter (chair, secretary, treasurer), the count climbs to 20P5 = 1,860,480 — a 120× difference that explains why role-assigned committees are quoted with permutations.

Quality control sampling

Inspecting r items out of a batch of n without replacement yields C(n, r) possible samples. The hypergeometric distribution uses this to model defect rates — letting auditors choose a sample size that bounds risk to a target acceptance probability.

Methodology you can verify

Every result is computed in arbitrary-precision BigInt arithmetic, so factorials, permutations, and combinations are returned exactly — not as floating-point approximations. The permutation is built as the falling factorial n · (n − 1) · … · (n − r + 1), and the combination is obtained by dividing the permutation by r! The factorial expansions in the result card are the same lines you would write out by hand. Read more on the methodology and editorial policy pages.

Frequently Asked Questions

A permutation is an ordered arrangement of items chosen from a set. The number of permutations of r items taken from a set of n distinct items is nPr = n! / (n − r)!. Order is what makes a permutation distinct from a combination: ABC, ACB, BAC, BCA, CAB, and CBA are six different permutations of the same three letters.

A combination is an unordered selection of items chosen from a set. The number of combinations of r items taken from a set of n distinct items is nCr = n! / (r! · (n − r)!). Order does not matter, so {A, B, C} is a single combination — the six permutations above all collapse to one combination because dividing by 3! = 6 removes the ordering redundancy.

The factorial of a non-negative integer n, written n!, is the product n · (n − 1) · (n − 2) · … · 1. It counts the number of ways to arrange n distinct items in order. By convention 0! = 1, which keeps the formulas nP0 = nC0 = 1 and the binomial theorem consistent. The calculator computes factorials in BigInt arithmetic so values like 100! ≈ 9.33 × 10¹⁵⁷ are returned exactly.

Use permutations whenever the order of the chosen items carries meaning — finishing positions in a race, characters in a password, schedule slots, license-plate sequences, presidential succession. If swapping two of your picks changes the answer, it is a permutation problem and the count is nPr.

Use combinations whenever the order of the chosen items is irrelevant — lottery picks, hands in a card game, members of a committee, samples for an inspection. If you can rearrange your picks and the situation is the same, it is a combination problem and the count is nCr.

Because nPr counts every distinct ordering separately, while nCr collapses all r! orderings of the same group into a single outcome. Algebraically nPr = nCr · r!, so the permutation count is exactly r! times the combination count. For r = 5 that factor is 120; for r = 10 it is 3,628,800 — which is why permutation counts grow much faster.

Not with the standard formulas. nPr and nCr assume the n items are all distinct and that each can be picked at most once, so r > n is impossible. If your problem genuinely allows more picks than items (repetition allowed), use n^r for ordered repetition or (n + r − 1)C r for unordered repetition instead.

n is the size of the set you are picking from — the total pool of distinct items. r is the size of the sub-set you are picking — how many items you actually take. nPr counts ordered sub-sets of size r from n items; nCr counts unordered sub-sets. r must be a non-negative integer with 0 ≤ r ≤ n.

It depends on whether the positions inside the chosen group are themselves distinguishable. In a race, the first three runners stand on different podium steps — order matters, so it is a permutation. In a poker hand, the five cards are dealt into the same indistinguishable hand — order does not matter, so it is a combination. Looking at whether the slots have names (chair, secretary, treasurer) or are interchangeable is the fastest way to decide.

Yes. Most lotteries draw r numbered balls from a pool of n without replacement, with no regard for the order they emerge — so the number of possible draws is nCr. A standard 6-from-49 lottery has 49C6 = 13,983,816 distinct draws, so a single ticket has a 1-in-13,983,816 chance of matching all six. The calculator computes the count exactly with BigInt.

Yes, by convention. There is exactly one way to arrange zero items — the empty arrangement — and the formulas would break without that convention. With 0! = 1, the formulas nP0 = nC0 = 1, nPn = n!, and nCn = 1 all fall out correctly, and the binomial theorem (x + y)^n = Σ nCk · x^(n−k) · y^k stays consistent at every boundary.

Choosing the r items you want to take from a set of n is the same as choosing the n − r items you want to leave behind — both result in the same partition of the set, so they have the same count. The identity nCr = nC(n − r) is enormously useful in practice: rewriting 100C97 as 100C3 turns a 97-term factorial expansion into a three-term product, with the same exact integer answer.