📊 Hardy–Weinberg Equilibrium Calculator
Find allele frequencies (p and q), the expected Hardy–Weinberg genotype proportions, and a χ² test of whether a population is in equilibrium.
Enter the observed number of individuals of each genotype.
Allele frequencies
p = 0.543 q = 0.458
p = (2·AA + Aa) / (2·N) · q = 1 − p · N = 1000
χ² goodness-of-fit
χ² = 0.221 · df 1 · p = 0.638
✓ Consistent with Hardy–Weinberg equilibrium (p > 0.05)
| Genotype | Observed | Expected (HWE) |
|---|---|---|
| AA (p²) | 298 | 294.3 |
| Aa (2pq) | 489 | 496.4 |
| aa (q²) | 213 | 209.3 |
Expected counts from p² + 2pq + q² = 1. A p-value above 0.05 means the observed counts are consistent with equilibrium; below 0.05 indicates a significant departure.
How the hardy–weinberg equilibrium calculator works
Enter the observed counts of the three genotypes (homozygous dominant, heterozygous, homozygous recessive). The tool finds the allele frequencies p and q, the expected counts under p² + 2pq + q² = 1, and runs a chi-square goodness-of-fit test (1 degree of freedom) comparing observed to expected. A p-value above 0.05 means you cannot reject equilibrium.
The chi-square test reuses the same exact special-function maths as our statistics tools. The result is a teaching verdict — "consistent with Hardy–Weinberg equilibrium" or "significant departure" — with the numbers shown.
Frequently asked questions
What is the Hardy–Weinberg equation?
p² + 2pq + q² = 1, where p and q are the frequencies of the two alleles, p² is the expected frequency of homozygous dominant, 2pq of heterozygotes, and q² of homozygous recessive. It predicts genotype frequencies when a population is not evolving.
How do I calculate allele frequency from genotypes?
p = (2 × AA + Aa) / (2 × total individuals), and q = 1 − p. Each homozygote contributes two copies of its allele and each heterozygote one of each. This tool does it from your genotype counts.
How do I test for Hardy–Weinberg equilibrium?
Compare observed genotype counts to those expected from p² , 2pq and q² using a chi-square goodness-of-fit test with 1 degree of freedom. If the p-value is above 0.05, the population is consistent with equilibrium; below 0.05 indicates a significant departure.
What does a low p-value mean here?
A p-value below 0.05 means the observed genotype counts differ from Hardy–Weinberg expectations more than chance would explain — suggesting a factor like selection, non-random mating, migration or drift is acting.
Why 1 degree of freedom?
There are three genotype classes, minus one for the fixed total, minus one for the estimated allele frequency, leaving 1 degree of freedom for a two-allele locus.
What are the assumptions of Hardy–Weinberg?
No selection, no mutation, no migration, infinite population size (no drift) and random mating. When genotype frequencies depart from the equation, one of these assumptions is being violated.
Related biology & lab tools
From the blog
Hardy–Weinberg Equilibrium: Allele Frequencies, p²+2pq+q², and the χ² Test
Hardy–Weinberg predicts genotype frequencies from allele frequencies: p²+2pq+q²=1. Find p and q from genotype counts (p = (2·AA+Aa)/2N), compute expected counts, and test for equilibrium with a chi-square goodness-of-fit — with a worked example.
Punnett Squares: Monohybrid, Dihybrid, and Where the 9:3:3:1 Comes From
A monohybrid Aa × Aa cross gives 1:2:1 genotypes and a 3:1 phenotype ratio; a dihybrid AaBb × AaBb gives 9:3:3:1. How to fill the grid, read the ratios, and why larger crosses are so easy to get wrong by hand.