How this combination & permutation calculator works
Counting problems come in two flavours. When the order of the items matters — the gold, silver and bronze in a race, the digits of a PIN, the seating around a table — you are counting permutations. When the order does not matter — the six numbers on a lottery ticket, a hand of cards, a committee picked from a group — you are counting combinations.
The combination formula is nCr = n! / (r!(n − r)!) and the permutation formula is nPr = n! / (n − r)!. The only difference is the extra division by r! in combinations, which removes the r! ways each chosen set could have been ordered. That is why permutations are always larger than or equal to combinations for the same n and r.
Reference note: results are computed with an exact step-by-step (multiplicative) method rather than full factorials, so large values of n stay accurate without overflow. Inputs must be non-negative whole numbers with r no greater than n.
Frequently asked questions
- What is the difference between a permutation and a combination?
- A permutation counts arrangements where order matters, so AB and BA are different. A combination counts selections where order does not matter, so AB and BA are the same. For the same n and r there are always at least as many permutations as combinations.
- What is nCr?
- nCr is the number of combinations — the number of ways to choose r items from n when order does not matter. It equals n! / (r!(n − r)!), and is also written C(n, r) or the binomial coefficient "n choose r".
- What is nPr?
- nPr is the number of permutations — the number of ways to arrange r items chosen from n when order matters. It equals n! / (n − r)!, which is the same as nCr multiplied by r!.
- When does order matter?
- Order matters when different arrangements are different outcomes — race finishes, passwords, seating order — so use permutations (nPr). When you only care which items were chosen, such as a lottery draw or a team, use combinations (nCr).
- How is it calculated?
- Combinations use nCr = n! / (r!(n − r)!) and permutations use nPr = n! / (n − r)!. This tool multiplies and divides step by step instead of building huge factorials, so the result stays exact and never overflows.
- What is a factorial?
- A factorial, written n!, is the product of every whole number from 1 up to n — for example 5! = 5 × 4 × 3 × 2 × 1 = 120. By definition 0! = 1, and factorials count the ways to arrange n distinct items in a row.