Genetics • 100% Free & In-Browser

Hardy-Weinberg Equilibrium Calculator

Calculate allele frequencies (p, q), genotype distributions (p², 2pq, q²), carrier frequencies, and run Chi-Square (χ²) equilibrium tests.

Real-World Presets:

1. Select Input Starting Point

Used to project expected absolute individual counts.

Gamete Pairing Matrix (Punnett Square)

A (p = 0.50) a (q = 0.50)
A (p = 0.50) AA (p²)
25.0%
Aa (pq)
25.0%
a (q = 0.50) Aa (pq)
25.0%
aa (q²)
25.0%
Dominant Allele (p / A)
0.5000
50.0%
Recessive Allele (q / a)
0.5000
50.0%
Homozygous Dominant AA / p²
0.2500
Percentage: 25.0%
Count: 250 / 1,000
Heterozygous (Carrier) Aa / 2pq
0.5000
Percentage: 50.0%
Count: 500 / 1,000
Carrier: 1 in 2
Homozygous Recessive aa / q²
0.2500
Percentage: 25.0%
Count: 250 / 1,000
Prevalence: 1 in 4
Genotype Distribution Spectrum:
p² 25%
2pq 50%
q² 25%

Step-by-Step Mathematical Derivation

Core Genetics Theory

The Foundations of the Hardy-Weinberg Principle & Equation

Formulated independently in 1908 by English mathematician Godfrey Harold Hardy and German physician Wilhelm Weinberg, the Hardy-Weinberg principle serves as the mathematical bedrock of population genetics. It proves that under specific ideal conditions, allele frequencies and genotype proportions in a sexually reproducing, diploid population remain constant from generation to generation.

The principle is governed by two complementary mathematical equations for a gene locus with two alleles (A and a):

Allele Frequency Equation
p + q = 1

Where p is the frequency of the dominant allele (A) and q is the frequency of the recessive allele (a) in the total gene pool.

Genotype Frequency Equation
p² + 2pq + q² = 1

Where is homozygous dominant (AA), 2pq is heterozygous (Aa), and is homozygous recessive (aa).

Evolutionary Biology

The 5 Critical Assumptions of Hardy-Weinberg Equilibrium

For a biological population to achieve true genetic equilibrium without changes in allele frequencies, five conditions must be satisfied simultaneously:

1
Infinitely Large Population Size (No Genetic Drift)

Large population size minimizes random sampling errors. In small populations, allele frequencies fluctuate randomly due to genetic drift and founder events.

2
Completely Random Mating (Panmixia)

Every individual must have an equal chance of mating with any other individual of the opposite sex. Positive assortative mating or inbreeding inflates homozygosity.

3
No Net Mutations

No new alleles can be introduced into the gene pool via forward or back mutation at the gene locus under study.

4
No Gene Flow or Migration

The population must be closed to immigration (entering alleles) and emigration (departing alleles), preserving the pool's boundaries.

5
No Natural Selection

All genotypes (AA, Aa, aa) must have equal survival, reproductive fitness, and fertility rates. Differential survival shifts allele frequencies toward favored phenotypes.

Clinical & Medical Genetics

Clinical Genetics: Calculating Carrier Risk for Recessive Diseases

In medical genetics, clinicians frequently use the Hardy-Weinberg equation to estimate the carrier frequency (2pq) of asymptomatic individuals for severe autosomal recessive disorders based solely on the known clinical incidence ().

🩺 Worked Medical Example: Cystic Fibrosis Screening

In Northern European populations, cystic fibrosis affects approximately 1 in 2,500 live births (q² = 0.0004). How do genetic counselors calculate the carrier frequency?

1. Recessive Disease Incidence: q² = 1 / 2,500 = 0.0004
2. Recessive Allele Frequency: q = √0.0004 = 0.02 (2.0%)
3. Dominant Allele Frequency: p = 1 - 0.02 = 0.98 (98.0%)
4. Heterozygous Carrier Frequency: 2pq = 2 × 0.98 × 0.02 = 0.0392 (3.92%)
5. Clinical Odds: Carrier Rate = 1 in 25.5 individuals
Statistical Testing

Statistical Testing: Chi-Square (χ²) Goodness-of-Fit

To test whether real sample data conforms to Hardy-Weinberg expectations, researchers apply Pearson's Chi-Square test:

χ² = Σ [(Observed - Expected)² / Expected]

For a 2-allele system, the test has 1 degree of freedom (df = 3 genotypes - 2 alleles = 1). At the standard significance threshold (α = 0.05), the critical value is 3.841. If χ² > 3.841 (or p < 0.05), the population significantly deviates from equilibrium, demonstrating that evolutionary forces are actively operating.

Frequently Asked Questions

Frequently Asked Questions About Hardy-Weinberg Equilibrium

What is the Hardy-Weinberg equation, and what do p and q represent?

The Hardy-Weinberg equation is a fundamental mathematical model in population genetics that describes how allele and genotype frequencies remain constant across generations in an ideal population. The equation consists of two core formulas: (1) p + q = 1, where p represents the frequency of the dominant allele (A) and q represents the frequency of the recessive allele (a); and (2) p² + 2pq + q² = 1, where p² is the frequency of homozygous dominant individuals (AA), 2pq is the frequency of heterozygous individuals or carriers (Aa), and q² is the frequency of homozygous recessive individuals (aa).

What are the five key assumptions required for a population to remain in Hardy-Weinberg equilibrium?

For a population to remain in Hardy-Weinberg equilibrium without evolutionary change, five theoretical conditions must be met: (1) Infinitely large population size (no genetic drift or sampling error); (2) Random mating (panmixia with no sexual selection or assortative mating); (3) No mutation (no new alleles introduced by DNA replication errors); (4) No gene flow or migration (no immigration or emigration between populations); and (5) No natural selection (all genotypes have equal reproductive fitness and survival rates). If any of these conditions are violated, allele frequencies will shift and evolution occurs.

How do you calculate carrier frequency for an autosomal recessive genetic disease?

To calculate carrier frequency for an autosomal recessive condition (such as cystic fibrosis or sickle cell anemia), follow three steps: (1) Determine the disease incidence, which equals the homozygous recessive frequency q² (for example, 1 in 2,500 = 0.0004); (2) Calculate the recessive allele frequency by taking the square root: q = √0.0004 = 0.02; (3) Compute the dominant allele frequency: p = 1 - q = 0.98; (4) Calculate the carrier frequency using 2pq: 2 × 0.98 × 0.02 = 0.0392 (or approximately 3.92%, which translates to 1 in 25 individuals being a healthy carrier).

How does the Chi-Square (χ²) test determine if a population deviates from Hardy-Weinberg equilibrium?

The Chi-Square (χ²) goodness-of-fit test compares the observed number of individuals for each genotype against the expected counts predicted by Hardy-Weinberg proportions using the formula χ² = Σ [(Observed - Expected)² / Expected]. For a 2-allele system, the test has 1 degree of freedom (df = number of genotypes - number of alleles = 3 - 2 = 1). If the calculated χ² value exceeds the critical threshold of 3.841 (at α = 0.05 significance, p < 0.05), we reject the null hypothesis, concluding that the population significantly deviates from Hardy-Weinberg equilibrium due to evolutionary forces like selection, drift, or non-random mating.

How does the Hardy-Weinberg equation work for 3 alleles, such as the ABO blood group system?

When a single gene locus has three alleles (such as alleles A, B, and O in human blood types with frequencies p, q, and r), the allele equation expands to p + q + r = 1, and the genotype expansion becomes (p + q + r)² = p² + q² + r² + 2pq + 2pr + 2qr = 1. This produces 6 genotypes and 4 observable phenotypes: Type A (genotypes AA [p²] and AO [2pr]), Type B (genotypes BB [q²] and BO [2qr]), Type AB (genotype AB [2pq]), and Type O (genotype OO [r²]).

Why is the Hardy-Weinberg principle considered a null model in evolutionary biology?

The Hardy-Weinberg principle serves as the fundamental null hypothesis of evolutionary biology. Because real biological populations virtually never meet all five assumptions simultaneously (since populations are finite, natural selection operates, and mutations occur), the model provides an exact mathematical baseline of what a non-evolving population looks like. When geneticists observe that actual genotype frequencies differ significantly from Hardy-Weinberg expectations, they know evolutionary forces are actively shaping that gene locus, allowing researchers to investigate natural selection, inbreeding, or migration.