All Tools

Hardy-Weinberg Equilibrium Calculator

Calculate allele and genotype frequencies using the Hardy-Weinberg equations. Test whether a population is in equilibrium with a chi-square goodness-of-fit test, or simulate how evolutionary forces change allele frequencies over generations.

Allele Frequencies

p=0.50q=0.50

Genotype Frequencies

25.0%AA50.0%Aa25.0%aa

Population (100 individuals)

AA (25.0%)Aa (50.0%)aa (25.0%)

Controls

Allele frequency p (dominant)0.50
q (recessive) = 0.50

Results

p+q=0.50+0.50=1p + q = 0.50 + 0.50 = 1
p2+2pq+q2=0.2500+0.5000+0.2500=1p^2 + 2pq + q^2 = 0.2500 + 0.5000 + 0.2500 = 1
AA (p\u00b2)
25.0%
Aa (2pq)
50.0%
aa (q\u00b2)
25.0%
Dominant phenotype (AA + Aa)
75.0%
Recessive phenotype (aa)
25.0%
Carrier frequency (2pq)
50.0%
1 in 2 individuals
In a population of 10,000: ~2500 AA, ~5000 Aa, ~2500 aa

Reference Guide

The Hardy-Weinberg Principle

The Hardy-Weinberg principle states that allele and genotype frequencies in a population remain constant from generation to generation in the absence of evolutionary forces.

Five conditions must be met for a population to be in Hardy-Weinberg equilibrium: no mutation, random mating, no natural selection, very large population size, and no gene flow (migration).

The key equations
p+q=1(allele frequencies)p + q = 1 \quad \text{(allele frequencies)}
p2+2pq+q2=1(genotype frequencies)p^2 + 2pq + q^2 = 1 \quad \text{(genotype frequencies)}

Allele and Genotype Frequencies

In a two-allele system, p represents the frequency of the dominant allele (A) and q represents the frequency of the recessive allele (a).

Genotype frequencies
AA=p2,Aa=2pq,aa=q2\text{AA} = p^2, \quad \text{Aa} = 2pq, \quad \text{aa} = q^2
From observed counts
p=2(AA)+Aa2Np = \frac{2(\text{AA}) + \text{Aa}}{2N}

The carrier frequency (2pq) tells you how many heterozygous individuals carry one copy of a recessive allele without showing the trait.

Testing for Equilibrium (Chi-Square)

A chi-square goodness-of-fit test compares observed genotype counts to the expected counts under Hardy-Weinberg equilibrium.

Chi-square statistic
χ2=(OiEi)2Ei\chi^2 = \sum \frac{(O_i - E_i)^2}{E_i}

With 3 genotype classes and 1 estimated parameter (p), the degrees of freedom is df = 1. The critical value at the 0.05 significance level is 3.841.

Decision rule
χ2<3.841fail to reject H0 (in equilibrium)\chi^2 < 3.841 \Rightarrow \text{fail to reject } H_0 \text{ (in equilibrium)}

Evolutionary Forces

When any of the five HW conditions is violated, allele frequencies change over time.

Natural selection changes frequencies based on fitness differences between genotypes. Alleles linked to higher fitness increase.

Genetic drift is random change due to sampling error in finite populations. Smaller populations drift faster and can lose alleles entirely.

Mutation introduces new alleles. Forward mutation A to a gradually increases q.

Gene flow (migration) brings alleles from other populations, pulling frequencies toward the source population.