↑↓ to move ↵ to open Esc to close Browse all tools

Combinations and Permutations Calculator

Enter n and r to count the ways to choose or arrange items, with or without repetition. You get the exact number, the formula with your numbers and a list of the selections.

Your numbers

0 to 100,000
0 to 10,000
Does the order matter?
Can an item be picked more than once?
Examples
Combinations without repetition
C(10, 3)

Combinations, C(n, r)
Permutations, P(n, r)
Combinations with repetition
Permutations with repetition, nr

Formula with your numbers

    The selections

    Separate with commas. Their number sets n. Left empty, items are A, B, C… or 1, 2, 3….

      Odds of matching drawn numbers

      A draw takes some numbers from a pool and you pick the same count. Every set of numbers is assumed equally likely.

      One extra number from a separate pool
      Chance of matching every number

      Runs on your device. Nothing you enter is sent to a server.

      Combinations and Permutations Calculator by Freebiefy, free online tools

      Embed this tool on your site

      Paste this code into your page. The tool runs in the visitor's browser, free and without signup. The height adjusts to the content. All tools you can embed

      Combination or permutation: two questions

      Every counting problem of this kind comes down to two questions. Does the order of the chosen items matter? And can the same item be picked more than once? The answers pick one of four formulas:

      No repetitionWith repetition
      Order does not matter (combinations)n! ÷ (r! (n − r)!)(n + r − 1)! ÷ (r! (n − 1)!)
      Order matters (permutations)n! ÷ (n − r)!nr

      Here n is the number of items to choose from and r is how many you take. The exclamation mark is the factorial: 5! = 5 × 4 × 3 × 2 × 1 = 120, and 0! = 1. The combination count is also written as nCr, C(n, r) or "n choose r", and the permutation count as nPr or P(n, r).

      Examples of all four

      • Combination: a five-card hand from a 52-card deck. The order you get the cards in does not change the hand, and no card comes twice: C(52, 5) = 2,598,960 hands.
      • Permutation: gold, silver and bronze among 8 runners. Order matters, and nobody can win two medals: P(8, 3) = 8 × 7 × 6 = 336.
      • Permutation with repetition: a 4-digit PIN. Order matters and digits may repeat: 104 = 10,000.
      • Combination with repetition: 3 scoops from 5 flavors, where you may take the same flavor twice and the order in the cup does not matter: C(7, 3) = 35.

      Why the formulas work

      Start with permutations. For the first spot there are n choices, for the second n − 1, and so on for r spots: P(10, 3) = 10 × 9 × 8 = 720. Written with factorials that is 10! ÷ 7!, because the factors from 7 down to 1 cancel.

      A combination ignores order. Each group of 3 items can be put in order in 3! = 6 ways, so every combination was counted 6 times among the permutations. Divide by r!: C(10, 3) = 720 ÷ 6 = 120. The same reasoning gives the general rule C(n, r) = P(n, r) ÷ r!.

      Choosing r items to take is the same as choosing n − r items to leave, so C(10, 7) = C(10, 3). The calculator uses that to keep the filled-in formula short. For combinations with repetition, the "stars and bars" argument turns each selection into an arrangement of r stars and n − 1 bars, which gives C(n + r − 1, r).

      Exact results, even with hundreds of digits

      Counts get large fast. Standard double-precision floating-point numbers keep only about 15 to 17 significant digits and round the rest, and the largest one is about 1.8 × 10308. This calculator uses whole numbers of any length, so C(100, 50) comes out as all 30 of its digits and P(1000, 500) as all 1,434 of its digits. Long results also get a short form like 1.0089 × 1029, and the full number appears in a box you can scroll and copy.

      From counts to odds

      When every selection is equally likely, the probability of one particular selection is 1 divided by the count. A draw of 6 numbers from 49 has C(49, 6) = 13,983,816 possible results, so one ticket matches all six with a chance of 1 in 13,983,816. Matching fewer numbers is more likely, because many draws share part of your ticket:

      Matches out of 6Draws that give itChance
      611 in 13,983,816 (0.00000715%)
      52581 in 54,200.8 (0.00184%)
      413,5451 in 1,032.4 (0.0969%)
      3246,8201 in 56.7 (1.77%)
      21,851,1501 in 7.6 (13.2%)

      The numbers 6 and 49 are an example. Draws differ in pool size, numbers drawn, bonus balls and prize tiers, so use the odds tool above with the numbers from the official rules of the game you are looking at.

      How to use the combinations and permutations calculator

      1. 1Enter the total number of items n and how many you choose, r. Or type item names, and n becomes the number of names.
      2. 2Say whether the order matters and whether items can repeat. The big number is the count for your case, and the four tiles show all four cases at once.
      3. 3Follow the formula with your numbers, scroll through the list of selections, or work out drawing odds below. Copy the result or a link with your numbers.

      Frequently asked questions

      What is the difference between a combination and a permutation?

      In a combination only the members count: choosing A, B and C is the same as choosing C, B and A. In a permutation the order counts too, so ABC and CBA are two different arrangements. That is why there are always at least as many permutations as combinations: P(n, r) = C(n, r) × r!.

      What does "with repetition" mean?

      An item can be picked more than once. A 4-digit PIN allows repeated digits, so 1111 is allowed, and there are 10⁴ = 10,000 PINs. Choosing 3 scoops from 5 ice cream flavors where two or three scoops may be the same flavor is a combination with repetition: C(5 + 3 − 1, 3) = 35.

      Why does the calculator show such long numbers?

      It counts exactly, with whole numbers of any size, instead of standard floating-point numbers, which keep only about 15 to 17 significant digits. C(100, 50) has 30 digits and every one of them is right. Very long results also get a short form in scientific notation, and Copy result copies all the digits.

      What is C(n, r) when r is bigger than n?

      Without repetition it is 0: you cannot choose 6 different items from only 5. With repetition there is no such limit, because items can come back, so 3 picks from 2 items with repetition still give 4 combinations and 8 permutations.

      How are the lottery-style odds worked out?

      If a draw takes k numbers from a pool of n and every set is equally likely, there are C(n, k) possible draws and exactly one matches your ticket. The chance of matching exactly m of your numbers is C(k, m) × C(n − k, k − m) ÷ C(n, k). A separate bonus pool multiplies the number of possible draws by its size. Check the official rules of a specific game before relying on any figure, since prize tiers differ.

      Why is the list cut off?

      Lists grow very fast: 52 choose 5 already has 2,598,960 entries. The calculator shows the first 300 selections in order, which is enough to see the pattern, and says how many there are in total. Copy list copies the shown entries.