Hypergeometric Calculator – Odds When You Draw Without Putting Anything Back

Draw without putting anything back, and every draw changes the odds for the next one — handled exactly.

100% FreeNo sign-up neededInstant results

Your numbers

Everything in the urn, deck, or group. A whole number from 1 to 1000.

How many of the N are successes. From 0 up to N.

How many items you draw, without replacement. From 0 up to N.

How many successes you are asking about. It must be possible: no more than K and no more than n.

Your numbers never leave this page. Everything is calculated in your browser.

Result

P(X = 2)
0.2167
That is 21.67 percent. Drawing 4 items from 20 with 5 successes in the population gives exactly 2 successes about 21.67 times out of 100.

The numbers behind it

Exactly k: P(X = k)0.2167
At most k: P(X at most k)0.9680
At least k: P(X at least k)0.2487
Mean (expected successes)1.0000
Variance0.6316
Possible k values0 to 4
Combinations usedC(5, 2) × C(15, 2) / C(20, 4) = 10 × 105 / 4845
Copied

Without replacement, the draws are not independent: drawing a success leaves fewer successes behind, so the odds shift on every draw. That is why this distribution differs from the binomial distribution, which assumes each draw is replaced.

Full distribution for the anchor case

Every possible count of successes when drawing 4 items from 20 with 5 successes in the population. The probabilities add up to exactly 1.0000, and the most likely outcome is 1 success.

kP(X = k)Share of the largest
00.2817
10.4696
20.2167
30.0310
40.0010

Live table for your inputs appears in the calculator above as the mode changes; the static table here shows the anchor case.

Key takeaways
  • Without replacement, every draw changes the odds — the formula counts combinations, not independent chances.
  • Exactly, at most and at least are three different questions; pick the mode that matches the one you asked.
  • The mean is n × K ÷ N, and the variance is smaller than the binomial’s, by the finite-population correction.

How it works, in three steps

1

Count the winning selections

Choose k successes from the K available, and choose the remaining n minus k draws from the N minus K failures. Multiply those two counts.

2

Count every possible selection

Choose n items from all N, with no regard to order. That count is the denominator.

3

Divide, then add up for cumulative modes

Winning selections divided by all selections is the exact probability. At most adds up every count up to k, and at least adds up every count from k upward.

How the calculation works

P(X = k) = C(K, k) × C(N − K, n − k) / C(N, n)

Worked example. N = 20, K = 5, n = 4, k = 2. C(5, 2) = 10, C(15, 2) = 105, and C(20, 4) = 4845. So P(X = 2) = 10 × 105 / 4845 = 1050 / 4845 = 0.2167. The full distribution is 0.2817, 0.4696, 0.2167, 0.0310, and 0.0010 for k = 0 through 4, which adds up to 1.0000. At most 2 is 0.2817 + 0.4696 + 0.2167 = 0.9680, and at least 2 is 1 minus the probability of 0 or 1, which is 0.2487.

Mean and variance. The mean is n × K / N, which is 4 × 5 / 20 = 1.0000. The variance is n × (K / N) × ((N − K) / N) × ((N − n) / (N − 1)), which is 4 × 0.25 × 0.75 × (16 / 19) = 0.6316. The last factor is the finite population correction: it shrinks the variance because drawing without replacement removes uncertainty as the urn empties.

Why the counts stay exact. The three combination counts are computed with BigInt whole numbers, so C(1000, 500) style counts never overflow. The final division turns them into an ordinary decimal probability, which is shown to four decimal places.

Going deeper

The binomial distribution assumes every draw is replaced, so the success probability stays K / N on every draw. The hypergeometric distribution removes each drawn item, so the odds move. When the population is huge compared with the number of draws, the two answers are nearly identical, because removing a few items barely changes the mix. When the population is small, like 20 balls with 4 draws, the difference is large: the exact hypergeometric answer for the anchor case is 0.2167, while the binomial answer with p = 0.25 would be 0.2109. Use the hypergeometric version whenever draws are made without replacement from a known, finite population.

You cannot draw more successes than exist, so k can never exceed K, and you cannot draw more successes than you draw items, so k can never exceed n. You also cannot draw fewer successes than the draws forced from the success group: if you draw more items than there are failures, some successes are unavoidable, so k must be at least n minus (N minus K). This calculator rejects impossible k values with a plain error instead of showing a zero or a made-up number.

Draw balls from an urn, cards from a deck, or names from a hat, and every draw changes the odds for the next one. This calculator handles that exactly: no replacement, no approximation, and the full distribution in one table.

Drawing without replacement, exactly

The hypergeometric distribution answers questions about drawing without putting anything back. A population of N items contains K successes, you draw n items, and you ask the probability of getting exactly k successes. Because nothing is replaced, every draw changes the composition of what remains, and the probabilities shift with each draw. The formula counts combinations: C(K,k) × C(N−K,n−k) divided by C(N,n), where C(a,b) is the number of ways to choose b items from a.

The default example works the formula out in full. With N = 20, K = 5, n = 4 and k = 2, the numerator is C(5,2) × C(15,2) = 10 × 105, and the denominator is C(20,4) = 4,845. The probability is therefore 1,050 divided by 4,845, which is 0.2167, or 21.67%. Read it as: if you draw 4 items from 20 containing 5 successes, a little over a fifth of the time you will get exactly 2 successes. The combination counts are the whole story: favourable draws over total draws, with no approximation anywhere.

The without-replacement condition is what makes this distribution different from the binomial, where each draw is independent because the item is replaced or the population is effectively infinite. Here the draws are dependent, and that dependence is visible in the formula: the second factor uses N−K, the failures remaining, and the denominator uses N, the whole population, so the composition of the population enters every term. Ignore the dependence and you get a different distribution with a different answer, which is why the choice of distribution matters before any arithmetic begins.

Check the inputs before trusting a result. K cannot exceed N, k cannot exceed K or n, and n cannot exceed N, because each of those would describe a draw that cannot happen. The page’s inputs enforce sensible ranges, but the conceptual check is yours: a population of 20 with 25 successes is not a hard problem, it is a meaningless one, and no probability, however precisely computed, can rescue it.

Exactly, at most, at least: three questions

The page answers three questions from the same inputs, and confusing them is the most common error in using it. “Exactly k” is the probability of getting precisely k successes. “At most k” is the probability of getting k or fewer, which sums the exactly-probabilities from 0 up to k. “At least k” is the probability of getting k or more, which sums from k up to the largest possible value. The three answers describe different events, and only one of them is usually the question you actually asked.

The defaults show all three at once. For N = 20, K = 5, n = 4 and k = 2, the exactly-probability is 0.2167, the at-most probability is 0.9680, and the at-least probability is 0.2487. The at-most figure near 1 says that getting 2 or fewer successes is very likely, which makes sense when the population is mostly failures. The at-least figure of about a quarter says that getting 2 or more is a minority outcome, which is the same fact from the other side. Neither cumulative figure contradicts the exactly figure; they sum different sets of outcomes.

The mode selector switches which of the three the headline reports. In at-least mode on the defaults, the headline becomes P(X at least 2) = 0.2487, or 24.87%, while the other figures remain available for comparison. Choose the mode that matches your question before reading the headline: “at least two” and “exactly two” differ by more than a rounding error here, 24.87% against 21.67%, and in other cases the gap is far larger. Reading the wrong mode’s headline as the answer to your question is an error of interpretation, not of arithmetic.

A useful identity connects the three: at-most plus at-least-minus-one equals 1, because every outcome is either at most k or at least k+1, with no overlap and nothing left out. The page’s figures satisfy the relationships between the modes, and checking one against the others is a quick sanity test: if exactly, at-most and at-least do not hang together sensibly, an input is wrong, because the mathematics relating them has no freedom to be inconsistent.

The cards example

Drawing cards is the classic hypergeometric situation, because a deck is drawn without replacement and the composition is known exactly. Take a 52-card deck with 4 aces, draw 5 cards, and ask for exactly 2 aces. Here N = 52, K = 4, n = 5 and k = 2. The numerator is C(4,2) × C(48,3) = 6 × 17,296, the denominator is C(52,5) = 2,598,960, and the probability is 0.0399, or 3.99%. About one hand in twenty-five contains exactly two aces, which matches the intuition that two aces in five cards is uncommon but far from rare.

The cumulative figures for the same hand tell the fuller story. The at-most probability is 0.9982, meaning that getting 2 or fewer aces is nearly certain, which is unsurprising when aces are only 4 of 52 cards. The at-least probability is 0.0417, meaning that getting 2 or more aces happens about 4% of the time, only slightly above the exactly-2 figure, because getting 3 or 4 aces is much rarer still and adds little to the total. When the exactly and at-least figures are close, the higher outcomes contribute almost nothing, and the distinction between the modes barely matters. When they are far apart, as in the defaults, the distinction matters greatly.

The mean and variance for the cards case describe the long run. The mean is 0.3846 aces per 5-card hand, which is the average over many hands, not a prediction for any single hand: most hands have 0 aces, some have 1, a few have 2, and the average settles at about 0.38. The variance is 0.3272, describing how spread out the counts are around that mean. A mean below 1 with a modest variance is the signature of a rare event counted over few draws, and it warns against expecting the mean in any particular hand.

Use the cards example to calibrate intuition before applying the distribution elsewhere. If a result for your own problem looks nothing like the cards pattern when the proportions are similar, check the inputs: a population, success count, draw size or target that differs by an order of magnitude from the cards case should produce a correspondingly different probability, and similarity of setup with wildly different answers is a signal to re-examine the numbers.

The none case, and why at-least is 1

Asking for zero successes is a legitimate question, and the page answers it cleanly. With N = 50, K = 10, n = 5 and k = 0, the numerator is C(10,0) × C(40,5) = 1 × 658,008, the denominator is C(50,5) = 2,118,760, and the probability is 0.3106, or 31.06%. About a third of the time, a 5-draw from this population contains no successes at all, which is unsurprising when successes are only a fifth of the population and the draw is small.

The cumulative figures for the none case contain a small lesson. The at-most probability is also 0.3106, because getting 0 or fewer successes is the same event as getting exactly 0: there is nothing below zero to add. The at-least probability is 1.0000, because getting 0 or more successes covers every possible outcome, and every draw must produce some count from 0 upward. These are not quirks of the page; they are boundary facts of the distribution, and they provide a check on any implementation: at k = 0, at-most must equal exactly, and at-least must equal 1.

The mean for this case is 1.0000 and the variance is 0.7347. The mean of exactly 1 is a coincidence of the numbers, 5 draws with a 10-in-50 success proportion, but it is a useful one: it says that over many draws you average one success, even though any single draw gives 0, 1, 2 or more, and the probability of exactly 0 is nearly a third. Averages describe repetitions, not instances, and the none case is the clearest demonstration that the most likely single outcome can differ from the mean.

None cases matter practically whenever the question is about avoiding something: drawing no defective items from a batch, finding no errors in a sample, or getting no successes in a trial. The probability of none is often the complement of the probability of at least one, and the page gives both, so either framing is available. If the probability of none is high, the sample is too small or the success proportion too low to expect a success, and that conclusion, drawn before sampling, saves wasted effort.

Designing a sampling plan

The hypergeometric distribution is also a design tool: before sampling, it tells you what a sample of a given size can and cannot reveal about a population. The design questions are the distribution’s inputs in reverse. Instead of asking what probability a fixed sample gives, ask what sample size gives a useful probability, or what population composition makes a sample informative. The page answers the forward question for any inputs, and running it across candidate inputs is how the reverse questions get answered.

Sample size trades against certainty in a predictable way. Larger samples narrow the distribution: the mean stays at n × K ÷ N in proportion, but the variance’s finite-population correction shrinks as n approaches N, because a sample that covers most of the population leaves little unknown. A sample of 4 from 20, as in the defaults, leaves much unknown, and the probability of exactly 2 successes is only 0.2167, with substantial probability spread across neighbouring counts. A sample of 16 from the same 20 would concentrate the counts tightly, because most of the population is observed. The cost of certainty is sample size, and the page quantifies the trade.

Population composition trades against sample size differently. When successes are rare, as aces in a deck, even a moderate sample usually finds none, and the informative event is finding at least one, whose probability is the at-least figure. When successes are common, the informative event is the exact count or the at-most figure. Design the sample around the event that matters: if the question is whether any defect exists, size the sample so the at-least probability for one defect is high; if the question is the defect rate, size it so the exact-count distribution is tight enough to distinguish rates of interest.

Repeated sampling adds another dimension. A single sample’s probability describes one draw; a programme of samples describes many, and the mean and variance across samples follow the same distribution. If a single sample has a 0.3106 probability of containing no successes, as in the none case, then repeated samples will show none about a third of the time, and a run of none results is expected, not alarming. Interpreting a sampling programme requires the distribution’s long-run view, not just the single-sample figure, and the page’s mean and variance supply that view.

Finally, design for the decision, not for the statistic. A sample that distinguishes 0 from 1 success may be enough to accept or reject a batch, while a sample that estimates a rate to within a percent may need to be far larger. State the decision rule first, what counts will trigger which action, then use the page to find the sample size and population assumptions under which the rule works reliably. A sampling plan designed backwards from its decision is efficient; one designed forwards from convenience often measures the wrong thing precisely.

Mean and variance: what to expect

The mean of a hypergeometric count is n × K ÷ N: the draw size multiplied by the population success proportion. For the defaults, 4 × 5 ÷ 20 = 1.0000. For the cards case, 5 × 4 ÷ 52 = 0.3846. For the none case, 5 × 10 ÷ 50 = 1.0000. The formula is intuitive: draw n items from a population that is K/N successes, and on average the successes in the draw match the population proportion. No combination counting is needed for the mean, which is why it is the first figure to check when a result looks wrong.

The variance is less intuitive but equally systematic: n × (K/N) × (1 − K/N) × ((N−n) ÷ (N−1)). The first three factors are the binomial variance, the variance if draws were independent, and the last factor is the finite-population correction, which shrinks the variance because without replacement, the draws constrain each other. For the defaults the variance is 0.6316, for the cards case 0.3272, and for the none case 0.7347. Each of these is smaller than the corresponding binomial variance, exactly as the correction predicts, and the gap grows as the draw becomes a larger fraction of the population.

Read mean and variance together, not the mean alone. A mean of 1 with a variance of 0.63 describes counts that cluster near 1 but frequently hit 0 or 2. A mean of 0.38 with a variance of 0.33 describes counts that are usually 0, sometimes 1, rarely more. The variance tells you how much the mean can be trusted as a description of a single draw, and for small draws with rare successes, the answer is: not much. Plan for the distribution, not the average.

As the population grows large relative to the draw, the finite-population correction approaches 1 and the hypergeometric approaches the binomial. That is the precise sense in which replacement stops mattering: when n is tiny compared with N, removing a few items barely changes the composition. When n is a substantial fraction of N, as in the defaults where 4 of 20 are drawn, the correction matters and the binomial would give a noticeably different answer. The page uses the exact hypergeometric throughout, so no approximation decision is needed, but knowing when the approximation would be safe helps you judge results from other sources.

Hypergeometric versus binomial: when replacement matters

The choice between the hypergeometric and binomial distributions is a choice about the sampling process, not about convenience. If items are drawn without replacement from a finite population, the hypergeometric is exact and the binomial is an approximation. If items are drawn with replacement, or each trial is independent with a fixed success probability, the binomial is exact and the hypergeometric does not apply. Applying the wrong distribution gives a wrong probability, even when the inputs look similar, because the two models describe different worlds.

The practical test is whether one draw changes the next draw’s probability. Drawing cards changes it, because the deck loses a card. Drawing balls from an urn without replacing them changes it. Sampling defective items from a batch without replacement changes it. Flipping a coin does not change it, rolling dice does not change it, and surveying a huge population where each respondent is a negligible fraction of the whole changes it so little that the binomial is an excellent approximation. Ask what happens physically after each draw, and the distribution chooses itself.

Approximation quality follows the draw fraction. When n is a small fraction of N, the hypergeometric and binomial probabilities are close, and either will do for rough purposes. When n is a large fraction, as in the defaults where a fifth of the population is drawn, they diverge, and the exact distribution is necessary. The page removes the dilemma by computing the exact distribution always, but the understanding matters when you read results computed elsewhere: a binomial figure quoted for a without-replacement problem is an approximation, and its error grows with the draw fraction.

Finally, remember that both distributions describe counts, not causes. A hypergeometric probability of 0.2167 for exactly 2 successes does not say why a particular draw gave 2 successes, and it does not predict the next draw’s outcome. It says that over many repetitions of the same sampling process, about 21.67% of draws will show exactly 2 successes. Probability is a property of the process repeated, and a single draw remains, as always, a matter of which items happened to come out.

Without replacement is the whole idea

The hypergeometric distribution exists for one reason: draws without replacement change the odds. Draw an ace from a deck and the next card’s chance of being an ace falls from 4/52 to 3/51. The binomial distribution ignores that change; the hypergeometric builds it in, counting favourable draws against all possible draws with combinations. If your problem involves cards, batches, audits, or any finite population sampled without putting items back, this is the distribution — and the sample size relative to the population decides how much it matters. As a rule of thumb, when the sample exceeds about 5% of the population, the binomial approximation stops being good enough.

The mean is familiar; the variance is the surprise

The expected value, n × (K/N), matches the binomial mean exactly — each draw still has a K/N chance of success on its own. What changes is the variance, which is smaller by the finite population correction (N − n)/(N − 1). Sampling without replacement is less variable because early draws constrain later ones: you cannot draw six aces from a four-ace deck, and the distribution knows it. As the population grows large relative to the sample, the correction approaches 1 and the hypergeometric converges to the binomial, which is the formal justification for using the simpler distribution on large populations.

Frequently asked questions

What is a hypergeometric distribution in simple words?

It is the distribution of successes when you draw items from a finite group without putting them back. Every draw changes the mix that remains, so the odds change on every draw.

How do you calculate a hypergeometric probability?

Use P(X = k) = C(K, k) times C(N minus K, n minus k), divided by C(N, n). For N = 20, K = 5, n = 4, k = 2, that is 10 times 105 divided by 4845, which is 0.2167.

What is the difference between hypergeometric and binomial?

Hypergeometric draws are made without replacement, so the odds change after every draw. Binomial draws are made with replacement, so the success probability stays the same on every draw.

What are the mean and variance of a hypergeometric distribution?

The mean is n times K divided by N. The variance is n times (K divided by N) times ((N minus K) divided by N) times ((N minus n) divided by (N minus 1)), where the last factor is the finite population correction.

Can k be larger than K or larger than n?

No. You cannot draw more successes than exist in the population, and you cannot draw more successes than the number of items you draw. This calculator shows an error for such values instead of a result.

When is the hypergeometric distribution used in real life?

It is used for quality control sampling from a batch, card games, lottery style draws from a fixed set, and acceptance testing, anywhere items are drawn from a known finite group without replacement.

What does “without replacement” change?

Everything about the probabilities after the first draw. Each draw removes an item, so the composition of what remains changes, and later draws face different odds. With replacement, or with independent trials, the odds stay constant, which is the binomial world, not the hypergeometric one.

Why is P(X at least 0) always 1?

Because a count cannot be negative, so “0 or more” covers every possible outcome. The none case on this page shows it: at k = 0 the at-least probability is 1.0000, while the at-most probability equals the exactly probability, 0.3106.

What if k is larger than K or n?

Then the event cannot happen, and its probability is 0. You cannot draw more successes than exist in the population, or more than you draw in total, so such inputs describe an impossible event rather than a hard calculation.

When should I use the binomial instead?

When draws are with replacement, or each trial is independent with a fixed success probability, or the population is so large relative to the draw that removing items barely changes the composition. For a finite population drawn without replacement, the hypergeometric on this page is the exact choice.

When do I use hypergeometric instead of binomial?

When sampling without replacement from a finite population — cards, batches, audit samples. If each trial is independent (coins, dice, with replacement), use the binomial.

What is the formula?

P(X = k) = [C(K,k) × C(N−K, n−k)] / C(N,n), where C(a,b) is "a choose b". The numerator counts favourable draws; the denominator counts all possible draws.

Why is the variance smaller than the binomial variance?

Because draws without replacement are negatively correlated — a success now makes a success next draw less likely — which shrinks the spread. The finite population correction (N−n)/(N−1) quantifies it.

What is the probability of two aces in five cards?

About 4.0%: C(4,2) × C(48,3) / C(52,5) = 103,776 / 2,598,960 ≈ 0.0399.

This calculator is an educational tool for hypergeometric probabilities. It assumes a finite population with a known number of success states, draws made without replacement, and every selection equally likely.

↑