Permutation and Combination Calculator
Count ways to take r items from n. Permutations keep order (gold then silver is not silver then gold). Combinations ignore order (the same pair of people is one committee).
How to use
- Choose Permutations if rearranging the selection creates a new outcome, Combinations if it does not.
- Enter n (how many items you have) and r (how many you take) as whole numbers, zero allowed.
- Read P(n, r) or C(n, r). The details repeat which formula ran and whether order was counted.
- If r is larger than n, or either value is not a non-negative integer, the count is rejected rather than invented.
How it works
Order is the whole distinction. A permutation is an ordered selection: line people up, assign first and second place, or set a PIN. P(n, r) = n! / (n − r)!, which is just n × (n − 1) × … for r factors. P(5, 2) = 5 × 4 = 20: five choices for first, four remaining for second. A combination is the same grab with the lining-up forgotten. C(n, r) = n! / (r! (n − r)!). C(5, 2) = 10, because each pair of people can be ordered in 2! = 2 ways and those two permutations are the same committee. If your story does not care who was picked first, you want C, not P.
Everyday tests: a race podium or a password prefix is a permutation. A dealt poker hand, a fruit bowl, or “pick three speakers from eight” is a combination. “How many ways can five books sit on a shelf?” is P(5, 5) = 5!. “How many 3-person groups from 12 classmates?” is C(12, 3). Mixing the two is the usual homework trap — the combination is always the smaller number once r > 1, because you have divided out the internal orders.
n and r must be integers, neither negative, and r cannot exceed n. You cannot choose six starters from five players. P(n, 0) and C(n, 0) are both 1: there is one way to choose nothing. C(n, n) is 1 and P(n, n) is n!. The calculator uses multiplicative loops rather than huge factorials, then rejects overflow instead of returning Infinity when n and r get enormous.
This page only counts equally likely labelled selections. It does not compute a probability unless you divide the count by a total yourself on the probability calculator. It does not handle repetitions (words from a multiset) or circular arrangements. Those need different formulae.
If you are planning how many survey answers to collect, that is sample size, not nPr. If you already have a list of measured numbers, summarise them elsewhere — permutations do not describe a data set.
Formula
P(n, r) = n! / (n − r)! C(n, r) = n! / (r! (n − r)!)
Worked examples
Permutations of 5 take 2
P(5, 2) → 20
Combinations of 5 take 2
C(5, 2) → 10
Useful notes
- C(n, 0) = 1 and P(n, 0) = 1: there is one way to choose nothing.
- r cannot exceed n, and both must be non-negative integers.
- Overflow is rejected instead of showing Infinity.
FAQ
- When do I use permutations vs combinations?
Permutations if order matters (gold/silver, a PIN). Combinations if it does not (a committee, a dealt hand).
- Why is C(5, 2) smaller than P(5, 2)?
Each pair of people can be lined up in 2! = 2 ways. Dividing by r! removes that extra order.
- What if r is larger than n?
You cannot choose more items than you have. The result is rejected.
- Is a lock PIN a permutation or a combination?
A PIN is a permutation (order matters, and this page assumes no repeated digits unless they come from distinct positions in n distinct items). A locker that only cares which three numbers were used, not the sequence, would be a combination.
- Does this calculate a probability?
No. It counts arrangements. To get a probability, divide a favourable count by a total yourself, or use the probability calculator when you already have percentages.
Related tools
Probability Calculator
Combine two event probabilities as independent, mutually exclusive, or overlapping, plus complements and “at least one”.
Sample Size
Estimate how many observations a proportion survey needs for a chosen confidence level and margin of error.
Statistics Calculator
Paste a list and get count, mean, median, mode, range, and both sample and population variance and SD.
See all Statistics tools.