Hypergeometric Distribution Calculator

Hypergeometric Distribution Calculator

Draw without replacement from a finite population and find the chance of exactly k successes — with the mean, variance, a PMF chart and a full distribution table.

Everything you could draw from
How many of the N are “successes”
How many items you take, without replacement
The value you want the probability of
P(X = 2)
0.2098

With N = 50, K = 10 and n = 5 draws, the mean number of successes is 1.0000 and the standard deviation is 0.8571.

P(X = k)
0.2098
P(X ≤ k)
0.9517
P(X ≥ k)
0.2581
Mean E(X)
1.0000
Variance
0.7347
Standard deviation
0.8571

Calculation

    Probability mass function

    Each bar is P(X = x) for N = 50, K = 10, n = 5. The bar at x = 2 is highlighted.

    With replacement, the same draw would be binomial with p = K/N = 0.2, giving P(X = 2) = 0.2048 — close to 0.2098 here, because N = 50 is large next to n = 5. The two drift apart when N is small.

    A hypergeometric distribution calculator finds the probability of drawing exactly k successes when you sample without replacement from a finite population — for example, the chance of two aces in a five-card hand, or three faulty parts in a quality-control sample. Enter the population size N, the number of successes K in the population, the number of draws n and the value k, and it returns the exact, at-most and at-least probabilities, the mean, variance and standard deviation, with a PMF chart and a full distribution table.

    How to use the hypergeometric distribution calculator

    1. Enter the population size N — everything you could draw from, for example 52 cards in a deck.
    2. Enter K, the number of successes in the population — the items you are counting, for example 4 aces.
    3. Enter n, the number of draws — how many items you take, without putting any back.
    4. Enter k, the number of successes you want the probability of, and choose whether you want P(X = k), P(X ≤ k) or P(X ≥ k).
    5. Read the headline probability, then check the results grid for the exact, at-most and at-least probabilities, the mean, variance and standard deviation. The calculation ledger shows every step, the chart draws the PMF, and the table lists every possible value of X.

    Try it now: with N = 50, K = 10, n = 5 and k = 2, the calculator gives P(X = 2) = 0.2098, a mean of 1.0000 and a variance of 0.7347. Click “Card deck — 2 aces” and it gives P(X = 2) = 0.0399 for a five-card hand.

    When should you use a hypergeometric distribution?

    Use a hypergeometric distribution when you are counting successes in a sample drawn without replacement from a finite population — for example, defective items in a batch, aces in a poker hand, or winning numbers on a lottery ticket. It is the right distribution when:

    • Each draw is made without replacement — once an item is drawn, it cannot be drawn again, so the odds change with every draw.
    • The population is finite and you know its size N and how many of its members are successes K.
    • You are counting how many successes land in your sample of n draws.
    • If you drew with replacement instead — putting each item back before the next draw — the count would be binomial, not hypergeometric.
    • The population is small relative to the sample, or you need exact probabilities; the binomial is only an approximation here.

    Because the draws are not independent, the variance is smaller than the binomial variance by the finite-population correction (N − n)/(N − 1) — see below. The same distribution powers Fisher’s exact test, which uses hypergeometric probabilities to test a 2×2 table. If your draws are made with replacement, use the binomial probability calculator instead, and for the family of distributions this one belongs to, see types of probability distributions.

    Hypergeometric vs binomial: when does replacement matter?

    The two distributions answer the same question — how many successes in n draws? — but they assume different things about the draw. The hypergeometric counts without replacement; the binomial counts with replacement, so the success probability stays fixed at p = K/N.

    SituationHypergeometricBinomial
    N = 50, K = 10, n = 5, k = 20.20980.2048
    N = 20, K = 5, n = 4, k = 10.46960.4219
    DrawsWithout replacementWith replacement
    Success probabilityChanges after every drawFixed at p = K/N
    Variancen · (K/N) · (1 − K/N) · (N − n)/(N − 1)n · p · (1 − p)

    With N = 50 and n = 5, the two answers are close — 0.2098 against 0.2048 — because removing five items from fifty barely changes the mix. That is why they agree here: N is large relative to n, so replacement barely matters. They drift apart when N is small: with N = 20, K = 5, n = 4 and k = 1, the hypergeometric gives 0.4696 while the binomial gives 0.4219 — a gap of nearly 0.05. As a rule of thumb, the binomial is a reasonable stand-in while the sample is a small fraction of the population (roughly n/N below 0.1); once the sample is a fifth or more of the population, the gap is hard to ignore.

    The finite-population correction

    The hypergeometric variance is the binomial variance times the finite-population correction (N − n)/(N − 1): Var(X) = n · (K/N) · (1 − K/N) · (N − n)/(N − 1). The correction is always between 0 and 1, so sampling without replacement is always less variable than sampling with replacement — you learn more from each draw, because you know the item you took is gone. When n is tiny next to N, the correction is close to 1 and the two variances nearly agree (for N = 50 and n = 5 it is 45/49 = 0.9184). When n = N you have drawn the whole population, the correction is 0, and the variance is 0 — there is nothing left to be uncertain about: you know exactly how many successes there are (all K of them).

    Worked examples

    Example 1 — a batch of parts (N = 50, K = 10, n = 5)

    A quality-control batch has 50 parts, 10 of which are faulty. You inspect 5 parts. What is the chance of finding exactly 2 faulty parts? P(X = 2) = C(10, 2) · C(40, 3) / C(50, 5) = 45 · 9,880 / 2,118,760 = 0.2098. The chance of finding none is P(X = 0) = 0.3106, of finding at most one is P(X ≤ 1) = 0.7419, and of finding three or more is P(X ≥ 3) = 0.0483. The mean number of faulty parts in a sample of 5 is E(X) = n · K / N = 1.0, with variance 0.7347 and standard deviation 0.8571.

    Example 2 — exactly two aces from a deck

    From a standard 52-card deck you are dealt 5 cards. What is the chance of exactly two aces? Here N = 52, K = 4, n = 5, k = 2: P(X = 2) = C(4, 2) · C(48, 3) / C(52, 5) = 6 · 17,296 / 2,598,960 = 0.0399 — about 1 in 25 hands. The binomial answer with replacement (p = 4/52 = 0.0769, n = 5) would be C(5, 2) · 0.0769² · 0.9231³ = 0.0465 — a little higher, because replacement lets you “draw” the same ace twice, which is impossible in a real hand.

    Example 3 — a small population (N = 20, K = 5, n = 4)

    A box holds 20 chocolates, 5 of them caramel. You take 4. The chance of exactly 1 caramel is P(X = 1) = C(5, 1) · C(15, 3) / C(20, 4) = 5 · 455 / 4,845 = 0.4696. The support runs from 0 to 4 successes, and the mean is n · K / N = 4 · 5 / 20 = 1.0.

    Frequently asked questions

    Hypergeometric vs binomial?

    Use the hypergeometric distribution when you draw without replacement from a finite population, so the chance of a success changes after every draw. Use the binomial when you draw with replacement (or from an effectively infinite population), so the success probability stays fixed at p = K/N. The two agree closely when the population is large relative to the sample — with N = 50, K = 10, n = 5 and k = 2, the hypergeometric gives 0.2098 and the binomial gives 0.2048 — and they drift apart when N is small.

    What is the finite-population correction?

    The finite-population correction is the factor (N − n)/(N − 1) in the hypergeometric variance: Var(X) = n · (K/N) · (1 − K/N) · (N − n)/(N − 1). It shrinks the variance below the binomial variance, because drawing without replacement removes uncertainty — you know the items you took are gone. When n = N the correction is 0 and the variance is 0: you have seen the whole population, so there is nothing left to be uncertain about.

    All examples on this page were recomputed with Python (scipy.stats), last updated 19 November 2026.

    See all 91 free statistics tools on Empirical Rule Calculators.