Hardy-Weinberg Equilibrium Calculator
Calculate expected genotype frequencies under Hardy-Weinberg equilibrium.
Determine allele frequencies, test population assumptions, and explore evolutionary genetics.
What Is Hardy-Weinberg Equilibrium? The Hardy-Weinberg (HW) principle states that allele and genotype frequencies in a population remain constant from generation to generation in the absence of evolutionary forces. It was independently derived by Godfrey Hardy, a British mathematician, and Wilhelm Weinberg, a German physician, in 1908. The principle serves as the null hypothesis of population genetics — a baseline to detect evolution.
The Hardy-Weinberg Equations For a gene with two alleles (A and a), where p = frequency of A and q = frequency of a: p + q = 1 (allele frequencies sum to 1) p² + 2pq + q² = 1 (genotype frequencies sum to 1) p² = frequency of homozygous dominant (AA) 2pq = frequency of heterozygous (Aa) q² = frequency of homozygous recessive (aa)
The Five Assumptions Hardy-Weinberg equilibrium requires all five conditions to hold simultaneously:
- Large population size (no genetic drift)
- No mutation (allele frequencies don’t change due to mutation)
- No migration (no gene flow from other populations)
- Random mating (no sexual selection or assortative mating)
- No natural selection (all genotypes have equal fitness) Real populations violate at least one of these conditions — so HW is always an approximation.
How to Calculate Allele Frequencies from Observed Genotypes If you observe: AA=360, Aa=480, aa=160 (total = 1000 individuals): Total alleles = 2000. Copies of A = 360×2 + 480 = 1200. p = 1200/2000 = 0.6. q = 1 − p = 0.4. Expected HW genotypes: AA = 0.36 × 1000 = 360, Aa = 0.48 × 1000 = 480, aa = 0.16 × 1000 = 160. This population is in HW equilibrium (observed = expected).
Deviations from HW Equilibrium Excess homozygotes (vs expected): suggests inbreeding, assortative mating, or population subdivision. Excess heterozygotes (vs expected): heterozygote advantage (balancing selection) — example: sickle cell anemia and malaria resistance. Chi-square test is used to statistically test whether observed genotypes differ significantly from HW expectations.
Applications Estimating carrier frequency: if q² (recessive disease frequency) = 1/10,000, then q = 0.01, p = 0.99, carrier frequency 2pq ≈ 1/50. Cystic fibrosis: ~1 in 2,500 Europeans are affected (q²), so q ≈ 0.02 and carrier frequency ≈ 1 in 25. Forensic genetics: DNA profiling uses HW to calculate the probability of a random match in a population. Conservation biology: monitoring HW in small populations detects inbreeding and loss of diversity.