Find the chance of k successes when you draw n items without replacement, like aces in a poker hand or defective parts in a sample. Exact, with every outcome listed.
The hypergeometric formula
Use it when you draw without putting items back, so each draw changes the odds for the next one.
P(X = k) = C(K, k) × C(N − K, n − k) ÷ C(N, n)
Mean = n × K ÷ N · Variance = n × (K ÷ N) × (1 − K ÷ N) × (N − n) ÷ (N − 1)
C(n, k) is "n choose k", the number of ways to pick k items from n. Here they're computed exactly with whole-number arithmetic for populations up to 3,000, so even huge counts like C(3000, 1500) lose no digits. Larger populations use log-gamma, which is accurate to about 7 significant figures, more than the 6 decimal places shown. The cumulative answers (≤, ≥, <, >) add up the exact terms.
Worked example: aces in a poker hand
There are C(52, 5) = 2,598,960 possible 5-card hands. To get exactly 2 aces, choose 2 of the 4 aces, C(4, 2) = 6 ways, and 3 of the 48 other cards, C(48, 3) = 17,296 ways:
P(X = 2) = 6 × 17,296 ÷ 2,598,960 = 103,776 ÷ 2,598,960 = 2,162/54,145 ≈ 0.039930
So about 4.0% of hands have exactly two aces. The chance of at least one ace is 1 − C(48, 5) ÷ C(52, 5) = 1 − 1,712,304 ÷ 2,598,960 = 0.341158, about 34.1%. The average is 5 × 4 ÷ 52 = 0.385 aces per hand.
| Aces in 5 cards | Hands | Probability |
|---|
| 0 | 1,712,304 | 0.658842 |
| 1 | 778,320 | 0.299474 |
| 2 | 103,776 | 0.039930 |
| 3 | 4,512 | 0.001736 |
| 4 | 48 | 0.000018 |
Quality control: a box of 20 parts has 6 defective ones. You test 5 at random. The chance exactly 2 are defective is C(6, 2) × C(14, 3) ÷ C(20, 5) = 15 × 364 ÷ 15,504 = 455/1292 ≈ 0.3522.
Getting a realistic number
- This assumes every draw is equally likely, like a well-shuffled deck or a truly random sample.
- If you put each item back before the next draw, the odds don't change. That's the binomial distribution, not this one.
- When the sample is a small fraction of the population (a common rule of thumb is under 5%), the binomial distribution gives almost the same answer.
- "At least one" is usually easiest as 1 − P(X = 0), which is what P(X ≥ 1) shows.
Sources
How we checked this
Before every update, this calculator is run in a real browser with these known answers, and it must match all of them:
- Exactly 2 aces in a 5-card hand: 0.039930 ✓
- Same, exactly: 103,776 ÷ 2,598,960 = 2,162/54,145 ✓
- At least 1 ace in 5 cards: 0.341158 ✓
- 20 parts, 6 defective, sample 5: exactly 2 defective = 0.352167 ✓
- Mean for the aces example: 5 × 4 ÷ 52 = 0.38461538 ✓
- Edge: 3 successes from a population with only 2 is impossible ✓
- Edge: k larger than the sample is rejected ✓
Last checked October 26, 2026. Spotted something wrong? The math is done in your browser with the formula shown on this page, so you can check any result by hand.
Questions people ask
When do I use the hypergeometric distribution?
When you draw a fixed number of items without replacement from a group with a known number of successes, such as cards from a deck, defective parts from a batch, or winning numbers in a lottery draw.
What is the probability of getting 2 aces in a 5-card hand?
2,162/54,145, about 0.0399 or 4.0%. That's C(4, 2) × C(48, 3) ÷ C(52, 5) = 103,776 ÷ 2,598,960.
What's the difference between hypergeometric and binomial?
Binomial assumes the chance of success is the same on every try (with replacement). Hypergeometric draws without replacement, so the chance changes after each draw.
What do N, K, n and k mean?
N is the population size, K is how many in the population count as successes, n is how many you draw, and k is the number of successes you're asking about.
What is the mean of a hypergeometric distribution?
n × K ÷ N. For 5 cards from a deck with 4 aces it's 5 × 4 ÷ 52 ≈ 0.385 aces.