Hardy-Weinberg Equilibrium Calculator
Determine allele frequencies (p and q) and genotype frequencies (p2, 2pq, q2) for a population in Hardy-Weinberg equilibrium. Enter either allele frequency or the number of individuals with each phenotype.
The Hardy-Weinberg principle, independently formulated by mathematician G. H. Hardy and physician Wilhelm Weinberg in 1908, is the foundational theorem of population genetics. It states that under specific idealized conditions (large population, random mating, no mutation, no migration, no selection), allele and genotype frequencies remain constant from generation to generation — providing a stable baseline for analyzing genetic variation. While these conditions are rarely fully met in real populations, deviations from Hardy-Weinberg equilibrium reveal which evolutionary forces are acting on a population.
The Hardy-Weinberg equations are elegantly simple: p + q = 1 (allele frequencies sum to 1 for a two-allele system) and p² + 2pq + q² = 1 (genotype frequencies sum to 1). Where p = dominant allele frequency, q = recessive allele frequency, p² = homozygous dominant frequency, 2pq = heterozygous frequency, and q² = homozygous recessive frequency. From these two equations, knowing any one frequency lets you calculate all others — making Hardy-Weinberg a powerful tool for studying genetic disease prevalence, population structure, and evolutionary processes.
This calculator computes allele and genotype frequencies using Hardy-Weinberg equations. Use it for: population genetics coursework, predicting carrier frequencies for genetic diseases, understanding genotype distributions in populations, comparing observed vs. expected genotype frequencies (to test for HW equilibrium), conservation genetics, and evolutionary biology research. Important context: real populations often deviate from HW equilibrium due to natural selection, genetic drift (especially in small populations), migration (gene flow), mutations (rare but accumulating), assortative mating (non-random pairing), and inbreeding. These deviations indicate which evolutionary forces are operating — Hardy-Weinberg serves as the "null hypothesis" against which evolutionary change is measured.
Inputs
Results
p (dominant)
0.600
q (recessive)
0.400
Carriers (2pq)
48.0%
Genotype Frequencies
Hardy-Weinberg Results
| Parameter | Value |
|---|---|
| Dominant Allele Frequency (p) | 0.6000 |
| Recessive Allele Frequency (q) | 0.4000 |
| p + q | 1.0000 |
| Homozygous Dominant (p2) | 0.3600 = 36.00% |
| Heterozygous (2pq) | 0.4800 = 48.00% |
| Homozygous Recessive (q2) | 0.1600 = 16.00% |
| p2 + 2pq + q2 | 1.0000 |
| Hom. Dominant (n=100) | 36 individuals |
| Heterozygous (n=100) | 48 individuals |
| Hom. Recessive (n=100) | 16 individuals |
| Carrier Frequency | 48.00% are carriers |
Formula
How to use this calculator
- Choose input method: provide allele frequency (p) directly, or provide count of recessive individuals.
- For frequency method: enter p (dominant allele frequency, 0-1).
- For recessive count: enter number of recessive individuals and total population.
- Review allele frequencies (p, q) and genotype frequencies (p², 2pq, q²).
- For genetic disease application: q² typically equals disease frequency; calculate q and carrier frequency (2pq).
- For population genetics analysis: compare observed genotype frequencies to HW-predicted to test for equilibrium.
- For evolutionary studies: deviations from HW reveal selection, drift, migration, or other forces.
- For ABO blood type: doesn't apply directly (3 alleles); modified equations for multi-allele systems available.
- For X-linked traits: different equations (only one chromosome in males); separate calculations.
- For conservation planning: assess heterozygosity (2pq) levels; declining heterozygosity signals inbreeding/drift.
- For genetic counseling: provide context for risk calculations based on population carrier frequencies.
- For coursework: understand that HW serves as null hypothesis; deviations point to evolutionary processes.
Worked examples
Carrier frequency for genetic disease
Cystic fibrosis affects approximately 1 in 2,500 newborns in US population. q² = 1/2,500 = 0.0004 (affected frequency) q = √0.0004 = 0.02 (recessive allele frequency) p = 1 - 0.02 = 0.98 (dominant allele frequency) Heterozygous carriers: 2pq = 2 × 0.98 × 0.02 = 0.0392 About 3.9% of population are CF carriers. That's 1 in 25 people — much higher than disease frequency. Implications: - Most carriers don't know their status (no symptoms) - Two carriers have 25% chance of affected child per pregnancy - 50% chance of carrier child - 25% chance of unaffected non-carrier Genetic counseling and pre-pregnancy testing increasingly accessible. Identifies carrier couples and informs reproductive choices.
Sickle cell in different populations
Sickle cell allele (S) and normal allele (A) - autosomal recessive disease. In US population overall: q² = ~1 in 3,000 affected q = √(1/3000) = 0.018 Carrier frequency: 2pq = 2 × 0.982 × 0.018 = 0.036 (~3.6%) In African American population: q² = ~1 in 365 affected q = √(1/365) = 0.052 Carrier frequency: 2pq = 2 × 0.948 × 0.052 = 0.099 (~10%) In West African populations (historical): q² = ~1 in 100 affected q = 0.1 Carrier frequency: 2pq = 2 × 0.9 × 0.1 = 0.18 (~18%) Why elevated in West African ancestry? Heterozygous advantage — carriers have partial resistance to malaria. In malaria-endemic regions, natural selection maintained high carrier frequency despite disease cost. This is real-world deviation from HW (selection acting). In US (no malaria), selection no longer favors carriers, and S allele frequency gradually declines (over many generations).
Testing for HW equilibrium
Plant population (100 individuals). Observed genotypes: Tall (AA + Aa): 64 individuals Short (aa): 36 individuals If only tall vs. short visible (dominant trait), can't distinguish AA vs. Aa directly. Apply HW assumptions: q² = 36/100 = 0.36 q = 0.6 p = 0.4 p² = 0.16 (16 AA expected) 2pq = 2 × 0.4 × 0.6 = 0.48 (48 Aa expected) If we test individuals (e.g., by test crosses) and find: AA: 20, Aa: 44, aa: 36 Chi-square comparison: AA: expected 16, observed 20 (deviation +4) Aa: expected 48, observed 44 (deviation -4) aa: expected 36, observed 36 (deviation 0) Statistical test (chi-square) determines if deviations significant. Small deviations may be sampling variation; large deviations suggest non-HW conditions. Common reasons for deviations: - Selection against heterozygotes (rare) - Assortative mating (tall mates with tall) - Migration in/out of population - Recent bottleneck or founder effect
When to use this calculator
Use this calculator for population genetics coursework, predicting carrier frequencies for genetic diseases, understanding genotype distributions, comparing observed vs. expected genotype frequencies, conservation genetics, or evolutionary biology research.
Pair with punnett-square (specific cross outcomes), population-growth (broader population dynamics), and blood-type (specific multi-allele example).
Important Hardy-Weinberg considerations:
1. **Idealized conditions rarely met.** Real populations deviate due to selection, drift, migration, mutation, assortative mating, inbreeding. HW is null model.
2. **Deviations reveal evolutionary forces.** Significant departure from HW frequencies signals one or more evolutionary forces operating.
3. **Two-allele simplification.** Standard equations for one gene with two alleles. Multi-allele systems (blood types) require modified equations.
4. **X-linked traits use different equations.** Hemizygous males complicate calculations.
5. **Population size matters.** Small populations show drift faster — HW assumes large population.
6. **Random mating assumption critical.** Visible traits often show assortative mating, violating HW.
7. **Useful for null hypothesis.** Even with assumption violations, HW provides expected frequencies for comparison.
8. **Carrier calculations practical.** Often most useful application — determines how common heterozygotes are in population.
9. **Genetic counseling depends on HW.** Carrier screening risk calculations use HW-derived frequencies.
10. **Conservation genetics applications.** Track heterozygosity loss in small populations as biodiversity warning sign.
11. **Forensic DNA uses HW.** Match probability calculations assume HW; population substructure requires adjustment.
12. **Selection coefficients calculable.** Comparing HW-expected to observed can quantify selection strength on specific alleles.
Common mistakes to avoid
- Assuming p² always = (1 - q)². Both must use same allele frequencies; verify p + q = 1.
- Ignoring assumption violations. Real populations rarely meet all HW conditions; interpret with caveats.
- Using HW for multi-allele systems directly. Blood types, MHC, others need modified equations.
- Treating heterozygote frequency as low. Even rare diseases have many more carriers than affected individuals.
- Forgetting that p + q must = 1. Common arithmetic error in setting up equations.
- Applying HW to X-linked traits without modification. Sex chromosome inheritance differs.
Frequently Asked Questions
Sources & further reading
- Population Genetics Resources — U.S. National Library of Medicine
- Genetic Disease Information — U.S. National Institutes of Health
- Conservation Genetics — U.S. Fish and Wildlife Service