UTILS.
100% in-browser
⚖️

Hardy-Weinberg Equilibrium Calculator

Compute allele frequencies p and q, expected genotype frequencies and a chi-square test for Hardy-Weinberg equilibrium.

About this tool

This calculator works with the Hardy-Weinberg principle for a single gene with two alleles. You can start from observed genotype counts or from a known allele frequency. All calculations happen in your browser.

From counts of AA, Aa and aa individuals, the dominant allele frequency is p = (2·AA + Aa) / (2N) and q = 1 − p, where N is the total. The expected genotype counts under equilibrium are p²N, 2pqN and q²N. A chi-square goodness-of-fit statistic χ² = Σ (observed − expected)² / expected with one degree of freedom compares observed to expected; χ² above the 3.841 critical value means the population departs from equilibrium at the 0.05 level, and an approximate p-value is reported.

From an allele frequency p, the tool returns q = 1 − p and the equilibrium genotype frequencies p², 2pq and q²; entering a population size also gives the expected genotype counts. Remember that the frequencies always sum to one: p² + 2pq + q² = 1.

Frequently asked questions

How are p and q calculated from counts?
p, the dominant allele frequency, is (2 × AA + Aa) divided by twice the total number of individuals; q is 1 − p, the recessive allele frequency.
What does the chi-square value mean?
It measures how far the observed genotype counts are from the Hardy-Weinberg expectation. With one degree of freedom, a χ² above 3.841 indicates a statistically significant departure at the 0.05 level.
What are the equilibrium genotype frequencies?
Under Hardy-Weinberg equilibrium the frequencies are p² for AA, 2pq for Aa and q² for aa, and they always add up to 1.
Which assumptions does the model make?
It assumes a large randomly mating population with no mutation, migration, selection or genetic drift. Real populations only approximate these conditions.

More tools