Permutation and Combination Calculator

Count the ways to choose or arrange r items from n, whether or not order matters and whether items can repeat, with exact answers for very large numbers.

Your results

–

Save this calculation and come back to it any time. Members only — $5 every 3 months, ad-free.

Become a member

How to use the permutation and combination calculator

  1. Enter n, the total number of items to pick from.
  2. Enter r, how many you pick.
  3. Choose whether order matters. If picking A then B is different from picking B then A, it's a permutation; if not, it's a combination.
  4. Tick repetition allowed if the same item can be picked more than once, like digits in a PIN.
  5. Read the answer, the working, and all four counts side by side. For n up to 30, a table lists every value of r.

The formulas

Permutations P(n, r) = n! ÷ (n − r)! Combinations C(n, r) = n! ÷ (r! × (n − r)!) Permutations, repetition nʳ Combinations, repetition C(n + r − 1, r)

n! ("n factorial") means n × (n − 1) × (n − 2) × … × 1, and 0! is defined as 1. A permutation counts ordered arrangements, so it starts at n choices for the first position, n − 1 for the second and so on, for r positions. A combination divides that by r!, the number of orders the same r items could appear in, because the order no longer counts. With repetition, every position has all n choices, giving nʳ arrangements; the combination version is the "stars and bars" count C(n + r − 1, r).

Worked example

The calculator starts with n = 10 and r = 3, such as picking 3 people from a group of 10:

  • Permutations (a president, a secretary and a treasurer): 10 × 9 × 8 = 720
  • Combinations (a committee of 3 with no roles): 720 ÷ 3! = 720 ÷ 6 = 120
  • With repetition, ordered (a 3-digit code from 10 digits): 10³ = 1,000
  • With repetition, unordered (3 scoops from 10 flavors, repeats allowed): C(12, 3) = 220

Every committee of 3 can be given roles in 3! = 6 ways, which is why the permutation count is exactly 6 times the combination count.

Which one do I need?

Situation Order matters? Repetition? Count
5-card poker hands from 52 cards No No C(52, 5) = 2,598,960
Lottery: 6 numbers from 49 No No C(49, 6) = 13,983,816
Gold, silver, bronze among 8 runners Yes No P(8, 3) = 336
4-digit PIN Yes Yes 10⁴ = 10,000
3 donuts from 6 kinds No Yes C(8, 3) = 56
Ways to shuffle a deck Yes No 52! ≈ 8.065818 × 10⁶⁷

A quick test: if swapping two of the chosen items gives a different outcome, order matters. Swapping two cards in a poker hand changes nothing; swapping the gold and silver medalists does.

Very large numbers

Factorials grow fast: 20! is already 2,432,902,008,176,640,000, and 52! has 68 digits. The calculator uses exact whole-number arithmetic, so results are never rounded until it shows them. Up to 24 digits, you see the full number. Longer results appear in scientific notation, with every digit in a box below that you can copy. Above 3,000 digits, it shows a scientific-notation estimate accurate to about 7 significant figures, calculated with logarithms.

Frequently asked questions

What is the difference between a permutation and a combination?

A permutation is an arrangement where order matters, such as a race finish or a password. A combination is a selection where order doesn't matter, such as a hand of cards or a pizza topping choice. For the same n and r, there are always at least as many permutations as combinations.

Why is C(n, r) equal to C(n, n − r)?

Choosing which r items to take is the same as choosing which n − r items to leave behind. Picking 3 people out of 10 for a committee is the same decision as picking the 7 who aren't on it, so C(10, 3) and C(10, 7) are both 120.

What does 0! equal?

0! equals 1. There is exactly one way to arrange no items: do nothing. This definition also makes the formulas work at the edges, so C(n, 0) and C(n, n) both equal 1.

How are combinations used in probability?

Many probabilities are favorable combinations divided by total combinations. The chance of matching all 6 lottery numbers from 49 is 1 in C(49, 6), about 1 in 14 million. The probability calculator uses C(n, k) in its binomial mode.

Related calculators

  • Probability Calculator — P(A and B), P(A or B) and P(not A) for independent events, at least one success in n tries, and binomial odds.
  • Factor Calculator — Every factor and factor pair of a whole number, with the count, the sum and prime, perfect or abundant checks.
  • Big Number Calculator — Exact arithmetic on whole numbers with hundreds or thousands of digits: add, multiply, divide, powers, factorials and GCD.

Results are calculated in your browser. Double-check anything important before you rely on it. See our disclaimer.