Permutation & Combination Calculator: nPr and nCr
How many ways can you arrange 5 books on a shelf — and how many 3-book reading lists can you make? Enter n and r, and this free permutation and combination calculator will compute both nPr and nCr with the formulas shown.
Formulas verified against standard references. Calculator logic tested with verified worked examples. Last reviewed: October 2026. Our methodology
Permutation vs. combination formulas
The only question that matters: does order matter? Arrangements use permutations; selections use combinations.
- Permutation (order matters): P(n,r) = n! ÷ (n−r)! — every different ordering counts separately.
- Combination (order doesn’t matter): C(n,r) = n! ÷ (r! × (n−r)!) — divide out the r! ways to reorder the chosen items.
- Combinations are always ≤ permutations for the same n and r — dividing by r! can only shrink the count.
| Question | Order matters? | Use | P(5,3) / C(5,3) |
|---|---|---|---|
| Gold, silver, bronze medals for 5 runners | Yes | P(5,3) | 60 |
| 3-person committee from 5 people | No | C(5,3) | 10 |
| 3-digit lock codes from 5 digits | Yes | P(5,3) | 60 |
| 3 toppings from 5 options | No | C(5,3) | 10 |
Medals and lock codes care about order (permutations); committees and pizza toppings do not (combinations).
Worked example
From 5 people, choose 3.
Permutations: P(5,3) = 5! ÷ (5−3)! = 120 ÷ 2 = 60 ordered arrangements.
Combinations: C(5,3) = 5! ÷ (3! × 2!) = 120 ÷ (6 × 2) = 120 ÷ 12 = 10 unique groups. Each group of 3 can be ordered 3! = 6 ways, which is exactly what the extra division removes: 60 ÷ 6 = 10.
How to use the permutation and combination calculator
Decide first whether your problem cares about order — that single choice picks the formula.
Step by step
- Enter n, the total number of items you are choosing from (must be a whole number).
- Enter r, how many you pick. It cannot exceed n.
- Press Calculate. You get both P(n,r) and C(n,r) — pick the one matching your question.
- Check the breakdown for the factorials behind each result.
- Sanity-check the size: if the answer looks absurdly large, you probably wanted combinations, not permutations.
The multiplication principle: why factorials appear
Factorials count sequential choices. Arranging 5 books: 5 choices for the first slot, 4 for the second, 3, 2, 1 — that is 5 × 4 × 3 × 2 × 1 = 120 = 5!.
Permutations stop early: for 3 slots from 5, it is 5 × 4 × 3 = 60, which equals 5! ÷ 2! — the full factorial with the unused tail (2!) divided away. Combinations go further and divide by 3! = 6, because each chosen trio was counted 6 times in 6 different orders.
This "count everything, then divide out the overcounting" pattern is the beating heart of combinatorics — and of probability, where these counts become the numerators and denominators of odds. A probability calculator puts them to work directly.
Lottery odds, poker hands and passwords
These formulas explain numbers you meet in the wild:
| Scenario | Math | Result |
|---|---|---|
| 6/49 lottery jackpot | C(49,6) | 1 in 13,983,816 |
| 5-card poker hands | C(52,5) | 2,598,960 possible |
| 4-digit PIN (digits can repeat) | 104 | 10,000 (repetition — neither formula) |
| Race with 8 runners, top 3 medals | P(8,3) | 336 outcomes |
Note the PIN row: when items can repeat, neither formula applies — it is simply nr. Permutations and combinations both assume each item is used at most once.
Common traps (and how to dodge them)
- "At least one" problems: compute the total minus the complement (e.g., total committees minus all-male committees) instead of counting directly.
- Identical items: arranging MISSISSIPPI is not 11! — divide by the factorial of each repeated letter’s count.
- r = 0 or r = n: C(n,0) = C(n,n) = 1 — there is exactly one way to choose nothing or everything.
- Huge factorials: 170! is about 7 × 10306; past that, ordinary calculators overflow. This solver caps n at 170 and tells you.
When a problem feels ambiguous, try tiny numbers by hand (n=3, r=2 — list all outcomes) and see whether your formula reproduces the list. Concrete checks beat abstract confidence.
Frequently asked questions
What is the difference between permutation and combination?
Order. Permutations count arrangements where order matters (P(n,r) = n!/(n−r)!); combinations count selections where it does not (C(n,r) = n!/(r!(n−r)!)). Medals use permutations; committees use combinations. For n=5, r=3: P=60, C=10.
How do you calculate nPr?
nPr = n! ÷ (n−r)!. For P(5,3): 5! ÷ 2! = 120 ÷ 2 = 60. It counts ordered arrangements of r items chosen from n.
How do you calculate nCr?
nCr = n! ÷ (r! × (n−r)!). For C(5,3): 120 ÷ (6 × 2) = 10. The extra r! in the denominator removes the orderings that permutations count separately.
When do I use permutations vs combinations?
Ask: would swapping two chosen items create a different outcome? Gold/silver/bronze medals — yes, permutation. A 3-person committee — no, combination. Lock codes and race finishes are permutations; lottery picks and pizza toppings are combinations.
What are the odds of winning the lottery?
For a 6-from-49 lottery: C(49,6) = 13,983,816, so 1 in about 14 million per ticket. The formula shows exactly why jackpots roll over so often.
What is 0! ?
1, by definition — and usefully so: it makes C(n,0) = 1 (one way to choose nothing) and keeps the formulas consistent at the edges.
Why do factorials grow so fast?
Each step multiplies by a larger number: 10! is 3.6 million, 20! is 2.4 quintillion, and 170! (~7×10^306) is near the limit of standard floating-point math. That explosive growth is why counting problems get astronomical quickly.