Combinations and Permutations Calculator
Count how many ways you can choose or arrange items, covering all four cases: order matters or not, and repetition is allowed or not. Answer two quick questions about your scenario and the calculator picks the right formula automatically.
Describe your scenario
Four questions that are really just two questions
Every counting problem in this space comes down to two yes-or-no questions. Does order matter? And can items repeat? Answering both narrows you down to exactly one of four formulas, and most of the difficulty in combinatorics problems is misreading which two answers apply, not the arithmetic itself.
| Order matters? | Repetition allowed? | Name | Formula |
|---|---|---|---|
| No | No | Combination | C(n,r) = n! / (r!(n−r)!) |
| Yes | No | Permutation | P(n,r) = n! / (n−r)! |
| Yes | Yes | Permutation with repetition | nr |
| No | Yes | Combination with repetition | C(n+r−1, r) |
The four formulas explained
A worked example: the birthday problem
Here's a famous combinatorics result that surprises almost everyone the first time they see it. In a room of just 23 people, there's better than a 50% chance that two of them share a birthday. That number feels far too small for 365 possible birthdays, but it comes directly from a permutation-with-repetition style calculation.
Rather than calculating the chance of a match directly, it's easier to calculate the chance of no match at all, then subtract from 1. The first person can have any birthday, 365/365. The second person must differ from the first, 364/365. The third must differ from both, 363/365, and so on down to the 23rd person, 343/365. Multiply all 23 fractions together and you get roughly 0.493, the probability of no shared birthday at all. Subtract that from 1: about 50.7% chance that at least two people do share a birthday.
The reason this feels wrong is that people intuitively think about their own birthday matching someone else's, which is a much rarer event. The actual question is whether any pair among 23 people matches, and with 23 people there are 253 different pairs to check, which is where the surprisingly high probability comes from.
Mistakes people make with combinations and permutations
Using nCr when order actually matters. If the problem describes assigning distinct roles, ranks, or positions, even from the same pool of people, you need nPr, not nCr. "Choose a president and a treasurer from 10 candidates" is a permutation, since the two roles are different, even though both come from the same group of 10.
Forgetting repetition is allowed. PIN codes, license plates, and passwords typically allow repeated characters. Using the no-repetition formula for these undercounts the true number of possibilities, sometimes drastically.
Confusing "at least one repeat" language. The birthday problem's "chance of a shared birthday" is a totally different calculation from "chance a specific date is used," and mixing these framings up is one of the most common combinatorics errors, even among people comfortable with the formulas themselves.
Questions people actually ask about this
What's the actual difference between a combination and a permutation?
A combination ignores order: picking a team of 3 from 10 people is a combination, since the team is the same regardless of who was picked first. A permutation counts order: assigning 1st, 2nd, and 3rd place from the same 10 people is a permutation, since swapping who gets which place creates a different outcome.
Why is nPr always bigger than nCr for the same n and r?
Every combination of r items can be arranged in r! different orders, and permutations count each of those orders separately while combinations count them as one. Specifically, P(n,r) = C(n,r) × r!, so permutations are always at least as large, and strictly larger whenever r is 2 or more.
How do I know if repetition is allowed in a word problem?
Look for whether the same physical item can be reused. Drawing cards from a deck without putting them back doesn't allow repetition. Rolling a die multiple times, choosing PIN digits, or picking ice cream flavours where you can choose the same flavour twice, all allow repetition.
Why does the calculator reject large values of n?
Factorials grow extremely fast. 170! is close to the largest number a standard calculation can represent precisely, so n above that range is blocked to avoid returning a number that's silently wrong due to floating-point overflow.
What if r is 0?
There's exactly one way to choose nothing, so C(n,0) and P(n,0) both equal 1, for any n. This isn't a special case in the formula, it falls out naturally since 0! is defined as 1.