Permutation & Combination Calculator

Enter the size of a set and how many items you are picking to get nPr, nCr and both repetition variants at once, with exact answers even when the results run to hundreds of digits.

What you get
  • All four counting modesnPr, nCr, and both with repetition allowed.
  • Exact big numbersFactorials computed digit for digit, never rounded.
  • Worked formulasEvery result shown with its numbers substituted in.

Your set and your pick

Results update as you type

Both must be whole numbers, n at least 1 and r between 0 and n. For example, n = 10 runners and r = 3 medal places.

Runs entirely in your browser. Nothing you type is sent or saved

Counting guide

Counting without counting

Permutations and combinations belong to combinatorics, the branch of mathematics that counts possibilities without listing them. How many ways can a race finish? How many hands can a card game deal? How many passwords of a given length exist? Answering by writing every case down is hopeless even for small sets, because the counts explode astonishingly fast. The formulas on this page replace the listing with a few multiplications, and this permutation and combination calculator carries them out for you.

The two central ideas differ in exactly one respect. A permutation counts ordered arrangements: swapping two items produces a different outcome. A combination counts selections: only which items end up chosen matters, never the sequence.

Does order matter? The one question that decides

Almost every counting mistake is really a failure to answer this question first, so it is worth rehearsing with two everyday cases.

  • The podium test: from 10 runners, how many ways can gold, silver and bronze be awarded? Finishing A then B then C is not the same as C then B then A, because the medals differ. Order matters, so this is a permutation: P(10, 3) = 720.
  • The handshake test: from the same 10 people, how many pairs can shake hands? A with B is the same handshake as B with A. Order does not matter, so this is a combination: C(10, 2) = 45.

Notice that P(10, 3) = 720 is exactly 6 times C(10, 3) = 120, and 6 = 3! is the number of ways three chosen items can be ordered. That relationship is no accident: every combination is a bundle of r! permutations that differ only in arrangement, and the combination formula simply divides the permutation count by that redundancy. A combination can therefore never exceed the matching permutation count, and the two are equal only when r is 0 or 1.

Quick phrasings that signal order matters: arrange, schedule, rank, assign to numbered positions, first and second and third. Phrasings that signal it does not: choose, select, group, committee, hand of cards, set of ingredients. A "combination lock" is misnamed: 1-2-9 and 9-2-1 open differently, so it is really a permutation lock.

Factorials and how fast they grow

Both formulas are built from the factorial, written n!, which is the product of every whole number from 1 to n. It answers a question in its own right: how many ways can n items be arranged in a row? Ten books can be shelved in 10! = 10 × 9 × 8 × 7 × 6 × 5 × 4 × 3 × 2 × 1 = 3,628,800 different orders.

The growth rate is brutal. Each step multiplies by a larger number still: 10! is about 3.6 million, 20! is about 2.4 × 1018, and 52! already has 68 digits, more than the number of atoms in a grain of sand times itself a billionfold. This is why the calculator computes with exact integer arithmetic rather than floating point: rounded off in an ordinary spreadsheet, 20! or larger silently loses low digits, and a probability computed from it can be visibly wrong.

Two conventions complete the picture: 0! = 1 by definition, and choosing all n items at once has exactly one combination (though the items can still be arranged in n! orders). Both fall out of the formulas naturally, which is why C(n, 0) and C(n, n) equal 1, and P(n, 0) does too.

The four formulas

Each formula below is shown with a worked example you can reproduce in the calculator.

1. Permutations without repetition, P(n, r)

P(n, r) = n! ÷ (n - r)!

How many ordered arrangements of r items can be drawn from n, each item used at most once. Example: P(10, 3) = 10! ÷ 7! = 3,628,800 ÷ 5,040 = 720.

Equivalently, multiply down from n for r steps: 10 × 9 × 8 = 720. The first pick has n candidates, the second n - 1, and so on, because a used item cannot be used again.

2. Combinations without repetition, C(n, r)

C(n, r) = n! ÷ [r! × (n - r)!]

How many unordered selections of r items from n. Example: C(10, 3) = 3,628,800 ÷ (6 × 5,040) = 120. This is also the binomial coefficient, the number in Pascal's triangle and the "choose" operator of the binomial theorem.

3. Permutations with repetition, nr

nr

How many ordered strings of length r exist when every position independently allows any of the n items. Example: a 3-digit PIN over the digits 0 to 9 has 103 = 1,000 codes; with only 4 allowed digits it would be 43 = 64.

4. Combinations with repetition, C(n + r - 1, r)

C(n + r - 1, r)

How many multisets of r items from n types, repeats allowed and order ignored. Example: choosing 3 scoops for a cone from 4 flavors gives C(4 + 3 - 1, 3) = C(6, 3) = 20 cones, triple-chocolate fully permitted.

When items can repeat

The default case in most homework and most real draws is without repetition: once a card is dealt or a runner is placed, it is out of the pool. Repetition belongs in the formula only when the same item genuinely can appear more than once:

  • Codes and keys: PINs, passwords, license plates and binary strings allow repeats by design. Order matters and digits can reuse, so these are nr problems.
  • Draws with replacement: roll three dice and the outcomes are 63 = 216 ordered triples, because a die shows the same face as happily as any other.
  • Shopping and scoops: buying a dozen bagels across 5 varieties, with order irrelevant and repeats natural, is C(n + r - 1, r).
  • When in doubt, ask whether the same item could sensibly appear twice in one outcome. Two aces of hearts in one poker hand cannot happen, so poker is counted without repetition.

Pascal's triangle: the combination machine

Every combination count lives in Pascal's triangle. Start a 1 at the top; build each row by adding the two numbers above it; and the row beginning 1, n holds the values of C(n, 0) through C(n, n) in order. Row 5 reads 1, 5, 10, 10, 5, 1, which is C(5, 0) = 1, C(5, 1) = 5, C(5, 2) = 10 and so on, exactly what the formula gives.

The triangle remembers two deep facts. First, the symmetry C(n, r) = C(n, n - r): choosing 2 flavors to include is the same count as choosing 3 to leave out, which is why the 10 appears twice in row 5. Second, Pascal's identity, C(n, r) = C(n - 1, r - 1) + C(n - 1, r): every entry is literally the sum of the two above it. Split your choices into "the new item is in" and "the new item is out", and the two branches are those neighbors.

Historically this is where the subject matured. In 1654, Blaise Pascal and Pierre de Fermat exchanged letters about gambling questions posed by the Chevalier de Méré, and in working them out they systematized these counting rules, seeding both combinatorics and probability theory in one correspondence.

Classic applications, verified by the engine

  • Poker hands: a 5-card hand from a 52-card deck gives C(52, 5) = 2,598,960 possible hands. Only 4 of them are royal flushes, which is why that hand pays a jackpot: about 1 in 649,740 deals.
  • Lottery odds: matching 5 numbers drawn from 69, as in the Powerball white balls, can happen in C(69, 5) = 11,238,513 ways. Your single ticket is one of them, and the jackpot requires this match plus the separate Powerball.
  • Shelving and scheduling: arranging 5 books chosen from a shelf of 12, where which book sits in which position matters, gives P(12, 5) = 95,040 arrangements.
  • Teams and committees: choosing a 3-person committee from 10 candidates ignores order, C(10, 3) = 120, while assigning those same 3 people to president, treasurer and secretary multiplies by 3! to give 720.

Practice problems, with answers

Cover the answers, decide order and repetition first, then check yourself against the calculator:

  • A race with 8 runners, full finishing order: order matters and no runner finishes twice, so 8! = 40,320 arrangements.
  • A 3-topping pizza from 5 toppings: order does not matter and toppings cannot repeat, so C(5, 3) = 10 combinations.
  • A committee of 4 from 9 volunteers: C(9, 4) = 126, while assigning that committee to four distinct roles would give P(9, 4) = 3,024.
  • A license plate of 3 letters then 2 digits: repeats allowed and positions distinct, so 263 × 102 = 1,757,600 plates.
  • Arranging the letters of MISSISSIPPI: 11 letters with 4 I's, 4 S's and 2 P's indistinguishable, so 11! ÷ (4! × 4! × 2!) = 34,650 distinct arrangements.

Using the calculator well

  • Decide order before anything else: reread the question and ask whether swapping two chosen items creates a different outcome. Pick nPr or nCr on that answer alone.
  • Then decide repetition: ask whether the same item could appear twice in one outcome. Most physical draws cannot; most codes can.
  • Read the formula row: the breakdown table substitutes your n and r into each formula, which is the fastest way to check that a hand-worked solution matches.
  • Trust the exact digits: results beyond 15 digits skip thousands separators but stay exact, so lottery and factorial-sized answers can be quoted directly.
  • Sanity-check the direction: nPr should always be at least nCr for the same n and r, and both equal 1 when r is 0; combinations also equal 1 when r equals n, since there is exactly one way to take everything. If your expectation disagrees, the order question was probably answered backwards.

Common questions

Order is the whole difference. A permutation counts ordered arrangements, so ABC and BAC are two different results; a combination counts unordered selections, so ABC and BAC are the same single result. If the question says arrange, rank or assign to distinct positions, use permutations; if it says choose, select or form a group, use combinations.

Because the sequence you enter must match exactly: 1-2-9 opens the lock and 9-2-1 does not, which is the definition of order mattering. Mathematicians have joked about this misnomer for decades, and it doubles as the fastest memory hook for the distinction between the two concepts.

Each combination bundles together every ordering of the same chosen items, and there are exactly r! of those orderings. Dividing the permutation count by r! removes that redundancy, so C(n, r) = P(n, r) / r!. The division is exact, and the two counts coincide only when r is 0 or 1, because a single item has only one arrangement.

It allows the same item to appear more than once in a single outcome. With repetition and order, each of the r positions independently allows all n items, giving n to the power r. With repetition and no order, the count becomes C(n + r - 1, r). Repetition is correct for PINs, dice rolls, and multi-scoop cones, and wrong for dealt cards or committee seats.

Because there is exactly one way to select nothing: select nothing. The formulas confirm it, since C(n, 0) = n! / (0! × n!) = 1 under the convention 0! = 1. The same logic makes P(n, n) = 1: a full set has a single arrangement relative to itself, and C(n, n) = 1 as well.

They never stop being exact. The calculator uses arbitrary-precision integers, so even 1000! with its 2,568 digits is computed digit for digit. The only display change is cosmetic: results longer than 15 digits drop the thousands separators but remain complete, and nothing is ever rounded or shown in scientific notation.

Distinct arrangements of items with duplicates are counted by the multinomial coefficient: n! divided by the product of the factorials of each identical group's size. The word BANANA, for example, has 6! / (3! × 2! × 1!) = 60 distinct arrangements, because its three A's and two N's are interchangeable. This calculator handles the selection stage; divide by the duplicate factorials afterwards if your items repeat.

It comes from a picture called stars and bars. Counting multisets of r items from n types is the same as laying out r stars for the items and n - 1 bars that divide them into n groups, and every arrangement of those r + n - 1 symbols is one selection. Choosing which r of the positions are stars gives C(n + r - 1, r). For 3 scoops from 4 flavors, that is C(6, 3) = 20.

Use the multiplication principle: when one outcome is a chain of independent choices, multiply the number of options at each step. Three shirts and four pants make 12 outfits, and a plate of 3 letters and 2 digits makes 26 × 26 × 26 × 10 × 10 = 1,757,600. The permutation and combination formulas are this principle refined for the case where every choice draws from the same shrinking (or reusable) pool.

It decomposes one hard count into two easier ones: C(n, r) = C(n - 1, r - 1) + C(n - 1, r), splitting the selections by whether a particular item is included. It is the reason the triangle can be built by simple addition instead of factorials, and it is the engine behind fast exact algorithms for binomial coefficients in software that must avoid enormous intermediate factorials.

No. Every calculation runs in your browser. Nothing is stored or transmitted.

Count every outcome. Never list one.

Browse all math calculators