Combinations Calculator

How many ways can you pick or arrange a set of things? Put in the numbers and it counts them for you. The answer turns on two questions: whether the order matters, and whether you are allowed to repeat.

How to use it

Give it the size of the set and how many you are taking from it, then set the two switches: does the order they come out in count, and may the same item be picked twice.

  1. Say how many there are and how many you take Forty-nine lottery balls, six drawn. Ten runners, three places.
  2. Decide whether order matters Gold, silver and bronze are an order. A hand of cards is not.
  3. Decide whether repeats are allowed A dice roll can repeat a number; drawing balls from a bag cannot.
Full instructions
In depth

How many ways can things be picked or arranged

This article explains the combinations and permutations calculator, walks through every control, shows worked examples for lottery odds and PIN codes, and clears up the confusion between order mattering and not mattering that trips up most people the first time they meet these formulas.

Screenshot: Counting the ways something can happen
Counting the ways something can happen as it appears when the page opens.

The four questions hiding behind one

How many ways can you choose things from a set? The answer depends on two decisions. First, does the order matter? Second, can you pick the same item more than once? Those two yes-or-no choices give four different formulas, and using the wrong one gives an answer that can be off by a factor of thousands or millions.

When order does not matter and repeats are not allowed, the result is a combination, written nCr. This is the lottery question: how many different groups of six balls can be drawn from forty-nine?

When order matters and repeats are not allowed, the result is a permutation, written nPr. This is the medal question: how many ways can three runners finish first, second, and third out of ten?

When order matters and repeats are allowed, the answer is a simple power. This is the PIN question: how many four-digit codes are there when each digit can be anything from 0 to 9?

When order does not matter and repeats are allowed, the formula uses what mathematicians call a multiset coefficient. This is the ice cream question: how many ways can you pick three scoops from five flavours if you can repeat a flavour?

The controls on the input panel

The panel on the right is headed The numbers. It holds four controls and a checkbox.

How many to choose from is the total pool. For a lottery with 49 balls, enter 49. For a deck of cards, enter 52. For the digits 0 through 9, enter 10. The default is 49.

How many you pick is the size of the selection. For a six-ball draw, enter 6. For a three-medal podium, enter 3. For a four-digit PIN, enter 4. The default is 6.

Does the order matter is a dropdown with two choices: No, a group is a group, and Yes, first and second are different. The first gives combinations, the second gives permutations.

Can you repeat an item is also a dropdown. No means each item is used once. Yes means you can pick the same thing again. Drawing balls from a bag is no-repeat. Rolling a die is yes-repeat.

Show it as odds and probability is a checkbox. When ticked, the result includes the chance of one specific outcome expressed both as a probability and as odds. This is the line that tells you your lottery ticket has a one in fourteen million chance.

What the output tells you

The main figure is the total number of possible outcomes. For 6 from 49 with no order and no repeats, that number is 13,983,816. That is how many different groups of six can be pulled from the drum.

If the odds checkbox is ticked, a second line shows the probability of matching one specific outcome. For the lottery example that is roughly one in 13,983,816, or about 0.0000072 percent. The odds version of the same fact is approximately 13,983,815 to 1 against.

When the numbers get very large, the tool switches to scientific notation. This happens past about 170 factorial, where the result exceeds what a standard floating-point number can hold. The answer is still correct to the precision your browser allows, but it is written in a compact form rather than as a string of hundreds of digits.

Worked example: lottery odds

A national lottery draws 6 balls from 49. No ball can appear twice and the order they come out does not matter. Set How many to choose from to 49, How many you pick to 6, Does the order matter to No, and Can you repeat an item to No. Tick the odds checkbox.

The result is 13,983,816 combinations. The probability of matching all six is about one in fourteen million. If you bought one ticket a week, on average you would wait about 269,000 years for a win. That number is not a misprint. It is the honest arithmetic that lottery advertising is not required to show.

Now change Does the order matter to Yes. The count jumps to over ten billion. That is how many ways six balls could be drawn if the sequence mattered. Lottery odds are quoted using the smaller figure precisely because the draw order is ignored. That single detail, order not mattering, is what keeps the odds in the millions rather than the billions.

Worked example: PIN codes and passwords

A four-digit PIN uses the digits 0 through 9. Each position can hold any digit, and digits can repeat. Set How many to choose from to 10, How many you pick to 4, Does the order matter to Yes, and Can you repeat an item to Yes.

The result is 10,000. That is ten to the power of four. Order matters because 1234 is a different code from 4321. Repeats are allowed because 1111 is a valid PIN.

Change the pick to 6 and the pool to 26 to model a six-letter password using only lowercase letters. The result jumps to over 308 million. Add digits by setting the pool to 36 and it rises above two billion. Add uppercase letters by setting it to 62 and the total climbs past 56 billion. Each extra character or each wider pool multiplies the count, which is why password advice always says to make them longer rather than merely more complex.

Symmetry and factorials

One surprising property of combinations is symmetry. Choosing 3 items from 10 gives the same count as choosing 7 from 10. Every group you pick defines a group you leave behind, and the two groups are just two views of the same split. When you need to do the arithmetic by hand, pick the smaller number and the multiplication is shorter.

Factorials grow with extraordinary speed. Ten factorial is 3,628,800. Twenty factorial is over two quintillion, a number larger than the count of seconds since the universe began. By 170 factorial the result is close to the largest number a browser can represent without rounding. The tool handles this smoothly, but it is worth knowing why the numbers get so large so fast. Each new item multiplies every arrangement that existed before it, which makes the growth explosive rather than gradual.

The combination formula divides out the factorial of the pick size, which is why combinations are always smaller than or equal to permutations for the same inputs. Dividing by that factorial removes all the rearrangements within each group, collapsing many permutations into one combination.

Common mistakes

The most frequent error is getting the order question wrong. If you are counting how many different committees of five can be formed from twelve people, order does not matter because a committee is a group, not a ranking. If you are counting how many ways to assign president, treasurer, and secretary from twelve people, order matters because the roles are distinct. Mixing the two up gives an answer that is off by a factor of the factorial of the pick size.

Another mistake is forgetting whether repeats are possible. Drawing cards from a deck is without replacement. Rolling a die three times is with replacement. Confusing the two changes the formula and the result.

A subtler trap is comparing odds with probability. A one in fourteen million probability is not the same as fourteen million to one odds. The odds figure is the ratio of losing outcomes to winning outcomes, which is one less than the total. Both are shown when the checkbox is ticked, so that you can quote whichever one your audience expects without accidentally using the wrong one.

Finally, be careful with the size of the pool. If a problem says the letters A through Z, the pool is 26. If it says the digits 0 through 9, the pool is 10, not 9, because zero counts. Off-by-one errors in the pool are easy to make and they quietly shift every result.

Privacy

Every calculation runs in your browser. No inputs and no results are sent to any server. There is no account, no login, and nothing stored between visits. Close the tab and everything is gone. The page works fully offline once it has loaded. Whether you are a student checking homework or a security analyst sizing up a password space, your numbers stay entirely on your own device.

Help

Counting the ways something can happen

Give it the size of the set and how many you are taking from it, then set the two switches: does the order they come out in count, and may the same item be picked twice. Those two answers are the whole difference between a combination and a permutation, and getting them the wrong way round is where most wrong figures come from. The count for the case you described follows.

Say how many there are and how many you take

Forty-nine lottery balls, six drawn. Ten runners, three places.

Decide whether order matters

Gold, silver and bronze are an order. A hand of cards is not.

Decide whether repeats are allowed

A dice roll can repeat a number; drawing balls from a bag cannot.

Read the answer and the odds

For the no-order, no-repeat case you also get the chance of matching a single specific pick, which is the lottery question.

Order matters far more than people expect

Picking 3 from 10 gives 120 possible groups if order does not matter, but 720 if it does — six times as many, because each group of three can be arranged six different ways. The gap widens fast: picking 6 from 49 gives just under 14 million combinations but over 10 billion permutations. Lottery odds are quoted using the smaller figure because the draw order is ignored, which is the single most important detail in the whole calculation and the one most often got wrong.

Good to know

Choosing 3 from 10 equals choosing 7 from 10

Every group you pick leaves a group behind, so the counts are identical. Use the smaller number to keep the arithmetic manageable.

Factorials get enormous immediately

Twenty things can be arranged in more ways than there are seconds since the universe began. Past about 170 the numbers exceed what a browser can hold, and the tool switches to scientific notation.

With repeats, order-matters is just a power

A four digit code from ten digits is ten to the fourth, ten thousand. No factorials needed.

Odds are not the same as probability

A one in fourteen million chance is odds of about 14 million to one against. Both are shown, because quoting the wrong one changes the meaning.

Common questions

What is the difference between a permutation and a combination?
A permutation counts arrangements, so order matters. A combination counts groups, so it does not. There are always more permutations.
How do I calculate the odds of winning the lottery?
Set the numbers to your draw — 6 from 49, say — with order not mattering and no repeats. The tool gives the number of combinations and the odds.
What does nCr mean?
The number of ways to choose r things from n when order does not matter. It is read as "n choose r".
How many ways can I arrange a word's letters?
For distinct letters it is the factorial of the length. Repeated letters reduce it, since swapping two identical letters changes nothing.
How many four digit PINs are there?
Ten thousand — four positions, ten digits, repeats allowed. Set order to matter and repeats to yes.