A combination is a selection in which order does not matter: a poker hand, a lottery ticket, a committee. The number of ways to choose r items from n distinct items is written C(n, r), nCr or “n choose r”. This calculator returns that number exactly — no rounding, even when it runs to thousands of digits — and shows how the factorials cancel so you can follow the arithmetic.
How to use the combinations calculator
- Enter Total items (n), the number of different things available to choose from.
- Enter Items chosen (r), how many are picked at once. Without repeats, r cannot be larger than n.
- Read C(n, r) on the tape. Below it you also get the ordered count P(n, r), the count if items could repeat, and the chance of drawing one particular selection.
- Tick List the combinations to print the selections themselves, with items labeled A, B, C and so on (up to 500 of them, for n ≤ 100 and r ≤ 12).
For n up to 30, a table shows C(n, k) and P(n, k) for every k from 0 to n — a full row of Pascal’s triangle.
Combinations formula (nCr)
Here n! is the factorial n × (n − 1) × … × 1. Read the formula as a correction: n! counts every ordering of all n items, dividing by r! forgets the order inside the chosen group, and dividing by (n − r)! forgets the order of the items left out.
You never need the full factorials. The larger factorial in the bottom cancels against the top, leaving a short product:
The calculator always cancels whichever of r! and (n − r)! is larger, so C(1,000,000, 999,997) takes three multiplications, not a million.
Worked example: five-card poker hands
How many different 5-card hands can be dealt from a standard 52-card deck? Order does not matter — the same five cards are the same hand — so n = 52 and r = 5.
C(52, 5) = 52! ÷ (5! · 47!)
Cancel 47!: (52 × 51 × 50 × 49 × 48) ÷ (5 × 4 × 3 × 2 × 1)
= 311,875,200 ÷ 120 = 2,598,960
There are 2,598,960 possible hands, so any one specific hand turns up with probability 1 in 2,598,960. The numerator, 311,875,200, is the number of ways to deal five cards in order; each hand appears 5! = 120 times in that count, which is exactly what dividing by 120 removes. The probability of a hand that is all hearts is C(13, 5) ÷ C(52, 5) = 1,287 ÷ 2,598,960, about 0.05%.
Does order matter? Picking the right count
Most counting mistakes come from using the right formula for the wrong situation. Ask two questions: does swapping two chosen items give a different outcome, and can the same item be picked twice?
| Situation | Order matters? | Repeats? | Count |
|---|---|---|---|
| Committee of 4 from 12 people | No | No | C(12, 4) = 495 |
| President, VP and treasurer from 12 | Yes | No | P(12, 3) = 1,320 |
| 3 scoops from 10 flavors in a cup | No | Yes | C(12, 3) = 220 |
| 4-digit PIN | Yes | Yes | 10⁴ = 10,000 |
When order matters, use the permutations calculator. When an item can be chosen more than once, use the combinations with replacement calculator.
Combinations and lottery odds
If every selection is equally likely, the chance of one particular selection is 1 ÷ C(n, r). Lotteries are the classic case. Powerball draws 5 white balls from 69 and 1 red ball from 26, giving C(69, 5) × 26 = 11,238,513 × 26 = 292,201,338 possible tickets. Mega Millions draws 5 from 70 and 1 from 24: C(70, 5) × 24 = 12,103,014 × 24 = 290,472,336. Buying 10 tickets with different numbers multiplies your chance by 10 — it is still about 1 in 29 million.
Useful properties
- Symmetry: C(n, r) = C(n, n − r). The tape shows the mirror count for every input.
- Pascal’s rule: C(n, r) = C(n − 1, r − 1) + C(n − 1, r), which is how Pascal’s triangle is built.
- Row sums: C(n, 0) + C(n, 1) + … + C(n, n) = 2ⁿ, the number of subsets of an n-item set.
- Peak in the middle: for fixed n, C(n, r) is largest at r = n/2. C(20, 10) = 184,756, while C(20, 2) is only 190.
Frequently asked questions
What is the difference between a combination and a permutation?
A combination is a group in which order does not matter, so {A, B, C} and {C, B, A} are the same selection. A permutation is an ordered arrangement, so those count as different. Each combination of r items can be put in order r! ways, which is why P(n, r) = C(n, r) × r!.
Why is C(n, 0) equal to 1?
There is exactly one way to choose nothing: the empty selection. The formula agrees, because n! ÷ (0! × n!) = 1 once 0! is defined as 1.
Why does C(n, r) equal C(n, n − r)?
Choosing which r items to take is the same decision as choosing which n − r items to leave behind. Picking 3 of 10 people for a team can be done 120 ways, and so can picking the 7 who stay off it.
How large can n and r be?
Any whole numbers up to 10^15, as long as the answer has no more than 50,000 digits. Every result is computed with exact whole-number arithmetic, and long answers are printed in full below the calculator.
What are the odds of hitting the Powerball jackpot?
A ticket must match 5 of 69 white balls, which can be chosen C(69, 5) = 11,238,513 ways, and 1 of 26 red balls. That makes 11,238,513 × 26 = 292,201,338 equally likely tickets, so the chance is 1 in 292,201,338.