CalcDuck

Combinations and Permutations Calculator

Combinations and Permutations Calculator

nCr — combinations
120
nPr — permutations
720
n!
3,628,800

A combination nCr counts how many ways to choose r items from n when order does not matter, while a permutation nPr counts the same choice when order does matter. Choosing 5 cards from a standard 52-card deck gives C(52,5) = 2,598,960 possible hands, far fewer than the 311,875,200 ordered permutations P(52,5).

Tip: “Copy with settings” shares a link that opens this calculator with your numbers already filled in.

How this calculator works

Enter a total number of items n and how many you are choosing r, and this calculator returns the number of combinations (order does not matter), permutations (order matters), and the plain factorial n! of the total.

The distinction between combinations and permutations comes down to whether arrangement counts. Picking 3 lottery numbers where the order they're drawn doesn't change your ticket is a combination problem; ranking the top 3 finishers in a race, where 1st, 2nd and 3rd are different outcomes, is a permutation problem.

The formulas

Factorial: n! = n × (n−1) × (n−2) × ... × 1, with 0! = 1Permutations: nPr = n! ÷ (n−r)!Combinations: nCr = n! ÷ (r! × (n−r)!) = nPr ÷ r!

This calculator computes nCr as a running product of ratios rather than dividing two full factorials, which keeps intermediate results smaller and avoids unnecessary precision loss. Inputs are capped at n = 170, since 171! exceeds the largest number a standard floating-point number can represent.

Worked example: choosing 3 winners from 10 entries

  1. As a combination (order doesn't matter): C(10,3) = 10! ÷ (3! × 7!) = (10 × 9 × 8) ÷ (3 × 2 × 1) = 720 ÷ 6 = 120.
  2. As a permutation (1st, 2nd, 3rd place matter): P(10,3) = 10 × 9 × 8 = 720.
  3. Notice P(10,3) = C(10,3) × 3! = 120 × 6 = 720 — every combination corresponds to 3! = 6 different orderings.

Frequently asked questions

What is the difference between combinations and permutations in plain terms?

If rearranging the same items counts as a different result, use permutations. If it counts as the same result, use combinations. A hand of cards is a combination; a race's finishing order is a permutation.

Why does the calculator cap n at 170?

170! is about 7.26 × 10³⁰⁶, right at the edge of what a standard 64-bit floating-point number can represent. 171! would overflow to Infinity, so the calculator stops accepting larger n to keep every result meaningful.

Why do some results show as an approximate number instead of a full integer?

Floating-point numbers are only guaranteed to represent integers exactly up to 2^53 (about 9 quadrillion). Beyond that, results like 100! are shown in fixed-precision scientific notation (10 significant digits) rather than a long string of digits that would falsely imply more precision than double-precision math actually has.

Is C(n,r) always equal to C(n, n−r)?

Yes, this is a basic symmetry property: choosing r items to include is equivalent to choosing n−r items to leave out, so both counts are always identical. For example, C(52,5) = C(52,47).

How do you calculate a combination like C(10,3) by hand?

Multiply the r consecutive numbers counting down from n, then divide by r factorial. For C(10,3): 10 × 9 × 8 = 720, and 3! = 3 × 2 × 1 = 6, so 720 ÷ 6 = 120 — the same value this page's worked example finds by choosing 3 winners from 10 entries, and it matches the general formula nCr = n! ÷ (r! × (n−r)!) exactly.

Sources

Related calculators