Hypergeometric Odds Calculator

Odds for draws without replacement, as exact fractions.

  • Exact fractions
  • At least / at most
  • Mean and variance
A cloth bag of small round clay beads tipped over on a round wooden stool, with a loose handful of beads spilled across the stool top.

The guide

Why odds change when nothing goes back in the bag, and how to count them exactly

Drawing without replacement makes every draw depend on the last. Counting whole samples with combinations gives exact odds, and shows when the simpler binomial is close enough.

  • 35673/54145 chance of no ace in a five-card hand from 52 cards
  • 0.6702 the same chance if each card were put back before the next
  • 13,983,816 possible draws of 6 numbers from 49
  • 8815/499422 chance of matching exactly three of the six numbers
Read the full guide Fold the guide 6 min · 12 sources

Deal five cards from a fresh deck and ask how likely it is that none of them is an ace. The question sounds like a coin flip repeated five times, and most people reach for the same arithmetic: each card has a 48 in 52 chance of not being an ace, so multiply that five times. The answer that comes out is wrong, and it is wrong in a way that teaches something. The cards that were dealt are gone. The deck that faces the second card is not the deck that faced the first.

What “without replacement” does, and how to count it

A draw without replacement removes what it picks. The Wikipedia article on the hypergeometric distribution describes it as the chance of k successes in n draws, without replacement, from a finite population of size N that contains exactly K objects with the feature you care about. It sets this against the binomial distribution, which describes the same count in draws with replacement.

The difference is dependence. Draw an ace first and fewer aces remain for the second card. Draw a non-ace first and the share of aces in what is left creeps up. The chance of a success changes on every draw, because each draw shrinks the population. Chasing the cards one at a time gets tangled, since each step depends on all earlier ones. A cleaner view treats the whole hand as one object. Every possible hand is equally likely, so the chance of an outcome is the number of hands that produce it divided by the number of hands there are.

That is the formula behind the article’s definition. The chance of exactly k is the number of ways to pick k of your K items, times the number of ways to pick the other n minus k from the N minus K that are not yours, divided by the number of ways to pick any n from N.

Each “number of ways” is a binomial coefficient. The NIST Digital Library of Mathematical Functions defines it as the number of ways of choosing items from a collection of distinct objects without regard to order, and gives the symmetry that choosing j to keep is the same as choosing the rest to leave out.

A hand of cards and a lottery, counted

The poker article gives the denominator for a five-card hand: 2,598,960 possible hands. It also shows how a count becomes a chance. There are 4 ways to draw a royal flush, so the chance is 4 in 2,598,960, which is one in 649,740.

Now the aces. Hands with no ace take all five cards from the 48 that are not aces, so there are C(48,5) of them, which is 1,712,304. Divide by 2,598,960 and reduce, and you get 35673/54145, about 0.65884200. At least one ace is the rest of the probability, 18472/54145, about 0.34115800.

The wrong method gives (48/52) to the fifth power, which is 0.6702 to four places. The gap of about 0.0114 is not rounding. It is the price of pretending the cards went back.

A lottery that draws 6 numbers from 49 is the same model with the roles swapped. Your ticket holds K equals 6 numbers, the machine draws n equals 6, and k counts the matches. The lottery mathematics article gives the number of possible draws as 13,983,816.

Matching exactly three needs 3 of your 6 and 3 of the 43 others: 20 times 12,341, or 246,820 favourable draws. That is 8815/499422, about 0.01765040, or one in about 57. Matching all six is 1/13,983,816, which a decimal rounded to eight places shows only as 0.00000007. Matching at least three is 4654/249711, about 0.0186.

The same arithmetic prices keno, which the hypergeometric article calls a place where the distribution is indispensable: twenty balls drawn from eighty. Open the presets on this page to see each case as a table of every k with the exact counts behind the fractions.

What the mean and the variance say

The average number of aces in a five-card hand is n times K over N, which is 5 times 4 over 52, or 5/13. Removing cards changes the spread, not the centre.

The variance shows where the difference lives. The hypergeometric variance is n times K over N times N minus K over N times N minus n over N minus 1. Compare that with the binomial variance, n times p times one minus p with p equal to K over N. The two differ by the single factor (N minus n) over (N minus 1).

For the hand of five that factor is 47/51, so the variance drops from 60/169 to 940/2873. Taking cards out of a finite deck pulls the results a little closer to the average. When you take the whole population, n equals N, the factor is zero and there is no spread at all, which is obvious once you say it: the hand is the whole deck. The tool shows both numbers as exact fractions, with the standard deviation marked approximate because a square root is not a fraction.

Samples, lots, and when the binomial is close enough

The model is older and broader than games. Acceptance sampling inspects some items from a production lot, counts the defective ones, and accepts or rejects the lot by that count. Take a lot of 200 with 12 defective and inspect 20. The chance of finding none is about 0.2718, so a clean sample happens more than one time in four even though the lot holds 12 bad items.

Statisticians use the same distribution to test claims. The Fisher’s exact test article explains that, with the totals of a two-by-two table held fixed, one cell follows a hypergeometric distribution. The hypergeometric article adds that its test is the one-tailed form of Fisher’s exact test. Drawing without replacement is also the default in sampling. The simple random sample article notes that sampling is typically done without replacement, so no member of the population is chosen twice.

The binomial is not wrong, only a stand-in. The binomial distribution article says it is often used for a sample drawn with replacement, that without replacement the draws are not independent and the result is hypergeometric, and that for N much larger than n the binomial remains a good approximation. The NIST handbook adds the condition that makes it work: the binomial assumes the chance of success is the same on every trial.

Try the last preset, 20,000 items of your kind in 100,000, drawing 10. The chance of exactly two is about 0.30200 without replacement and about 0.30199 with. The bag is so large that ten removals barely move it.

Shrink the bag and the agreement falls away. The lot of 200 with 12 defective, sampled 20 at a time, gives 0.2718 for none, against 0.2901 with replacement. The tool draws the with-replacement values as rings on the chart so the gap is visible and not only stated.

Big integers, and what the page cannot tell you

Counting hands for a deck is easy. Counting for a population of tens of thousands is not: C(100000,50000) has over 30,000 digits. A floating point number cannot hold that, and rounding errors would creep into every fraction.

The MDN reference for BigInt describes it as a way to represent integers too high or too low for the ordinary number type. The page keeps every count as a BigInt, builds each binomial coefficient by the multiplicative form with an exact division at each step, and reduces each fraction to lowest terms. The Web Workers API runs a script in a background thread, so the counting happens there and the interface stays responsive, with a time limit and a Cancel button.

The page answers one narrow question: given N, K and n, how likely is each k when draws are made without replacement and every item is equally likely to be picked. It does not model unequal chances, draws that are put back, or items of more than two kinds. It does not know whether a real shuffle is fair, or whether a real lot was sampled at random. It also gives no advice about gambling. Odds are arithmetic about a model, and the fractions only mean what the model means.

One check worth running yourself: set N to 14, K to 5 and n to 6. There are 3003 possible samples, and the counts for each k add up to exactly 3003. That is the quickest way to see that nothing is rounded away.

Sources

Every source consulted for this guide. Links checked November 9, 2026.

  1. Hypergeometric distribution - Wikipedia Wikipedia (CC BY-SA 4.0)
  2. Poker probability - Wikipedia Wikipedia (CC BY-SA 4.0)
  3. Binomial coefficient - Wikipedia Wikipedia (CC BY-SA 4.0)
  4. Binomial distribution - Wikipedia Wikipedia (CC BY-SA 4.0)
  5. Lottery mathematics - Wikipedia Wikipedia (CC BY-SA 4.0)
  6. Fisher's exact test - Wikipedia Wikipedia (CC BY-SA 4.0)
  7. Acceptance sampling - Wikipedia Wikipedia (CC BY-SA 4.0)
  8. Simple random sample - Wikipedia Wikipedia (CC BY-SA 4.0)
  9. 1.3.6.6.18. Binomial Distribution - NIST/SEMATECH e-Handbook of Statistical Methods National Institute of Standards and Technology (US government)
  10. DLMF: 26.3 Lattice Paths: Binomial Coefficients NIST Digital Library of Mathematical Functions (US government)
  11. BigInt - JavaScript | MDN MDN Web Docs (CC BY-SA 2.5 or later)
  12. Web Workers API - Web APIs | MDN MDN Web Docs (CC BY-SA 2.5 or later)