biology calculators

Hardy-Weinberg Equilibrium Calculator

Calculates expected genotype frequencies for a two-allele gene under Hardy-Weinberg equilibrium. Useful in genetics courses and population studies to detect evolutionary forces at work.

About this calculator

The Hardy-Weinberg principle states that, in a large randomly mating population free from mutation, migration, selection, and genetic drift, allele and genotype frequencies remain constant across generations. For a gene with two alleles — dominant (p) and recessive (q) — the frequencies must satisfy p + q = 1. The expected genotype frequencies are given by the equation: p² + 2pq + q² = 1, where p² is the frequency of homozygous dominant individuals (AA), 2pq is the frequency of heterozygotes (Aa), and q² is the frequency of homozygous recessive individuals (aa). Comparing observed genotype frequencies to those predicted by this equation allows researchers to test whether a population is evolving. A significant deviation signals the action of natural selection, non-random mating, genetic drift, or gene flow.

How to use

Imagine a population where allele p has a frequency of 0.7 and allele q has a frequency of 0.3 (note: 0.7 + 0.3 = 1, as required). Apply the formula: p² + 2pq + q² = (0.7)² + 2(0.7)(0.3) + (0.3)² = 0.49 + 0.42 + 0.09 = 1.00. So you would expect 49% of individuals to be homozygous dominant (AA), 42% to be heterozygous (Aa), and 9% to be homozygous recessive (aa). If you then count actual genotypes in the population and find very different proportions, the population is likely not in equilibrium.

Frequently asked questions

What are the five conditions required for Hardy-Weinberg equilibrium?

A population is in Hardy-Weinberg equilibrium only when five conditions are met simultaneously: (1) the population is infinitely large, eliminating genetic drift; (2) mating is completely random; (3) there is no mutation converting one allele to another; (4) no migration brings new alleles in or takes existing ones out; and (5) natural selection does not favor any genotype. In practice, no real population perfectly meets all five conditions, which is why the Hardy-Weinberg model serves as a null hypothesis — deviations from it point to which evolutionary forces are operating.

How do you calculate allele frequencies from observed genotype counts?

If you know how many individuals carry each genotype, you can calculate allele frequencies directly. Count the total number of alleles in the population (2 × total individuals, since each diploid organism carries two copies). Then count all copies of allele A: each AA individual contributes 2 copies and each Aa individual contributes 1. Divide by total alleles to get p. Then q = 1 − p. Once p and q are known, plug them into the Hardy-Weinberg equation to get expected genotype frequencies, and compare those expectations to your observed counts using a chi-square test.

Why does Hardy-Weinberg equilibrium matter for studying human genetic diseases?

Hardy-Weinberg equilibrium lets geneticists estimate the frequency of carriers for recessive diseases even when carriers show no symptoms. If the frequency of an affected individual (aa, or q²) is known — say, 1 in 10,000 for phenylketonuria — then q = 0.01 and p = 0.99, giving a carrier frequency of 2pq ≈ 2%. This is crucial for genetic counseling, newborn screening program design, and estimating disease burden in a population. Deviations from HWE at a disease locus can also signal that selection, inbreeding, or another force is influencing that gene.