Hardy-Weinberg Calculator — Allele Frequency and Equilibrium
The Hardy-Weinberg principle is the null hypothesis of population genetics — it describes a theoretical population that is not evolving. Any deviation from Hardy-Weinberg equilibrium reveals that evolutionary forces are at work. This guide explains the equation, its five assumptions, and how to use it to detect evolution in real populations.
The Hardy-Weinberg Equation
For a gene with two alleles (A and a), where p = frequency of A and q = frequency of a:
| Term | Genotype | Meaning |
|---|---|---|
| p² | AA | Frequency of homozygous dominant |
| 2pq | Aa | Frequency of heterozygous |
| q² | aa | Frequency of homozygous recessive |
| p + q = 1 | — | All allele frequencies sum to 1 |
| p² + 2pq + q² = 1 | — | All genotype frequencies sum to 1 |
How to Use the Hardy-Weinberg Calculator
- Open the Hardy-Weinberg Calculator
- Enter the observed genotype counts (number of AA, Aa, aa individuals) from your population sample
- Click Calculate to compute allele frequencies p and q
- The tool displays expected genotype frequencies under Hardy-Weinberg equilibrium
- Compare observed vs expected — large differences suggest the population is evolving
Five Conditions for Hardy-Weinberg Equilibrium
A population is at Hardy-Weinberg equilibrium only when all five conditions are met simultaneously:
| Condition | Violation causes |
|---|---|
| No mutation | New alleles introduced, changing allele frequencies |
| No natural selection | Differential survival/reproduction alters genotype frequencies |
| Random mating (panmixia) | Assortative mating changes genotype but not allele frequencies |
| No gene flow | Migration introduces or removes alleles |
| Infinite population size | Genetic drift causes random allele frequency fluctuations |
No real population satisfies all five conditions perfectly — Hardy-Weinberg equilibrium is a mathematical baseline, not a description of real populations.
Applying Hardy-Weinberg in Practice
Estimating carrier frequency
If a recessive disease affects 1 in 10,000 people, then q² = 0.0001, so q = 0.01 and p = 0.99. The carrier frequency (2pq) = 2 × 0.99 × 0.01 ≈ 0.02, or about 1 in 50. This is how public health agencies estimate how many people carry recessive disease alleles in a population.
Testing for selection or drift
Survey genotype counts from a population sample. Calculate observed allele frequencies and expected genotype counts under Hardy-Weinberg. A chi-square test compares observed vs expected: a significant result (p < 0.05) indicates the population is not at equilibrium — suggesting selection, drift, non-random mating, or recent migration.
Codominant markers and direct genotyping
Hardy-Weinberg calculations are simplest for codominant alleles (where all three genotypes are distinguishable). For dominant-only traits, only q² (homozygous recessive) is directly observable — p² and 2pq cannot be separated without molecular genotyping. Modern SNP arrays allow direct counting of all three genotypes for thousands of loci simultaneously.
Common Questions
Can a population reach equilibrium in one generation?
Yes — for autosomal loci with random mating, a population reaches Hardy-Weinberg genotype frequencies after just one generation of random mating (starting from any initial genotype frequencies). Allele frequencies themselves remain constant every generation. This is one of the most striking results in population genetics.
What is genetic drift and why does it violate Hardy-Weinberg?
Genetic drift is random change in allele frequencies due to sampling variance in small populations. When a population is small, chance events (who survives, who mates) can cause allele frequencies to change without any selection pressure. Drift can cause allele fixation (frequency reaches 1.0) or loss (reaches 0.0) in finite populations.
What is the founder effect?
When a new population is established by a small number of individuals, it carries only a subset of the original gene pool's alleles. The new population's allele frequencies may differ substantially from the source population — purely by chance. This is a form of genetic drift and explains why certain genetic diseases are more common in isolated populations.
Calculate Allele Frequencies
Enter genotype counts and test for Hardy-Weinberg equilibrium with the Hardy-Weinberg Calculator — p and q frequencies, expected genotype ratios, and deviation analysis.
Open Hardy-Weinberg Calculator