Solved.tools: Free Online Calculators & Tools

We use cookies for analytics and advertising. Learn more about our cookie policy

Permutation & Combination Calculator

Last updated: 9 August 2026

Reviewed by Gavin Meiring, Lead research and primary author ยท Doctoral Candidate (Corporate Governance) ยท Research and drafting assisted by AI

Was this helpful?


Permutation & Combination Calculator

Calculate permutations (nPr) and combinations (nCr) instantly. Enter the total number of items (n) and how many you are selecting (r), and the calculator shows both the permutation and combination results with full working. Permutations and combinations are the two fundamental ways to count selections from a set, and they underpin everything from lottery odds to password security to tournament brackets.

What is the Difference?

  • Permutations (nPr), order matters. Arranging 3 people in a line from a group of 5 is a permutation: 5P3 = 60. The arrangement ABC is considered different from the arrangement CBA because the ordering of the three people differs. Permutations count every possible ordering of the selected items as a distinct outcome.
  • Combinations (nCr), order does not matter. Picking 3 people for a team from a group of 5 is a combination: 5C3 = 10. The set containing persons A, B, and C is identical to the set containing C, B, and A because the team membership is the same regardless of the order in which you list the names. Combinations count only which items were chosen, not how they are arranged.

A helpful way to remember: permutations are for situations where every position or role is different (president, vice-president, secretary). Combinations are for situations where all positions are equal (team members, lottery numbers, committee members).

Formula

The formulas rely on factorials. The factorial of n, written n!, is the product of all positive integers from 1 up to n. So 5! = 5 ร— 4 ร— 3 ร— 2 ร— 1 = 120. By convention, 0! is defined as 1, which makes the boundary cases work out cleanly.

Permutations: nPr = n! / (n โˆ’ r)!

This formula makes intuitive sense: you have n choices for the first position, (nโˆ’1) choices for the second position, (nโˆ’2) for the third, and so on, until you have filled r positions. That product n ร— (nโˆ’1) ร— ... ร— (nโˆ’r+1) equals n! / (nโˆ’r)! when written in factorial form.

Combinations: nCr = n! / (r! ร— (n โˆ’ r)!)

Another way to derive this: nCr = nPr / r!, combinations are just permutations divided by the number of ways to arrange the r selected items amongst themselves. Since order does not matter in combinations, all r! arrangements of the same set of r items must be collapsed into a single count.

You can also compute combinations without computing full factorials using the multiplicative formula: nCr = [n ร— (nโˆ’1) ร— ... ร— (nโˆ’r+1)] / r!. This is more efficient for large n because you multiply r terms and divide by r! rather than computing n! which grows astronomically fast.

Worked Examples

Example 1: Committee with Roles

A club has 10 members. They need to select a president, a vice-president, and a secretary. Each role is distinct, so order matters. How many ways?

n = 10, r = 3

10P3 = 10! / (10โˆ’3)! = 10! / 7! = 10 ร— 9 ร— 8 = 720

There are 720 different ways to assign the three positions. For comparison, if all three positions were equal (just a 3-person subcommittee), there would be only 10C3 = 120 ways, exactly 3! = 6 times fewer because the 6 possible orderings of the three officers are collapsed into one.

Example 2: Lottery Odds

In a typical 6-from-49 lottery, you choose 6 numbers from a pool of 49. Order does not matter, whether your ticket reads 1-2-3-4-5-6 or 6-5-4-3-2-1, it is the same ticket. How many possible tickets?

49C6 = 49! / (6! ร— 43!) = (49 ร— 48 ร— 47 ร— 46 ร— 45 ร— 44) / (6 ร— 5 ร— 4 ร— 3 ร— 2 ร— 1) = 13,983,816

Your odds of matching all 6 numbers and winning the jackpot are 1 in 13,983,816. For context, if order mattered (permutations), there would be 49P6 = 10,068,347,520 possible tickets, but since ticket numbers are always sorted or treated as a set, the combination count is the relevant one.

Example 3: PIN Codes

A 4-digit PIN using the digits 0 through 9, with no digit repeated. How many possibilities?

10P4 = 10! / 6! = 10 ร— 9 ร— 8 ร— 7 = 5,040

If repeats are allowed (as most real PINs permit), the count is 10โด = 10,000 because each position has 10 independent choices. Permutations are only applicable when items cannot be reused, each digit can appear at most once in the code.

Example 4: Poker Hands

A poker hand consists of 5 cards drawn from a standard 52-card deck. The order in which the cards are dealt is irrelevant, a hand is a combination, not a permutation. How many possible hands?

52C5 = 52! / (5! ร— 47!) = 2,598,960

This is why a royal flush (4 possible hands) has probability 4/2,598,960 โ‰ˆ 1 in 649,740. The denominator is always 52C5 because every hand is equally likely when cards are well-shuffled.

Key Properties

PropertyFormulaExplanation
Choose all itemsnPn = n!Arranging every item in some order, there are n! ways to permute n distinct items
Choose nonenC0 = nP0 = 1Exactly one way to select nothing, the empty set
Choose exactly onenC1 = nP1 = nThere are n singleton subsets
Symmetry of combinationsnCr = nC(nโˆ’r)Choosing r items is equivalent to leaving (nโˆ’r) items behind
Pascal's identitynCr = (nโˆ’1)C(rโˆ’1) + (nโˆ’1)CrForms Pascal's triangle; used in binomial expansion

Frequently Asked Questions

What is a factorial and why is 0! equal to 1? The factorial of n, written n!, is the product of all positive integers from 1 to n. For example, 5! = 5 ร— 4 ร— 3 ร— 2 ร— 1 = 120. Zero factorial is defined as 1 by convention because it makes combinatorial formulas work correctly, there is exactly one way to arrange zero items (do nothing), and nC0 = n! / (0! ร— n!) must equal 1, which only works if 0! = 1.

Why does nCr always give a smaller number than nPr? Because nPr counts each arrangement of the r selected items as a separate outcome, while nCr treats all r! possible arrangements of the same set of r items as identical. The relationship is nCr = nPr / r!, so combinations are always smaller by a factor of r! (except when r = 0 or r = 1, where r! = 1 and they are equal).

What happens when r is greater than n? If you try to select more items than are available, the result is 0, it is impossible to choose r items from a set of n when r > n. Both nPr and nCr are defined as 0 in this case because there are no valid selections.

Can n and r be equal? Yes, selecting all available items. nPn = n! because you are arranging every item in some order (every permutation of the full set). nCn = 1 because there is exactly one way to select everything, take the whole set.

What is the largest n this calculator handles? The calculator handles n up to 1,000. Beyond that, factorial values become astronomically large, 1,000! has over 2,500 decimal digits. The JavaScript BigInt type used internally can handle the computation, but displaying numbers with thousands of digits is impractical for a web tool.

How are permutations and combinations used in real life? Combinatorics appears everywhere. Cryptography uses it to calculate key-space sizes, a 256-bit key has 2ยฒโตโถ possible values. Genetics uses it to count DNA sequence possibilities. Quality control uses sampling plans based on hypergeometric distributions. Network engineers calculate routing possibilities in mesh networks. Tournament organisers use it to design round-robin schedules. Even the number of possible chess positions after just a few moves is a combinatorial explosion.

What is the relationship between permutations, combinations, and probability? Probability of an event = (number of favourable outcomes) / (total number of possible outcomes). Both the numerator and denominator are often counted using permutations or combinations. For example, the probability of being dealt a specific poker hand = 1 / 52C5 โ‰ˆ 1 in 2.6 million. The entire field of discrete probability is built on combinatorial counting.

What is Pascal's Triangle and how does it relate to combinations? Pascal's Triangle is a triangular array where each entry is the sum of the two entries above it. The entry in row n, position r (0-indexed) equals nCr. The rows give the coefficients of the binomial expansion (a + b)โฟ, and the triangle encodes identities like the symmetry property (nCr = nC(nโˆ’r)) and Pascal's identity (nCr = (nโˆ’1)C(rโˆ’1) + (nโˆ’1)Cr).

References