On this page
Formula
C(n, r) = n! ÷ (r! × (n − r)!); P(n, r) = n! ÷ (n − r)!; with repetition: C(n + r − 1, r) and nʳ
- n
- the number of distinct items to choose from
- r
- how many items are chosen
- !
- factorial, e.g. 5! = 5 × 4 × 3 × 2 × 1 = 120, and 0! = 1
Combinations, permutations and repetition
Counting problems come down to two questions: does order matter, and can an item be chosen more than once? The answers give four formulas, and the combination calculator shows all four results at once, with the one you selected at the top.
| No repetition | Repetition allowed | |
|---|---|---|
| Order doesn’t matter | Combinations, C(n, r) = n! ÷ (r!(n − r)!) | C(n + r − 1, r) |
| Order matters | Permutations, P(n, r) = n! ÷ (n − r)! | nʳ |
Examples of each, choosing 4 from 12:
- Combinations: a 4-person committee from 12 volunteers, C(12, 4) = 495.
- Permutations: a president, vice president, secretary and treasurer from 12 people, P(12, 4) = 11,880.
- Combinations with repetition: a box of 4 donuts from 12 flavors, where flavors can repeat, C(15, 4) = 1,365.
- Permutations with repetition: a 4-character code using 12 symbols, 12⁴ = 20,736.
How to use the combination calculator
- Enter n, the number of distinct items available.
- Enter r, how many you’re choosing.
- Choose whether order matters: combinations (nCr) or permutations (nPr).
- Tick Repetition allowed if an item can be picked more than once.
- Read the count at the top. The formula with your numbers is in the working, and the other three counts are listed below for comparison.
How to calculate combinations by hand
Take the committee example, C(12, 4).
- Write the formula: 12! ÷ (4! × 8!).
- Cancel the larger factorial. 12! ÷ 8! leaves 12 × 11 × 10 × 9 = 11,880. That’s P(12, 4), the number of ordered choices.
- Divide by r! to remove the orderings. 4! = 24, and 11,880 ÷ 24 = 495.
Cancelling first keeps the numbers small. Computing 12! = 479,001,600 in full works for small n, but 100! has 158 digits, which overflows a regular calculator. This tool uses exact big-integer arithmetic, so it never rounds.
For combinations with repetition, the “stars and bars” argument turns the problem into an ordinary combination of n + r − 1 items. Twelve donut flavors and a box of 4 become C(15, 4) = 1,365.
Reference table: choosing from 20
| r | C(20, r) | P(20, r) |
|---|---|---|
| 1 | 20 | 20 |
| 2 | 190 | 380 |
| 3 | 1,140 | 6,840 |
| 4 | 4,845 | 116,280 |
| 5 | 15,504 | 1,860,480 |
| 6 | 38,760 | 27,907,200 |
| 8 | 125,970 | 5,079,110,400 |
| 10 | 184,756 | 670,442,572,800 |
Combinations peak at r = n ÷ 2 and are symmetric, so C(20, 3) = C(20, 17). Permutations keep growing as r increases.
How big the numbers get
Counts of combinations grow faster than most people expect. Choosing 6 numbers from 49 for a lottery gives 13,983,816 possible tickets. Shuffling a deck of 52 cards gives 52! arrangements, a 68-digit number, so every well-shuffled deck has almost certainly never existed before. At the calculator’s limit, 1,000 choose 500 has 300 digits.
When a result has more than 30 digits, the calculator shows it in scientific notation, such as 2.7029 × 10²⁹⁹, so you can read its size at a glance. The full exact value is printed digit by digit in the working, ready to copy. Nothing is approximated along the way, because the tool multiplies and divides whole numbers of any length instead of using floating-point arithmetic.
Real-life uses
- Lotteries and card games. A 5-card poker hand from 52 cards has C(52, 5) = 2,598,960 possibilities. Divide favorable hands by that total to get a probability with the probability calculator.
- Passwords and PINs. The number of possible codes is nʳ, which shows why adding characters strengthens a password far more than adding symbols.
- Scheduling and seating. Permutations count the ways to order speakers or seat guests.
- Sampling. The number of possible samples of size r from a population of n is C(n, r). Draw one at random with the random number generator using its no-repeats option.
- Menus and product options. Combinations with repetition count build-your-own orders, such as pizzas where you can double a topping.
Common mistakes
- Using permutations when order doesn’t matter. A lottery ticket 3-7-12 is the same as 12-7-3, so it’s a combination.
- Forgetting repetition. PINs, dice rolls and scoop choices allow repeats; committees and lottery draws don’t.
- Thinking 0! is 0. By definition 0! = 1, which is why C(n, 0) and C(n, n) both equal 1.
- Rounding large factorials. A scientific calculator shows 50! as about 3.04 × 10⁶⁴. Dividing rounded values can give non-integer counts. Exact arithmetic avoids this.
Glossary
- Factorial (n!): the product of all whole numbers from 1 to n.
- Binomial coefficient: another name for C(n, r), read “n choose r”.
- Multiset: a selection where items can repeat, counted by C(n + r − 1, r).
Powers like 12⁴ can also be evaluated with the exponent calculator.
Worked examples
Choosing pizza toppings
Pick 3 different toppings from a menu of 10, where the order you pick them in doesn’t matter.
Inputs: Total items to choose from (n) = 10; Items chosen (r) = 3; Does order matter? = No, combinations (nCr)
C(10, 3) = 10! ÷ (3! × (10 − 3)!) = 10! ÷ (3! × 7!) = 120
Answer: Choosing 3 from 10 gives 120 combinations without repetition.
Gold, silver and bronze
Ways 8 runners can fill the 3 medal places, where order matters.
Inputs: Total items to choose from (n) = 8; Items chosen (r) = 3; Does order matter? = Yes, permutations (nPr)
P(8, 3) = 8! ÷ (8 − 3)! = 8! ÷ 5! = 336
Answer: Choosing 3 from 8 gives 336 permutations without repetition.
Ice cream scoops with repeats
A cup of 3 scoops from 5 flavors, where a flavor can be repeated and order doesn’t matter.
Inputs: Total items to choose from (n) = 5; Items chosen (r) = 3; Does order matter? = No, combinations (nCr); Repetition allowed (an item can be chosen more than once) = Yes
C(n + r − 1, r) = C(5 + 3 − 1, 3) = C(7, 3) = 35
Answer: Choosing 3 from 5 gives 35 combinations with repetition.
Choosing nothing
Edge case: there is exactly one way to choose 0 items, the empty selection.
Inputs: Total items to choose from (n) = 12; Items chosen (r) = 0; Does order matter? = No, combinations (nCr)
C(12, 0) = 12! ÷ (0! × (12 − 0)!) = 12! ÷ (0! × 12!) = 1
Answer: Choosing 0 from 12 gives 1 combinations without repetition.
Assumptions and limitations
- n and r must be whole numbers from 0 to 1,000. Without repetition, r can't exceed n. With repetition, it can.
- All arithmetic uses exact big integers, so results are never rounded internally. 1,000 choose 500 (300 digits) and 1,000¹⁰⁰⁰ (3,001 digits) are computed exactly.
- Results up to 30 digits are shown in full with thousands separators. Longer results are shown in scientific notation to 5 significant figures, with every digit listed in the working.
- Combinations count selections where order doesn't matter. Permutations count arrangements where order matters.
- The items are assumed to be distinct. Counting arrangements of letters with repeats, such as the letters of "BANANA", needs a different formula.
Frequently asked questions
What is the difference between a combination and a permutation?
In a combination, order doesn't matter, so choosing A then B is the same as B then A. In a permutation, order matters, so AB and BA are different. That's why nPr is always at least as large as nCr; for each combination of r items there are r! orderings.
What does "with repetition" mean?
It means the same item can be picked more than once, like choosing scoops of ice cream where two scoops can be the same flavor, or the digits of a PIN. Without repetition, each item can be used only once, like people on a committee.
How many combinations does a 4-digit PIN have?
A PIN is ordered and digits can repeat, so it's permutations with repetition, 10⁴ = 10,000. A "combination lock" is really a permutation lock, because the order of the numbers matters.
What is n choose 0?
It's 1. There's exactly one way to choose nothing, the empty selection. Likewise, n choose n is 1, because there's one way to take everything.
Why does the calculator stop at 1,000?
The exact answers grow very fast. 1,000 choose 500 already has 300 digits, and 1,000 to the power 1,000 has 3,001. The limit keeps results exact and instant in your browser.
How do I use combinations to find a probability?
Divide the number of favorable selections by the total number of selections. The chance of matching all 6 numbers in a 6-from-49 lottery is 1 ÷ C(49, 6) = 1 in 13,983,816.
Sources
- §26.3 Lattice Paths: Binomial Coefficients (Digital Library of Mathematical Functions) — National Institute of Standards and Technology. Checked October 12, 2026.
- 13.5 Counting Principles (Algebra and Trigonometry 2e) — OpenStax, Rice University. Checked October 12, 2026.