Hypergeometric distribution calculator

Enter the population size N, the number of successes K in it, the number of draws n and the count k you are interested in. You get the exact probability, the cumulative and tail probabilities, the mean and standard deviation, and a chart of the distribution.

All items, for example 52 cards. A whole number up to 10000000.
Items that count as a success, for example 4 aces.
How many items are drawn without putting them back.
The count you want the probability of, from 0 to n.
P(X = k)0.2994736356
P(X ≤ k)
0.9583156339
P(X < k)
0.6588419983
P(X ≥ k)
0.3411580017
P(X > k)
0.04168436605
Mean n·K / N
0.3846153846
Variance
0.3271841281
Standard deviation
0.572000112

Runs in your browser: nothing you enter is sent anywhere.

How to use it

  1. Enter N, K, n and k.
  2. Read P(X = k) first, then the cumulative and tail probabilities.
  3. The chart shows the whole distribution with k highlighted.

How it works

The possible counts run from max(0, n − (N − K)) to min(n, K). The calculator starts from the lowest count and uses the ratio between neighbours, P(k + 1) / P(k) = (K − k)(n − k) / ((k + 1)(N − K − n + k + 1)), in logarithms so that large populations do not overflow, then scales the values to add up to 1.

Worked example

An urn holds 10 balls, 5 of them red. Draw 3 without looking: P(exactly 2 red) = C(5, 2) · C(5, 1) / C(10, 3) = 10 · 5 / 120 = 0.4167, and P(at least 2 red) = (50 + 10) / 120 = 0.5.

Tips

  • Card games, lottery matches, defect sampling and capture–recapture counts are all hypergeometric.
  • A k outside the possible range has probability 0, which the tool shows rather than an error.

Frequently asked questions

What is the hypergeometric formula?

P(X = k) = C(K, k) · C(N − K, n − k) / C(N, n): the ways to pick k of the successes and n − k of the failures, divided by all ways to pick n items. For one ace in a five-card hand: C(4, 1) · C(48, 4) / C(52, 5) = 4 · 194580 / 2598960 ≈ 0.2995.

How is it different from the binomial distribution?

The binomial assumes each draw has the same chance, as when items are put back. Without replacement the chance changes after every draw, which the hypergeometric distribution accounts for. When the population is much larger than the sample, the two give almost the same numbers.

How do I get the chance of at least one?

Set k = 1 and read P(X ≥ 1). For at least one ace in five cards it is 1 − C(48, 5)/C(52, 5) ≈ 0.3412.

What are the mean and variance?

Mean n·K/N and variance n·(K/N)·(1 − K/N)·(N − n)/(N − 1). The last factor, the finite population correction, makes the spread smaller than for the binomial.

More in Math

All tools in this category: Math ·Updated November 4, 2026

Privacy choices

Google Analytics shows us which tools are used and whether they work. It may set cookies. Your choice is kept in this browser.