Permutation and combination calculator — nPr and nCr

Enter the total number of items n and how many you choose r to get nPr (order matters) and nCr (order does not matter), plus the counts when repeats are allowed.

Live demo · real result from this tool
Permutations nPr720
Combinations nCr
120
Permutations with repetition (nʳ)
1,000
Combinations with repetition C(n + r − 1, r)
220

Formulas

nPr = n! / (n − r)! — order mattersnCr = n! / (r! (n − r)!) — order does not matternCr = nPr / r!

Processed on your device — nothing is uploaded.

How to use the permutation and combination calculator

  1. Enter Total items n, the number of things you can choose from.
  2. Enter Chosen r, how many you pick.
  3. Read Permutations nPr if order matters and Combinations nCr if it does not.
  4. If items can be reused, read Permutations with repetition (nʳ) or Combinations with repetition C(n + r − 1, r).
  5. The Formulas box shows the rules the tool uses.

What it does and when to use it

Counting problems are a big part of probability, statistics and exam maths. “How many ways can 3 books be arranged from 10?” or “How many poker hands are there?” are answered with nPr and nCr. Probability questions then divide favourable outcomes by these totals.

Both formulas are built from factorials. To see a factorial itself, such as 10! = 3,628,800, use the factorial calculator. For the elements of small sets and their overlaps, try the set theory calculator, and to turn a count into a percentage chance, the percentage calculator helps.

How it works

Count Formula Order matters? Repeats?
nPr n! ÷ (n − r)! yes no
nCr n! ÷ (r! (n − r)!) no no
nʳ n × n × … (r times) yes yes
C(n + r − 1, r) (n + r − 1)! ÷ (r! (n − 1)!) no yes

The tool never builds the full factorials. nPr is the product n × (n − 1) × … with r factors. nCr is built one factor at a time, multiplying and dividing so every step stays a whole number, and it uses the smaller of r and n − r. All arithmetic is exact, with no size limit on the digits.

Step by step for n = 10, r = 3:

  1. Permutations: start at 10 and multiply 3 numbers going down. 10 × 9 × 8 = 720.
  2. Each group of 3 can be ordered in 3! = 3 × 2 × 1 = 6 ways.
  3. Combinations: 720 ÷ 6 = 120.
  4. With repetition: 10³ = 1,000 ordered choices, and C(12, 3) = 220 unordered ones.

The tool shows Permutations nPr: 720 and Combinations nCr: 120.

Worked examples

Choosing 3 from 10. nPr = 720, Combinations nCr: 120.

Poker hands. n = 52 cards, r = 5: Combinations nCr: 2,598,960. If the order of dealing mattered, nPr would be 311,875,200.

Small case to check by hand. n = 4, r = 2: nPr = 12, nCr = 6, nʳ = 16 and Combinations with repetition C(n + r − 1, r): 10. You can list all 10 pairs, such as AA, AB, AC, AD, BB and so on.

r larger than n. n = 3, r = 5: the tool reports 0 — you cannot choose more items than there are, but nʳ = 243 and C(7, 5) = 21.

Limits and tips

  • n and r must be whole numbers, 0 or more.
  • nʳ is reported as “too large” when it would have more than about 100,000 digits.
  • All counting runs in your browser.

Frequently asked questions

How do I know whether to use a permutation or a combination?
Ask whether the order matters. Gold, silver and bronze for three runners is a permutation, because swapping two runners gives a different result. Picking three people for a team is a combination, because the same three people form the same team in any order.
What does "with repetition" mean?
Each item can be chosen more than once. A 4-digit PIN uses permutations with repetition, 10⁴ = 10,000. Choosing 3 scoops from 5 ice-cream flavours, where two scoops can be the same flavour, uses combinations with repetition.
Why do I get 0 when r is bigger than n?
Without repetition you cannot pick 5 different items from only 3. The repetition counts still work, because items can repeat.
How big can n and r be?
n up to 1,000,000 and r up to 20,000. Answers are exact. Results longer than 40 digits are shown in scientific form with the number of digits.
Are 0P0 and 0C0 allowed?
Yes. There is exactly one way to choose nothing, so both are 1, which follows from 0! = 1.

Written by the ToolsRift team · Last updated

Pages are drafted with AI assistance and checked by automated tests. How we write and check pages.

Was this tool useful?

Report a problem

Start typing to search every tool.

↑ ↓ to moveEnter to openEsc to close