deftools.io Math & Data

Permutation & Combination Calculator

Calculate permutations nPr and combinations nCr — exact big-integer results for n up to 5000, with step-by-step factorial breakdown.

Try an example

About this tool

Combinations and permutations answer the question "how many ways can I pick r items from a set of n?". Combinations (nCr) are used when order doesn't matter (lottery numbers, committee members, hands of cards); permutations (nPr) are used when order does matter (PINs, rankings, batting lineups, race podiums).

The tool also supports with-repetition variants, where the same item can be chosen more than once — useful for counting the possible outcomes of rolling dice, sequences of letters, or strings of bits. Computation is done with big integers so the answer is exact even for large inputs like C(100,10) = 17,310,309,456,440.

Example 1: How many ways can 3 winners be picked from 10 entrants if order matters? Answer: P(10,3) = 720. If order doesn't matter: C(10,3) = 120.

Example 2: How many unique 4-character PINs use digits 0-9, with repetition allowed? Answer: P(10,4) with repetition = 10,000.

FAQ

What's the difference between nCr and nPr?

nCr (combinations) counts selections where order does NOT matter — choosing A,B,C is the same as C,B,A. nPr (permutations) counts selections where order DOES matter — each ordering is a distinct result. nPr is always larger than or equal to nCr for the same n and r.

How are the formulas computed?

nCr = n! ÷ (r! × (n−r)!). nPr = n! ÷ (n−r)!. With repetition: nCr-with-rep = (n+r−1)! ÷ (r! × (n−1)!), nPr-with-rep = n^r. The tool computes these exactly using big integers — no floating point, no rounding.

Why does the answer have so many digits?

Factorials grow extremely fast. 20! already has 19 digits, 100! has 158 digits. The tool shows the full exact value because for combinatorics the precise count matters (e.g. lottery odds, password search spaces). Press "Copy result" to grab the whole number.

What are the limits?

Inputs must be non-negative integers with r ≤ n (when repetition is off). n can be up to 5,000 — beyond that the factorial product becomes unwieldy. For very large n the tool may take a moment, but it still returns an exact integer.

Related math & data tools

Copied!