Combinations & Permutations Calculator

Work out nCr, nPr, factorials and multinomial coefficients with arbitrary precision. Tick the repetition box for the with-repeats variants. The calculator shows the formula it used and walks through the working underneath, so you can check the answer rather than take it on faith.

Explain like I'm 5 (what even is this calculator?)

Imagine you have a bag of sweets and you want to know how many different ways you can pick a few of them. If you only care which sweets you ended up with, that is a combination. If the order you picked them in matters too, that is a permutation. This calculator counts both. The numbers get big fast, so it does the maths in proper whole numbers (no rounding) and shows you the formula it used.

Calculate

Browser-only. The numbers you enter are processed in your browser. Nothing is uploaded.

n is capped at 500 to keep the page snappy. The arithmetic itself is exact, using arbitrary-precision integers.

nCr (combinations)
nPr (permutations)
n!

Enter your values and press Calculate.

Prove it

    Method: nCr = n! / (r! (n − r)!), nPr = n! / (n − r)!. With repetition: combinations become C(n + r − 1, r) and permutations become n^r. Multinomial: n! / ∏(kᵢ!). All arithmetic uses JavaScript BigInt so the answers are exact, no floating-point fuzziness.

    Useful? Save this calculator: press Ctrl + D to bookmark it.

    What the calculator is actually doing

    For combinations without repetition, the formula is nCr = n! / (r! (n − r)!). It counts the number of ways to choose r items from n distinct items when the order does not matter. For permutations without repetition, the formula is nPr = n! / (n − r)!, which counts arrangements where the order does matter. The relationship between them is straightforward: every combination of r items can be arranged in r! different orders, so nPr = nCr × r!.

    The repetition variants are different beasts. Combinations with repetition uses the stars-and-bars count, C(n + r − 1, r), which works out how many multisets of size r you can build from n distinct types. Permutations with repetition is the simplest of the four: n choices, made r times, gives n raised to the power r. PIN codes, dice rolls and licence plates all live in this last bucket.

    When you actually need this

    Probability problems lean on combinations and permutations more than any other piece of maths. The number of five-card poker hands is 52C5 = 2,598,960, which is the denominator under almost every probability you will ever calculate at the table. Lottery odds are nCr divided into one. Birthday-paradox style questions need permutations to count the bad outcomes. Anywhere you are counting "how many distinct ways could this happen", the chances are you want one of the four formulas above.

    Outside textbook probability the same maths quietly underpins genetics (counting allele combinations), combinatorial chemistry (how many distinct molecules can be assembled from a kit of fragments), tournament scheduling (how many round-robin pairings exist), and an enormous chunk of cryptography. The maths is small. The applications are not.

    Common mistakes the calculator helps you avoid

    Mixing up nCr and nPr. If the order matters, you want nPr. If it does not, you want nCr. A surprising number of probability errors trace back to using the wrong one. The "both" mode is there so you can sanity-check by computing both and seeing which one matches the situation you have in mind.

    Forgetting about repetition. A four-digit PIN has 10,000 combinations, not 5,040. The difference is whether digits can repeat. Without the repetition tick, the calculator assumes each item is used at most once. Tick the box and the formula switches.

    Computing the factorial the long way. By hand, working out 100! to divide it by 50! and another 50! is a tedious mess. The calculator uses the multiplicative form of nCr, which never builds the giant numerator at all, so even something like 500C250 comes back instantly.

    Hitting the precision wall in a spreadsheet. Excel's COMBIN function and most online calculators silently fall over at around 13C7 or so when the intermediate factorials overflow a double-precision float. This calculator uses BigInt throughout, which is exact for any integer no matter how huge.

    Edge cases worth knowing about

    r = 0: there is exactly one way to choose nothing. nC0 = 1, nP0 = 1, 0! = 1. The calculator returns the right answer rather than choking on the corner case.

    r = n: nCn = 1 (one way to choose all of them) and nPn = n! (every possible ordering of the full set).

    r > n without repetition: impossible, so the count is zero. The calculator flags it as an input error rather than silently returning 0, on the grounds that it is more useful to spot the bug.

    Very large multinomials: the multinomial coefficient grows even faster than nCr because every group factorial in the denominator is small relative to the n! on top. The calculator handles it with BigInt and shows a scientific-notation hint alongside the exact number when the digit count gets unwieldy.

    Related calculators

    Counting outcomes is one classroom workhorse. These are the others.

    Frequently asked questions

    What is the difference between a combination and a permutation?

    Order. A permutation cares which thing came first, second, third. A combination does not. Picking three friends to come for a curry is a combination: it is the same group whether you texted Alex first or last. Working out the podium at a race is a permutation: gold, silver and bronze are different jobs and the order is the whole point.

    When should I use the repetition option?

    Tick repetition when the same item can be chosen more than once. Three scoops from five ice-cream flavours, where you are allowed two scoops of pistachio, is combinations with repetition. A four-digit PIN where digits can repeat is permutations with repetition. Without the tick, the calculator assumes each item can be picked at most once.

    Why does the calculator cap n at 500?

    It does the maths in arbitrary-precision integers using JavaScript BigInt, so accuracy is not the issue. The cap is about readability. 500 factorial has over 1100 digits. Past that point the screen fills up with a wall of digits that nobody is going to read, so we stop short and give you a usable answer.

    What is a multinomial coefficient and when do I need one?

    A multinomial counts the number of distinct ways to split n items into named groups of fixed sizes. The classic example is the number of distinct rearrangements of MISSISSIPPI: 11 letters made of 1 M, 4 I, 4 S and 2 P, giving 11! divided by (1! 4! 4! 2!) which is 34,650. Pop the group sizes into the calculator separated by commas.

    Does this calculator send my numbers anywhere?

    No. The whole thing runs in your browser using vanilla JavaScript. The values you type never leave your device. You can disconnect from the network and the calculator still works.