BioBlog Labs

Hardy-Weinberg Equilibrium Calculator

for a biallelic locus

The Hardy-Weinberg Equilibrium principle states that in a large, closed, randomly mating population with no evolutionary influences, the frequencies of alleles and genotypes will remain constant from one generation to the next. This principle provides a mathematical framework to study genetic variation and serves as a baseline to detect evolutionary changes. For a population to be in Hardy-Weinberg Equilibrium, five key assumptions must be met: no mutations, random mating, no natural selection, an infinitely large population size (no genetic drift), and no gene flow (migration).



This online calculator can be used to determine the allele frequencies and to calculate, using the Hardy-Weinberg equation, the expected number of common homozygotes, heterozygotes and rare homozygotes, from observed genotype counts for a gene with two alleles. It will then run a Chi-squared test and return the corresponding p-value, allowing you to determine whether the population is significantly deviating from Hardy-Weinberg Equilibrium proportions.

Graph showing Hardy-Weinberg Equilibrium proportions: red line for AA (p²) increases as p increases from 0 to 1, green line for Aa (2pq) peaks at 0.5 when p = 0.5, blue line for aa (q²) decreases as p increases from 0 to 1.
Hardy-Weinberg Equilibrium proportions for a biallelic locus, illustrating how genotype frequencies vary with different allele frequencies in a population adhering to Hardy-Weinberg equilibrium conditions. The horizontal axis represents the allele frequencies p and q, while the vertical axis represents the expected genotype frequencies calculated under the Hardy-Weinberg principle. Each line on the graph corresponds to one of the three possible genotypes: common homozygotes (AA), heterozygotes (Aa), and rare homozygotes (aa).CC BY-SA 3.0Johnuniq

This calculator enables you to:

The Hardy-Weinberg Equation:

The Hardy-Weinberg equation: p2 + 2pq + q2 = 1

p2 = dominant homozygous frequency (AA)


2pq = heterozygous frequency (Aa)


q2 = recessive homozygous frequency (aa)