Permutation and Combination Calculator
Calculators · Added
Choose whether order matters and whether items may repeat, enter n and r, and this calculator gives the exact count with the formula written out beneath it. The arithmetic is done in arbitrary-precision integers rather than floating point, so results stay exact well past the point where an ordinary calculator starts quietly rounding.
How to use the permutation and combination calculator
- 1Pick the mode: nPr when order matters, nCr when it does not, and the repetition variants when an item may be used more than once.
- 2Read the sentence under the mode switch — it describes the kind of question that mode answers, which is usually quicker than recalling the definitions.
- 3Enter n, the number of things available, and r, the number you take.
- 4Press Count. The headline is the answer; the rows beneath show the general formula and the same formula with your numbers in it.
- 5For very large results the headline switches to scientific notation and reports how many digits the exact answer has.
Examples
A hand of cards
- Input
- nCr with n = 52, r = 5
- Result
- 2,598,960
The number of distinct five-card poker hands. Order does not matter, because a hand is the same hand however it was dealt.
Podium finishes
- Input
- nPr with n = 8, r = 3
- Result
- 336
Eight runners, three medals. Order matters here — gold and silver swapped is a different outcome.
A four-digit PIN
- Input
- Permutations with repetition, n = 10, r = 4
- Result
- 10,000
Each of the four positions is filled independently from all ten digits, so it is 10⁴ rather than a shrinking product.
Scoops from a tub
- Input
- Combinations with repetition, n = 3, r = 6
- Result
- 28
Six scoops from three flavours, repeats allowed and order irrelevant. Note that r is larger than n, which only the repetition modes permit.
About the permutation and combination calculator
The four questions this covers, and how to tell them apart
Nearly every counting problem of this shape reduces to two yes-or-no questions: does order matter, and may an item be used more than once. Answer both and the formula is determined. Order matters and no repetition gives nPr; order irrelevant and no repetition gives nCr; order matters with repetition gives nʳ; order irrelevant with repetition gives the multiset coefficient.
The mistakes are almost always in the first question rather than the arithmetic. A lock that opens with 1-2-3 but not 3-2-1 is a permutation, whatever it is called in ordinary speech. A set of lottery numbers drawn in any sequence is a combination, even though the balls come out in a definite order. It is worth deciding what would count as a different outcome before reaching for a formula.
The second question is easier but more often forgotten. Sampling with replacement — a die rolled repeatedly, a character allowed to reappear in a password — permits repetition. Dealing cards from one deck does not.
Why factorials get astronomically large so quickly
Factorial growth outpaces exponential growth, and the numbers involved defeat intuition almost immediately. There are 52! ways to shuffle a deck of cards — a number with 68 digits. Since far fewer than 10^68 shuffles have ever been performed by anyone, a properly shuffled deck has in all likelihood never previously existed in that exact order.
This is also why the formulas are never evaluated the way they are written. Computing nCr as n! divided by r!(n − r)! means building two enormous numbers and dividing most of them away again. This tool multiplies the answer up one factor at a time instead, dividing as it goes, which keeps every intermediate value near the size of the result. The answer is identical; the work is a fraction of it.
The practical consequence for anyone using a spreadsheet or a pocket calculator is worth knowing: exact integer arithmetic typically runs out at 18!, and from 19! upward the last few digits of any large count are decoration. If the exact integer matters — and in combinatorics it usually does — check what your tool is actually computing with.
Frequently asked questions
When do I use nPr and when do I use nCr?
Why is nCr always smaller than nPr?
Can r be larger than n?
Are the results exact for large numbers?
What is the stars-and-bars formula?
Related tools
Scientific Calculator
Calculators
A full scientific calculator with trigonometry, logarithms, powers and memory keys.
LCM and HCF Calculator
Calculators
Find the highest common factor and lowest common multiple of two or more numbers, with the factorisation shown.
Random Number Generator
Developer Tools
Draw whole or decimal numbers in any range, with or without repeats, from the browser secure RNG.