Home › Math & Science › Permutation Calculator

Permutation Calculator

Use this free permutation calculator to count arrangements and selections in seconds. Enter how many items you have (n) and how many you choose (r), pick a mode, and it shows the permutation nPr, the combination nCr, permutations with repetition, or the factorial n! — with the working shown step by step.

n and r must be whole numbers. n is capped at 170 so factorials stay exact.

10P3 = 720
10! ÷ (10 − 3)! = 3,628,800 ÷ 5,040 = 720
ValueResult
Permutation nPr720
Combination nCr120
With repetition n^r1,000
Factorial n!3,628,800

How it works

Counting problems start with two numbers. The letter n stands for the total number of items you have, and r stands for how many of them you pick, arrange, or choose at a time. Everything else follows from one question: does the order of the picks matter? If you are setting a three-digit lock code, the order matters — 123 is not the same code as 321. If you are choosing three people for a committee, the order does not matter — the same three people form the same committee no matter who was named first. That single distinction decides which formula to use.

A permutation counts arrangements where order matters. The formula is nPr = n! ÷ (n − r)!. The exclamation mark means factorial: n! is n multiplied by every whole number below it, down to 1. So 5! is 5 × 4 × 3 × 2 × 1, which is 120. The formula works because the first slot can be filled in n ways, the second in n − 1 ways, the third in n − 2 ways, and so on for r slots. Multiplying those choices gives n × (n − 1) × … × (n − r + 1), which is exactly what n! ÷ (n − r)! computes. When r equals n, you are arranging every item, and nPr becomes n! itself.

nPr = n! ÷ (n − r)!  |  nCr = n! ÷ (r! × (n − r)!)  |  n^r (with repetition)  |  n! = 1 × 2 × … × n

A combination counts selections where order does not matter. Its formula is nCr = n! ÷ (r! × (n − r)!). It starts from the permutation count and then divides by r!, the number of ways to rearrange the r chosen items among themselves. Those rearrangements all describe the same group, so they must be counted once, not r! times. That is why combinations are always smaller than permutations for the same n and r — unless r is 0 or 1, where the two counts agree. A handy symmetry to remember: choosing r items to keep is the same as choosing n − r items to leave out, so nCr always equals nC(n − r). Choosing 3 out of 10 gives the same count as choosing 7 out of 10.

Permutation with repetition covers the case where each item can be picked again. A four-digit PIN uses this rule: each of the four positions has 10 choices, so there are 10^4 = 10,000 possible PINs. The formula is simply n^r, because every one of the r positions has the full n choices available. Finally, the factorial mode just computes n! on its own. Factorials show up everywhere in counting — in permutations, in combinations, and in probability — and they grow astonishingly fast. 10! is already 3,628,800, 20! is about 2.43 × 10^18, and 170! is roughly 7.26 × 10^306, close to the largest number a computer can store exactly. That is why this calculator caps n at 170: beyond that, the factorial overflows and the answer would be meaningless.

To use the calculator, pick the mode that matches your question, enter n and r as whole numbers, and read the result. The table underneath also shows all four values at once, so you can compare the permutation and combination counts for the same inputs. If r is larger than n, the calculator tells you plainly that you cannot choose more items than you have, instead of showing a confusing error. Negative numbers, decimals, and empty fields get the same friendly treatment.

Worked example

How many ways can you arrange 3 books chosen from a shelf of 10, and how many ways can you simply choose 3 books?

Step 1: Identify n and r. There are 10 books in total, so n = 10, and we pick 3, so r = 3.
Step 2: For the arrangement, order matters, so use the permutation formula: 10P3 = 10! ÷ (10 − 3)! = 10! ÷ 7!.
Step 3: Expand the factorials: 10! = 3,628,800 and 7! = 5,040. Divide: 3,628,800 ÷ 5,040 = 720. Or multiply directly: 10 × 9 × 8 = 720.
Step 4: For the selection, order does not matter, so use the combination formula: 10C3 = 10! ÷ (3! × 7!) = 3,628,800 ÷ (6 × 5,040) = 3,628,800 ÷ 30,240 = 120.
Step 5: If the books could be picked again — for example, picking a book, noting it, and putting it back — the count would be 10^3 = 1,000.

So there are 720 ways to arrange 3 books from 10, but only 120 ways to choose 3 books. The permutation count is exactly 6 times larger, and 6 is 3!, the number of ways to shuffle the 3 chosen books. Enter n = 10 and r = 3 in the calculator above and you will get the same numbers: nPr = 720, nCr = 120, n^r = 1,000, and 10! = 3,628,800.

FAQ

What is the difference between a permutation and a combination?

In a permutation, the order matters: picking A then B is different from picking B then A. In a combination, the order does not matter: A and B together are the same group either way. That is why there are always more permutations than combinations for the same n and r.

When should I use permutations with repetition?

Use permutations with repetition when each choice can be picked again, such as a lock code where digits can repeat, or a password where each character can be reused. The count is n to the power of r. If each item can be used only once, use the ordinary permutation nPr instead.

What is a factorial?

The factorial of a whole number n, written n!, is the product of every whole number from 1 up to n. For example, 5! equals 5 × 4 × 3 × 2 × 1, which is 120. By definition, 0! equals 1.

Why is n capped at 170 in this calculator?

Factorials grow extremely fast, and 171! is larger than the biggest number JavaScript can store, so it overflows to Infinity. The cap of 170 keeps every answer exact and readable. For larger problems, use the combination formula, which cancels most of the factorial before multiplying.

What does nPr mean when r equals n?

When r equals n, you are arranging every item, so nPr equals n! — the factorial of n. For example, 5P5 equals 5!, which is 120. Likewise, nCr equals 1 when r equals n, because there is only one way to choose all the items.