Permutation and combination calculator: nPr and nCr

Count ordered arrangements (nPr) and unordered choices (nCr), with or without repeats, as exact whole numbers. List the sets when n is 8 or less. Runs on your device.

How it works

  1. Choose permutations or combinations and say whether items can repeat
  2. Type n, the items to choose from, and r, the items chosen
  3. Read the count and the formula, and switch on the list for a small set

nPr and nCr: which one counts your case

Use nPr = n! ÷ (n − r)! when the order of the chosen items matters, and nCr = n! ÷ (r! × (n − r)!) when it does not. The page opens on n = 10 and r = 3: there are 10 × 9 × 8 = 720 permutations and 720 ÷ 3! = 120 combinations. The factor 3! = 6 is how many orders each group of three can be arranged in, which is why every combination is counted six times among the permutations. Three prizes handed to three different people out of ten is a permutation, because first place and third place differ. A committee of three out of ten is a combination, because the same three people form the same committee in any order. The page works out all four counts at once and puts the one you picked first.

With repetition

If an item can be picked again, the formulas change. Ordered picks with repeats number n^r: a 3-digit code from 10 digits has 10 × 10 × 10 = 1,000 possibilities. Unordered picks with repeats number C(n + r − 1, r), which is C(12, 3) = 220 for the same n and r. A scoop example: with 3 flavours (A, B, C) and 2 scoops where flavours may repeat, the 6 choices are AA, AB, AC, BB, BC and CC. When repeats are allowed r may be bigger than n. Without repeats it may not, because you cannot choose 12 different items from 10, and the page shows a message under r instead of a zero.

Exact answers for large numbers

The counts are worked out in exact whole-number arithmetic, not floating point, so there is no rounding at any size. n and r can each be up to 10,000. A count of up to 30 digits is shown whole: 52 cards taken 5 at a time give 2,598,960 hands, and 49 numbers taken 6 at a time give 13,983,816 combinations. A longer count is shown as a rounded power of ten, such as 70! = 1.197857 × 10¹⁰⁰, together with its digit count (101). Below it a block holds every digit, ready to copy, up to 5,000 digits. Past that the block holds the first 5,000 digits and says how many there are in all. For n = 10,000 and r = 10,000 with repeats the count has 40,001 digits.

Listing the arrangements

When n is 8 or less, a checkbox lists the sets with the letters A, B, C and so on. Permutations of 2 from 3 are AB, AC, BA, BC, CA and CB. Combinations of 2 from 3 are AB, AC and BC. The list follows dictionary order and stops at 500 rows; its caption gives the full count, for example the first 500 of 40,320 for 8 items taken 8 at a time. Use the list to check that you are counting what you meant to count before you trust a big number.

What it does not do

The page counts selections from n distinct items. It does not handle items with duplicates, such as the letters of MISSISSIPPI, where some arrangements look the same. It does not count circular arrangements, restricted seatings or probability. For the chance of an event after you know the count, divide by the total number of outcomes, or use the probability calculator. Whole numbers only: n must be 1 or more and r 0 or more. When r is 0 there is exactly 1 way to choose nothing.

Frequently asked questions

How do I calculate permutations?

Multiply n by the next r − 1 smaller numbers: nPr = n × (n − 1) × … × (n − r + 1). For 10P3 that is 10 × 9 × 8 = 720. It equals n! ÷ (n − r)!. Type n and r and the page shows the product with your numbers.

What is the difference between a permutation and a combination?

Order. A permutation counts ABC and CBA as two results, a combination counts them as one. From 10 items taking 3, there are 720 permutations and 120 combinations, because each group of 3 can be ordered in 3! = 6 ways and 720 ÷ 6 = 120.

How do I calculate combinations with repetition?

Use C(n + r − 1, r). For n = 10 and r = 3 that is C(12, 3) = 220. It counts unordered picks where an item can be taken more than once, such as 3 scoops from 10 flavours where repeats are allowed. Tick Items can repeat and choose Combinations.

Why does the page say r is too large?

Without repeats you cannot choose more items than you have, so n = 10 and r = 12 has no answer. Allow repeats if the same item can be chosen again: ordered, that gives 10^12 = 1,000,000,000,000 results.

How large can n and r be?

Both up to 10,000, and the answer is exact. Up to 30 digits it is shown whole, for example 2,598,960 for 52C5. Longer answers show a power of ten with the digit count, and the exact digits (up to 5,000) are in a block below that you can copy.

Are my numbers stored or sent anywhere?

No. The numbers are processed in your browser and are not uploaded. They are not stored on your device either, and reloading the page puts the n = 10 and r = 3 example back.