Skip to main content
ponderloop

Permutation and Combination Calculator

A permutation counts the ways to pick and arrange items when order matters, and a combination counts the ways to pick them when order does not. For 5 items taken 3 at a time, P(5, 3) = 60 permutations and C(5, 3) = 10 combinations. Allowing repetition gives 5³ = 125 ordered sequences and C(5 + 3 − 1, 3) = 35 unordered selections. The calculator uses exact big-integer arithmetic for n and r up to 5,000, so it gives every digit of a huge result along with its digit count and scientific notation, works the formula out with your numbers, and for small cases lists the arrangements themselves (letters A, B, C …).

Updated Runs in your browser: nothing you enter is uploadedHow this tool works

Whole numbers from 0 (for r) or 1 (for n) up to 5,000.

What are you counting?

Permutations without repetition

P(5, 3) = 60

60 ways to choose and arrange 3 items from 5, each used at most once.

Type
Permutations without repetition
Exact value
60
Digits
2
Scientific notation
6 × 10¹
E notation
6e+1
Check: C(n, r) × r!
10 × 6 = 60

The formula with your numbers

P(n, r) = n! ÷ (n − r)!

P(5, 3) = 5! ÷ (5 − 3)! = 5! ÷ 2!

Cancelling the common factors leaves the first 3 factors of 5!: 5 × 4 × 3

= 60

The full value

60

All 2 digits, no rounding.

All four counts for the same n and r

All four counts for the same n and r
CountFormulaResultDigits
Permutations without repetition (selected)P(5, 3)602
Combinations without repetitionC(5, 3)102
Permutations with repetition5³1253
Combinations with repetitionC(7, 3)352

The arrangements

All 60 arrangements, in dictionary order. The letters A to E stand for the items.

  • ABC
  • ABD
  • ABE
  • ACB
  • ACD
  • ACE
  • ADB
  • ADC
  • ADE
  • AEB
  • AEC
  • AED
  • BAC
  • BAD
  • BAE
  • BCA
  • BCD
  • BCE
  • BDA
  • BDC
  • BDE
  • BEA
  • BEC
  • BED
  • CAB
  • CAD
  • CAE
  • CBA
  • CBD
  • CBE
  • CDA
  • CDB
  • CDE
  • CEA
  • CEB
  • CED
  • DAB
  • DAC
  • DAE
  • DBA
  • DBC
  • DBE
  • DCA
  • DCB
  • DCE
  • DEA
  • DEB
  • DEC
  • EAB
  • EAC
  • EAD
  • EBA
  • EBC
  • EBD
  • ECA
  • ECB
  • ECD
  • EDA
  • EDB
  • EDC

The four formulas

Each result is computed by the calculator above for n = 10 and r = 3.
CountOrder matters?Repeats allowed?Formulan = 10, r = 3
PermutationsYesNoP(n, r) = n! ÷ (n − r)!720
CombinationsNoNoC(n, r) = n! ÷ (r! × (n − r)!)120
Permutations with repetitionYesYesn^r1,000
Combinations with repetitionNoYesC(n + r − 1, r)220

Everyday counts

Which of the four formulas fits, and the exact answer. Very large results are shown in scientific notation with their digit count.
SituationWhy this formulaNotationCount
Awards for 1st, 2nd and 3rd place among 8 runnersOrder matters, nobody places twiceP(8, 3)336
A committee of 3 chosen from 8 peopleOrder ignored, no repeatsC(8, 3)56
A 4-digit PINOrder matters, digits repeat10⁴10,000
A 5-card poker hand from 52 cardsOrder ignored, no repeatsC(52, 5)2,598,960
A 6-number lottery draw from 49 ballsOrder ignored, no repeatsC(49, 6)13,983,816
An 8-letter lowercase passwordOrder matters, letters repeat26⁸208,827,064,576
A scoop of 3 flavours from 5, repeats allowedOrder ignored, repeats allowedC(7, 3)35
Shuffling a 52-card deckAll 52 in order: P(52, 52) = 52!P(52, 52)8.06582 × 10⁶⁷ (68 digits)

Pascal’s triangle: C(n, r) for small n

Row n lists C(n, 0) to C(n, n). Each entry is the sum of the two above it, and each row is symmetric because C(n, r) = C(n, n − r).
nC(n, r) for r = 0, 1, … n
01
11, 1
21, 2, 1
31, 3, 3, 1
41, 4, 6, 4, 1
51, 5, 10, 10, 5, 1
61, 6, 15, 20, 15, 6, 1
71, 7, 21, 35, 35, 21, 7, 1
81, 8, 28, 56, 70, 56, 28, 8, 1

How to calculate permutations and combinations

  1. Decide whether order matters. If picking A then B differs from picking B then A (a podium, a PIN, a password), you want permutations. If only the group matters (a committee, a poker hand, a lottery draw), you want combinations. With 4 items taken 2 at a time there are 12 ordered pairs but only 6 groups.
  2. Decide whether items can repeat. If the same item can be used again (a digit in a PIN, a flavour in a scoop), allow repetition. If each item is used at most once (runners on a podium, cards in a hand), do not. Without repetition r cannot exceed n.
  3. Enter n and r. n is how many items you choose from and r is how many you pick. For 8 runners and 3 medals, n = 8 and r = 3. Both can be up to 5,000.
  4. Read the formula with your numbers. Permutations without repetition multiply r descending factors: 8 × 7 × 6 = 336 for 8 runners and 3 medals. Combinations divide that by r! because every group of r items was counted r! times: C(5, 3) = 60 ÷ 6 = 10.
  5. List the arrangements to check. Tick the list option to see them. For 4 items and 2 at a time the ordered pairs begin AB, AC, AD, BA, BC and the groups are AB, AC, AD, BC, BD, CD. Lists stop at 300 entries and work for n up to 26 and r up to 10.

Frequently asked questions

What is the difference between a permutation and a combination?
Order. A permutation is an ordered arrangement, so ABC and CBA are different; a combination is a group, so they are the same. From 5 items taking 3, there are 60 permutations and 10 combinations, and the ratio is 3! = 6, the number of ways to order any one group.
What are the formulas for nPr and nCr?
nPr = n! ÷ (n − r)! and nCr = n! ÷ (r! × (n − r)!). For n = 10 and r = 3, nPr = 10 × 9 × 8 = 720 and nCr = 720 ÷ 3! = 120. Both need 0 ≤ r ≤ n.
How do permutations and combinations with repetition work?
With repetition each of the r positions can be any of n items, so ordered sequences number n^r, for example 10⁴ = 10,000 four-digit PINs. Unordered selections with repetition number C(n + r − 1, r), the “stars and bars” count: C(7, 3) = 35 ways to take 3 scoops from 5 flavours. Here r may be larger than n.
What is 0! and what are nP0 and nC0?
0! is defined as 1, so nP0 = nC0 = 1 for every n: there is exactly one way to pick nothing. Likewise nPn = n! and nCn = 1. This calculator accepts r = 0 and shows 1 with an empty list entry.
Why is nCr the same as nC(n − r)?
Choosing the r items to take is the same as choosing the n − r items to leave behind. For example C(52, 5) and C(52, 47) are both 2,598,960. The calculator uses the smaller side to keep the working short.
How many 5-card poker hands are there?
2,598,960, which is C(52, 5): order does not matter and a card cannot be dealt twice. If order did matter it would be P(52, 5) = 311,875,200.
How many ways can a deck of 52 cards be ordered?
52! = P(52, 52), which has 68 digits and is about 8.06582 × 10⁶⁷. That is why a well-shuffled deck is almost certainly in an order that has never occurred before. The calculator shows all 68 digits.
What are the chances in a 6-from-49 lottery?
There are C(49, 6) = 13,983,816 possible draws, so one ticket has a 1 in 13,983,816 chance of matching all six, provided the order the balls come out does not matter.
Why does the result switch to scientific notation?
Counts grow fast: 30! is already 2.65253 × 10³², with 33 digits. Results of 15 digits or fewer are shown in full in the headline; longer ones show the first six significant digits as scientific notation and the digit count, and the full-value block shows every digit (the first 2,000 for very long ones; Copy result copies them all).
How big can n and r be?
Up to 5,000 each. The arithmetic uses exact BigInt integers, so nothing is rounded: even 5000 raised to the power 5000 is computed digit for digit (18,495 digits). The cap only keeps the page fast.
Can the calculator list the actual arrangements?
Yes, for n up to 26 and r up to 10. The items are the letters A, B, C … and the results appear in dictionary order, up to 300 at a time. For 4 items taken 2 at a time without repetition the 12 permutations begin AB, AC, AD, BA; the 6 combinations are AB, AC, AD, BC, BD, CD.
Why can’t r be larger than n without repetition?
Each item can be used only once, so you cannot pick more items than you have. Mathematically nPr and nCr are 0 in that case, and the calculator asks you to lower r or allow repetition instead. With repetition r can exceed n, as in 26⁸ for an 8-letter password from 26 letters (208,827,064,576 possibilities).

How it works

Everything is computed with exact BigInt integers, so no result is rounded and no digit is lost. Permutations without repetition multiply the r factors n × (n − 1) × … × (n − r + 1). Combinations use the smaller of r and n − r and build up C(n, k) one factor at a time, dividing exactly at every step, which equals n! ÷ (r! × (n − r)!) without ever forming the full factorials. Permutations with repetition are n raised to the power r (0^0 counts as 1), and combinations with repetition are C(n + r − 1, r), the multiset coefficient (“stars and bars”). The digit count is the length of the exact decimal value; scientific notation keeps six significant digits, rounded half up, and the E notation is the same value written for spreadsheets. n must be at least 1 and r at least 0, both at most 5,000. Without repetition r may not exceed n. The lists use the letters A to Z in dictionary order and stop after 300 entries. Everything runs in your browser and nothing you type is sent anywhere.

Sources

More: Algebra and number theoryAll math & numbersAll toolsHome & DIY calculators