The hypergeometric distribution calculator above gives the probability of drawing exactly k successes when you take n items, without replacement, from a population of N that contains K successes in total. It also reports both cumulative tails, the expected value, the standard deviation, and the full probability mass function as a bar chart so you can see the whole shape rather than one number in isolation. Every probability is computed through log-gamma functions rather than raw factorials, so large populations do not overflow.
Arb Digital publishes this because "without replacement" describes far more real sampling than people assume. Pulling ten units off a production line for inspection, auditing forty invoices from a ledger of six hundred, dealing cards, selecting a jury panel, drawing names for a prize — in every one of those the item removed is genuinely gone, and the odds shift for the next draw. The binomial distribution assumes the opposite, and the gap between the two is small when the population is huge and embarrassingly large when it is not.
What This Hypergeometric Distribution Calculator Does
It takes four whole numbers — N, K, n and k — and returns the exact probability of that outcome under sampling without replacement, along with the lower and upper cumulative probabilities. It enforces the support automatically: k cannot exceed the smaller of n and K, and it cannot fall below n − (N − K), because if the sample is larger than the number of failures available you are forced to pick up some successes whether you want to or not. That lower bound catches people out and the tool states it explicitly rather than silently returning zero.
The boundary with our binomial distribution calculator is the whole point of this page. The binomial assumes every trial has the same success probability and that trials are independent, which is true when you replace each item or when the population is effectively infinite. The hypergeometric assumes the population is finite and shrinking. Same question, different sampling scheme, different answer. For the combinatorial pieces on their own, our binomial coefficient calculator evaluates the "n choose k" terms this formula is built from.
How to Use It
- Set N, the whole population. Everything you could possibly draw from, not just the interesting subset.
- Set K, the successes it contains. Defective units, red cards, subscribers, whatever you are counting. It must not exceed N.
- Set n, how many you draw. The sample size. It cannot exceed N either, since you cannot draw more items than exist.
- Set k, the count you are asking about. If it falls outside the valid support, the tool says so and gives a probability of zero, which is the correct answer rather than an error.
- Read the bar chart, not just the headline. A single exact-value probability is often small simply because the outcomes are spread across many values; the cumulative figures usually answer the real question.
The Formula and How It's Calculated
The probability mass function is P(X = k) = C(K, k) × C(N − K, n − k) ÷ C(N, n), where C(a, b) is the number of ways to choose b items from a. The logic is pure counting: the denominator is every possible sample of size n, and the numerator counts the samples that contain exactly k of the successes and n − k of the failures. No probability multiplication is involved at all, which is why the formula stays valid regardless of the order the items come out in.
Work the default through. Drawing five cards from a 52-card deck, what is the chance of exactly two hearts? C(13, 2) = 78 ways to pick which two hearts, C(39, 3) = 9,139 ways to pick the three non-hearts, and C(52, 5) = 2,598,960 possible hands. So P = (78 × 9,139) ÷ 2,598,960 = 712,842 ÷ 2,598,960 = 0.27428, or about 27.43%. The cumulative P(X ≤ 2) is 90.72% and the upper tail P(X ≥ 2) is 36.70%.
The mean is E[X] = n × K ÷ N, which here is 5 × 13 ÷ 52 = 1.25 hearts — identical to the binomial mean, because expectation is linear and does not care about independence. The variance is where the schemes part company: Var(X) = n × (K/N) × (1 − K/N) × ((N − n) ÷ (N − 1)), giving 5 × 0.25 × 0.75 × (47 ÷ 51) = 0.86397 and a standard deviation of 0.9295. Penn State's open STAT 414 probability theory notes derive the same mass function in their discrete-distributions lessons.
The Finite Population Correction, and Why It Shrinks the Spread
The factor (N − n) ÷ (N − 1) in the variance is the finite population correction, and it is the single structural difference between this distribution and the binomial. It is always less than or equal to one, so the hypergeometric is always at least as tightly concentrated as the binomial with the same mean. The reason is intuitive once stated: when you sample without replacement, an unusually success-heavy start depletes the remaining successes and makes the rest of the sample more likely to be poor, which pulls extreme totals back toward the middle.
Two limiting cases make it concrete. If n = 1 the correction is exactly 1 and the two distributions are identical, because with a single draw there is nothing to deplete. If n = N you have taken the entire population, the correction becomes zero, and the variance vanishes — you will observe exactly K successes with certainty, no randomness left. Everything between those extremes is a partial version of the same effect, which is why the correction is sometimes quoted as the reason a census has no sampling error.
When the Binomial Approximation Is Safe
The usual working rule is that the binomial is an acceptable stand-in when the sample is no more than about 5% of the population, sometimes stated as 10% in less demanding settings. At n/N = 0.05 the correction factor is roughly 0.95, so the variance is understated by about 5% and the standard deviation by about 2.5% — normally inside the noise of everything else in the analysis.
The rule fails badly in exactly the situations where people reach for it most. Auditing 40 of 200 invoices is a 20% sampling fraction, and the correction of 0.804 shrinks the standard deviation by more than 10%. Inspecting 10 of 30 units is 33%, and the correction is 0.690. In both cases treating the sample as binomial produces confidence intervals wider than they should be, which is conservative but wasteful — you are collecting more evidence than your data actually requires. If you are choosing a sample size in that region, our sample size calculator and the NIST/SEMATECH e-Handbook of Statistical Methods both treat the finite population case as a first-class scenario rather than a footnote.
Acceptance Sampling: the Classic Application
Quality inspection is where the hypergeometric earns its living. A lot of 200 units arrives, you inspect 20, and you reject the lot if two or more are defective. The question the plan has to answer is: if the lot really contains 10 defectives, what is the probability this plan catches it? Set N = 200, K = 10, n = 20 and read P(X ≥ 2). Do the same for K = 4, K = 20 and K = 40, and you have traced the operating characteristic curve of the sampling plan.
That curve is the honest description of what an inspection plan does, and it is usually sobering. Small samples from large lots simply cannot distinguish a 2% defect rate from a 5% one with any confidence, no matter how the acceptance number is set. The plan has a producer's risk of rejecting good lots and a consumer's risk of accepting bad ones, and the only way to shrink both at once is to inspect more units. The hypergeometric is what quantifies that trade rather than leaving it to argument.
Reading the Shape: Why the Mode Is Not Always Near the Mean
The bar chart shows the full mass function, and its shape changes character depending on the sampling fraction. With a small n relative to N it looks like a slightly compressed binomial. As n approaches N the distribution collapses toward a single spike at K, since almost every sample has to contain almost all the successes. And when the support is truncated — when n exceeds N − K, forcing a minimum number of successes — the left-hand tail is cut off entirely rather than tapering.
That truncation is worth watching for. Draw 45 cards from a deck and you must get at least 6 hearts, because there are only 39 non-hearts to fill the rest. The probability of 0, 1, 2, 3, 4 or 5 hearts is not small — it is exactly zero, and no approximation that ignores the finite population will tell you that. The rule is the lower support bound max(0, n − (N − K)), and the tool applies it on every calculation. For questions about arrangements rather than counts, our permutation calculator covers the ordered case, and our probability calculator handles single and compound events from first principles.
Arb Digital's analysts size and read samples properly, so the numbers in your reporting mean what they appear to mean.
Browse All Free Tools Talk To Our TeamCommon Mistakes to Avoid
- Using the binomial for a large sampling fraction — once n is more than about 5% of N, ignoring the finite population correction overstates the spread noticeably.
- Forgetting the lower support bound — when the sample is bigger than the number of failures available, a minimum number of successes is guaranteed and lower counts have probability exactly zero.
- Setting K greater than N — the successes are a subset of the population, so K can never exceed it, and neither can n.
- Reading P(X = k) when you meant a tail — for acceptance sampling and most testing questions the useful figure is P(X ≥ k) or P(X ≤ k), not the probability of that exact count.
- Assuming the mean differs from the binomial — it does not. Only the variance changes, so a mean-based check will never reveal that you picked the wrong distribution.
Related Free Tools From Arb Digital
Model independent trials with replacement using the binomial distribution calculator, count rare events over an interval with the Poisson distribution calculator, evaluate the combination terms directly with the binomial coefficient calculator, count ordered arrangements with the permutation calculator, or work through general event probabilities with the probability calculator. The free online tools hub lists every statistics tool we publish.
Frequently Asked Questions
It gives the probability of getting exactly k successes when you draw n items without replacement from a population of N containing K successes. Because items are not returned, the probability of success changes with every draw.
The binomial assumes each trial is independent with a constant success probability, which is what happens when you replace each item. The hypergeometric assumes a finite population that shrinks as you sample, so the trials are not independent.
It is the factor (N minus n) divided by (N minus 1) that appears in the hypergeometric variance. It is never greater than one, so sampling without replacement always produces a tighter distribution than the equivalent binomial.
When the sample is a small fraction of the population, commonly taken as no more than five percent. At that point the correction factor is close to one and the difference between the two answers is usually negligible.
It falls outside the support. The count cannot exceed the smaller of n and K, and it cannot be below n minus (N minus K), because a sample larger than the number of failures available must contain some successes.
It is n times K divided by N, exactly the same as the binomial mean with success probability K over N. Only the variance differs between the two distributions.
Acceptance sampling and quality inspection, audit sampling from a fixed ledger, card and lottery problems, and Fisher's exact test, which is built on hypergeometric probabilities for a two-by-two table.
This page explains a probability distribution for educational purposes only. Results depend entirely on the population figures you enter, and any inspection or audit plan should be validated against the sampling standard your organisation works to.