Skip to main content

Combination Calculator

Compute C(n,r) = n! / (r!(n−r)!) or the multiset formula C(n+r−1, r) when repetition is allowed.

Written by Golam Rabbani, Founder & Lead Engineer

How to use this combination calculator

  1. Enter n (total items) and r (items to choose).
  2. Tick "Allow repetition" for multiset combinations — the formula switches to C(n + r − 1, r).
  3. Press Calculate. The result is an exact integer thanks to BigInt arithmetic.
  4. Copy the result or Reset to clear inputs.

About this combination calculator

A combination is an unordered selection of r items from n distinct items. Without repetition, C(n, r) = n! / (r! · (n − r)!). With repetition allowed (the multiset case — for example, choosing scoops from a fixed set of ice-cream flavours where each flavour can be picked more than once), the count is C(n + r − 1, r). The calculator computes the binomial multiplicatively so it stays exact for very large n and r, and uses BigInt so the answer is never a truncated float.

Worked example. How many five-card poker hands can be dealt from a standard 52-card deck? n = 52, r = 5, no repetition. C(52, 5) = (52 × 51 × 50 × 49 × 48) / (5 × 4 × 3 × 2 × 1) = 311,875,200 / 120 = 2,598,960. So there are exactly 2,598,960 distinct 5-card hands. If you instead picked 3 scoops from 10 ice-cream flavours with repetition allowed, the count is C(10 + 3 − 1, 3) = C(12, 3) = 220.

FAQ

What is the difference between combination and permutation?
Combinations count subsets regardless of order (ABC = CBA). Permutations count ordered arrangements (ABC ≠ CBA). For the same n and r, C(n, r) = P(n, r) / r!.
When should I tick "Allow repetition"?
Use it for multiset selections — choosing flavours, picking k items from buckets where each type can repeat. The formula becomes C(n + r − 1, r).
What does C(n, r) equal when r = 0 or r = n?
C(n, 0) = C(n, n) = 1. There is exactly one way to choose nothing, and one way to choose everything.
Why use BigInt?
Binomials grow fast: C(100, 50) ≈ 10²⁹. Regular floats lose precision after about 15 digits; BigInt stays exact.
What if r exceeds n without repetition?
You cannot pick more items than you have, so the calculator returns an error message.