Hardy-Weinberg Equilibrium Calculator
Calculate allele and genotype frequencies using the Hardy-Weinberg equation p² + 2pq + q² = 1. Enter allele frequency p directly or calculate from observed genotype counts. Includes visual bar chart and verification. No signup, runs entirely in your browser.
How to Use the Hardy-Weinberg Calculator
- 1Choose your input mode — enter the allele frequency p directly, or switch to genotype counts.
- 2If a question gives the recessive phenotype frequency, that value is q² — take its square root to get q, then p = 1 − q.
- 3Read the three genotype frequencies — p² (AA), 2pq (Aa), q² (aa) — and the verification that they sum to 1.
- 4Use the bar chart to compare carrier frequency (2pq) against affected frequency (q²).
Worked Example: Cystic Fibrosis Carrier Frequency
Cystic fibrosis is a recessive condition affecting roughly 1 in 2,500 people of European descent. That affected frequency is q², so q = √(1/2500) = 1/50 = 0.02. The dominant allele frequency is p = 1 − 0.02 = 0.98. The carrier frequency — heterozygotes who show no symptoms but can pass the allele on — is 2pq = 2 × 0.98 × 0.02 = 0.0392, or about 1 in 25 people.
That result is the reason the equation matters for public health: only 1 in 2,500 people have the disease, but 1 in 25 carry it — a hundred times more common. The carriers are the hidden reservoir of the allele, which is why genetic screening targets prospective parents rather than just affected individuals. Whenever q is small, 2pq dwarfs q², and this calculator makes that gap immediately visible in the bar chart.
Hardy-Weinberg Revision Tips
Start from the recessive phenotype
Exam questions usually give you the frequency of the recessive phenotype (e.g. "1 in 10,000 have albinism"). That frequency is q². Take the square root to get q, then p = 1 − q, and calculate the rest.
Remember p + q = 1
This constraint is separate from the genotype equation. Since there are only two alleles (A and a), their frequencies must sum to 1. Always check: if p = 0.7, then q must be 0.3.
Carrier frequency
The heterozygote (carrier) frequency 2pq is often the key result. For a rare recessive allele (small q), the carrier frequency 2pq is much larger than the q² frequency of affected individuals — this matters for genetic screening.
Testing HWE in practice
Real populations rarely meet all five HWE conditions simultaneously. Chi-squared tests compare observed genotype frequencies to HWE-predicted frequencies to determine whether the deviation is statistically significant.
Frequently Asked Questions
What is Hardy-Weinberg equilibrium?
Hardy-Weinberg equilibrium describes a theoretical population where allele frequencies remain constant generation to generation in the absence of evolution. It requires: no mutation, no migration, random mating, very large population, and no natural selection.
What is the Hardy-Weinberg equation?
p² + 2pq + q² = 1, where p is the frequency of the dominant allele (A) and q is the frequency of the recessive allele (a). p² represents homozygous dominant (AA) frequency, 2pq represents heterozygous (Aa) frequency, and q² represents homozygous recessive (aa) frequency.
How do I find p if I only know q²?
If you know the frequency of the recessive phenotype, that equals q² (since only aa individuals express it). Take the square root to get q, then p = 1 − q. This is the most common exam calculation.
When is a population NOT in Hardy-Weinberg equilibrium?
A population deviates from HWE when any of the five conditions are violated: natural selection acts on the trait, there is non-random mating (inbreeding or assortative mating), mutations occur, individuals migrate in or out, or the population is small (genetic drift occurs).
What does the "from genotype counts" mode do?
Enter the observed counts of homozygous dominant (AA), heterozygous (Aa), and homozygous recessive (aa) individuals. The calculator computes allele frequencies from these counts and then applies the HWE equation. This lets you test whether an observed population matches HWE predictions.
Is my data sent anywhere?
No. All calculations are performed locally in your browser.