Hypergeometric Distribution Calculator

About Hypergeometric Distribution Calculator

A free, independent toolkit for one deceptively simple question: if you draw without putting anything back, what are the odds?

The question behind the site

Shuffle a deck and deal five cards. How likely is it that at least two are hearts? Pull 40 parts from a lot of 500 that hides 25 defects. How likely is it that your inspection finds none? Choose 12 jurors from a pool of 120. Does the panel you got look like chance, or like something else?

All three are the same question in different clothes. You have a population, some of it counts as a "success", and you draw a sample without putting anything back. The hypergeometric distribution gives the exact answer. Most calculators online hand you one number and leave you to trust it. We built Hypergeometric Distribution Calculator so that you can see where that number comes from, check it, and use it with confidence.

Who it is for

Each of the one-click examples on the calculator comes from a real situation people bring to this distribution:

  • Card players and deck-builders. "Hearts in a 5-card hand", "Aces in a poker hand" and "Lands in an opening hand" answer the questions players ask when building a deck or weighing a draw. Change the deck size or the number of copies and watch your odds move as you type.
  • Quality-control and audit teams. "Defects in a QC lot" shows how likely a sample is to miss every defect. That probability decides how many items you need to inspect before an "all clear" means anything.
  • Lottery players and the curious. "Lottery 6/49" turns a ticket into a precise probability, along with odds of "1 in x" that are easier to picture.
  • Researchers in law and the social sciences. "Jury selection" checks whether a panel's make-up is consistent with random selection from a pool.
  • Ecologists. "Capture–recapture" uses a range of outcomes (a ≤ X ≤ b) to show what counts of tagged animals to expect when estimating a population.
  • Students and teachers. Every part of the page updates live, which makes the site a hands-on companion to a statistics course. Change one number and the formula, the charts and the table all change with it.

A tour of the tools, and why each one is there

Parameters and probability types

Set the population size N, the successes in it K, the sample size n and the number of successes k, with a slider or by typing. Then pick the question you are actually asking: exactly k, at most k, less than k, at least k, more than k, or anywhere between a and b. Impossible values are corrected automatically, with a note that explains why. A typo can't quietly give you a meaningless answer.

The headline result and tail probabilities

Your answer appears as a probability, a percentage and odds of "1 in x", with a plain-English sentence that restates the question so you can confirm it is the one you meant. Next to it, all five tail probabilities are listed together. You will often need "at least" and "at most" side by side, for example to report a one-sided test or to compare two risks.

Summary statistics

The mean, variance, standard deviation, mode, skewness and range of possible outcomes describe the whole distribution at a glance. They tell you what a "typical" sample looks like before you ask about any single outcome.

Probability and cumulative charts

The probability mass function chart shows every possible outcome, with the outcomes in your selected region highlighted and the mean marked. Click a bar to make it your k. The cumulative chart shows how quickly the probability builds up, which is the easiest way to read off a threshold such as "how many successes cover 95% of samples?".

Draw from the urn

Simulation turns the abstract into something you can watch. Draw one sample to see a single random outcome, or run 2,000 draws and watch the simulated frequencies settle onto the exact bars. It is the most convincing way we know to show a student, a colleague or a sceptical manager that the maths describes reality.

Formula, worked with your numbers

The hypergeometric formula is written out with your own values substituted in. It shows the ways to pick the successes, the ways to pick the failures and the number of possible samples, so you can check the result by hand or copy the working into homework or a report.

Probability table and CSV download

The table lists P(X = x), P(X ≤ x) and P(X ≥ x) for every outcome, with your selected region highlighted. Click a row to set k. Download the full table as a CSV to use in a spreadsheet, a statistics package or an appendix.

Share links, dark mode and 18 languages

The share button copies a link that reopens the calculator with your exact inputs, which is handy for sending a scenario to a classmate or attaching it to a ticket. The calculator also works with a keyboard, on phones, in dark mode and in 18 languages.

How results are computed

  • The most likely outcome is computed exactly with log-gamma functions, so very large populations (up to 1,000,000 items) do not overflow.
  • Every other probability is reached from there using the exact ratio P(x+1)/P(x). This avoids the rounding errors of evaluating huge binomial coefficients directly.
  • Lower and upper tails are summed separately, so tiny tail probabilities keep their precision instead of being lost in 1 − x.
  • Binomial coefficients in the worked formula are shown exactly (using arbitrary-precision integers) whenever they fit, and in scientific notation otherwise.

How we check accuracy

Results are tested against textbook values. For example, the probability of at least two hearts in a five-card hand is 0.367047. They are also checked against independent simulation: the urn's 2,000-draw run is a visible, repeatable check that anyone can carry out. If you find a result you believe is wrong, please contact us with the inputs you used, or simply the share link, and we will investigate.

Who runs this site

Hypergeometric Distribution Calculator is an independent, non-commercial project. It is not affiliated with any university, publisher or commercial statistics package. It carries no advertising and does not sell or share data. The site is designed, written and maintained in-house, and every change to the calculation engine is checked against the reference values above before it is published.

Our principles

  • Free and private. Every calculation, chart, simulation and CSV file is produced in your browser. Your inputs are never sent to a server.
  • Transparent. The worked formula, the full table and the simulation let you verify any result yourself instead of taking it on trust.
  • Accessible. The calculator works with a keyboard, on phones, in dark mode and in 18 languages.

Get in touch

Feedback, corrections and feature requests are welcome, and so are new examples from your own field. Write to hello@hypergeometricdistributioncalculator.com or use the contact form. You can also go straight back to the hypergeometric distribution calculator.