Hardy-Weinberg Equilibrium Calculator
Calculate allele and genotype frequencies using the Hardy-Weinberg principle. Find whether a population is evolving by testing equilibrium conditions.
As an Amazon Associate and CJ Affiliate publisher we earn from qualifying purchases. Prices and availability may vary.
Hardy-Weinberg Principle Guide
What's the key thing to understand about The Hardy-Weinberg Equations?
The Hardy-Weinberg principle predicts genotype frequencies in a non-evolving population. Two equations: p + q = 1 (allele frequencies sum to 1), and p² + 2pq + q² = 1 (genotype frequencies sum to 1). Where p = frequency of dominant allele (A), q = frequency of recessive allele (a), p² = frequency of AA homozygotes, 2pq = frequency of Aa heterozygotes (carriers), q² = frequency of aa homozygotes. If the recessive phenotype frequency is known (= q²), then q = √(q²) and p = 1 − q.
What should I know about Hardy-Weinberg Assumptions?
The principle holds only when these conditions are met: large population (no genetic drift), random mating (no sexual selection), no natural selection (all genotypes equally fit), no mutation, and no migration (gene flow). If observed genotype frequencies differ significantly from Hardy-Weinberg expectations, at least one of these conditions is violated — meaning the population is evolving. Testing for H-W equilibrium is the standard first step in population genetics analysis.
What do I need to know about Calculating Carrier Frequency?
One important application: estimating carrier frequency for recessive genetic conditions. Cystic fibrosis: approximately 1 in 2,500 UK births are affected (aa = q² = 1/2500). So q = 1/50 = 0.02, p = 0.98, carrier frequency = 2pq = 2 × 0.98 × 0.02 ≈ 1/25 (about 4% of the UK population). This means roughly 1 in 25 people carry one CF allele without knowing — relevant for genetic counselling and understanding why recessive conditions persist in populations despite selection against them.
What do I need to know about Evolution and Departure from Equilibrium?
Comparing observed vs expected genotype frequencies tests whether a population is evolving. Excess homozygotes relative to H-W expectation suggests: inbreeding (non-random mating), recent founder effect, or population structure. Deficit of a genotype suggests natural selection against it. Allele frequency change over generations is the fundamental definition of evolution at the population level. Hardy-Weinberg provides the null hypothesis (no evolution) against which to test observed data.
What do I need to know about a Worked Hardy-Weinberg Example?
Suppose a survey of 1,000 individuals finds 640 with the dominant phenotype and 360 with the recessive phenotype. Since aa individuals show only the recessive phenotype, q^2 = 360/1000 = 0.36, so q = sqrt(0.36) = 0.6. Then p = 1 - q = 0.4. Expected genotype frequencies: AA = p^2 = 0.16 (160 individuals), Aa = 2pq = 2(0.4)(0.6) = 0.48 (480 individuals), aa = q^2 = 0.36 (360 individuals). Note both AA and Aa individuals show the dominant phenotype, so the observed 640 dominant-phenotype individuals should match the predicted AA + Aa = 160 + 480 = 640, confirming internal consistency. This structure — start from the only genotype that can be counted directly from phenotype, usually the homozygous recessive, since it is the only genotype uniquely identified by phenotype under complete dominance — is the standard first step in essentially every Hardy-Weinberg problem.
What's the key thing to understand about Testing for Hardy-Weinberg Equilibrium?
To test statistically whether a real population matches Hardy-Weinberg expectations, biologists compare observed genotype counts against expected counts using a chi-squared test: chi-squared = sum of (observed minus expected)^2 / expected, summed across the three genotype categories. The degrees of freedom for this test is 1, not 2, because calculating p and q from the data itself uses up one degree of freedom beyond the usual (categories minus 1). A calculated chi-squared value above the critical value (3.84 at the 5% significance level, 1 degree of freedom) indicates the population significantly deviates from Hardy-Weinberg equilibrium — suggesting one or more underlying assumptions (random mating, no selection, no mutation, no migration, large population) is being violated. This statistical test is routinely used in conservation genetics and epidemiology: a significant deviation showing excess homozygotes across many loci can signal inbreeding or population substructure, while deviation at a single specific locus more often points to selection acting on that gene.
What should I know about Hardy-Weinberg in Conservation Genetics?
Real populations rarely sit at perfect Hardy-Weinberg equilibrium, and the gap is itself useful information. A population bottleneck or founder event (a small number of individuals starting a new population) randomly strips out alleles and reduces heterozygosity, pulling observed genotype frequencies away from the equilibrium prediction. Conservation geneticists quantify this with the inbreeding coefficient, F = 1 minus the ratio of observed to expected heterozygosity (Ho/He). An F close to zero suggests a healthy, randomly mating population; a strongly positive F flags inbreeding, which is linked to inbreeding depression — reduced fertility, weaker immune function and lower survival in small, isolated groups such as endangered species in fragmented habitats or captive breeding programmes. This is why zoos and conservation bodies track heterozygosity loss across generations: a population that keeps looking less and less like its Hardy-Weinberg prediction is often a population losing genetic diversity it cannot easily recover. The same logic underpins human population screening, where unexpectedly high carrier frequencies for a recessive condition in an isolated community can signal historical founder effects rather than a change in mutation rate.
Worked Example: Carrier Frequency From Disease Incidence
Cystic fibrosis (a recessive condition) affects about 1 in 2,500 births in a population, so q² = 1/2500 = 0.0004. Solving for the recessive allele frequency: q = √0.0004 = 0.02 (2%). The dominant allele frequency is p = 1 - q = 0.98. Using the Hardy-Weinberg genotype proportions p² + 2pq + q² = 1, the proportion of carriers (heterozygotes, 2pq) is: 2pq = 2 × 0.98 × 0.02 = 0.0392, or about 3.92% — roughly 1 in 25 people This is the classic and often startling result of Hardy-Weinberg carrier calculations: although only 1 in 2,500 people has the condition itself, roughly 1 in 25 people silently carries one copy of the recessive allele without being affected — a 100-fold difference between visible incidence and hidden carrier frequency, which is why genetic counselling for recessive conditions focuses heavily on carrier screening rather than just counting affected individuals.
Worked Example: Expected Genotype Counts in a Population
In a population of 1,000 individuals with allele frequencies p = 0.7 (dominant allele) and q = 0.3 (recessive allele), find the expected number of each genotype under Hardy-Weinberg equilibrium. Using p² + 2pq + q² = 1 and multiplying each term by the population size: Expected AA = p² × N = 0.7² × 1,000 = 0.49 × 1,000 = 490 individuals Expected Aa = 2pq × N = 2 × 0.7 × 0.3 × 1,000 = 0.42 × 1,000 = 420 individuals Expected aa = q² × N = 0.3² × 1,000 = 0.09 × 1,000 = 90 individuals Checking the total: 490 + 420 + 90 = 1,000 ✓. If a real survey of this population instead found, say, 550 AA, 350 Aa, and 100 aa individuals, the substantial deviation from these expected numbers (particularly the AA excess and Aa shortfall) would suggest the population is NOT in Hardy-Weinberg equilibrium — possibly due to non-random mating, selection against the heterozygote, or one of the other idealised assumptions (no migration, no mutation, infinite population size, no selection) being violated in this real population.
Checking a Real Population Against Hardy-Weinberg Expectations
If observed genotype counts in a real sample differ noticeably from the Hardy-Weinberg expected counts (calculated from the observed allele frequencies), that mismatch is itself informative rather than just a measurement error to be ignored. A statistically significant excess of homozygotes paired with a shortfall of heterozygotes often points to inbreeding or assortative mating (like tending to mate with like); the reverse pattern — excess heterozygotes — can indicate heterozygote advantage (where carrying two different alleles confers a survival benefit, as famously seen with sickle-cell trait and malaria resistance). Biologists formally test these deviations using a chi-squared goodness-of-fit test comparing observed to Hardy-Weinberg-expected counts, rather than relying on inspection alone, since small samples can show apparent deviations purely by chance.
A Note on Why the Assumptions Rarely Hold Perfectly
The Hardy-Weinberg model assumes an infinitely large population, completely random mating, no mutation, no migration, and no natural selection — a deliberately idealised baseline rather than a description of any real population. Its real value isn't predicting exact genotype frequencies in nature, but providing a null model: by calculating what genotype frequencies SHOULD look like if none of those disrupting forces were acting, biologists can detect and measure the effect of real evolutionary forces by looking at how far an actual population deviates from the Hardy-Weinberg prediction, and in which direction.