Hardy-Weinberg Equilibrium Calculator
Convert allele frequencies into expected homozygous and heterozygous genotype frequencies for a population in genetic equilibrium.
Allele frequencies
Expected population structure
Expected genotype distribution
Each bar shows the expected percentage of the population with a particular genotype.
Genotype frequency table
| Genotype | Type | Formula | Frequency | Percentage |
|---|
How to use this Hardy-Weinberg equilibrium calculator
What this calculator does
This calculator predicts the genotype frequencies expected from a set of allele frequencies when a population follows Hardy-Weinberg equilibrium. It expands the familiar two-allele identity, p² + 2pq + q² = 1, to as many as five alleles. The output is a theoretical baseline: it does not prove equilibrium, diagnose a genetic condition, estimate an individual person's risk, or replace a statistical comparison with observed genotype counts.
When to use it
Use the calculator to check population-genetics homework, build expected genotype proportions before a chi-square or exact test, estimate heterozygosity from known allele frequencies, or explore how adding rare alleles changes the predicted genotype distribution. The OpenStax population evolution chapter explains why allele and genotype frequencies remain stable only when the model's assumptions are met.
How to calculate
- Select the Number of alleles from 2 through 5.
- Enter each allele frequency in the fields labeled p, q, r, s, and t as applicable. Use decimal values from 0 to 1, such as 0.7 rather than 70%.
- Make sure the frequencies add to exactly 1 within the displayed tolerance. The status beneath the inputs reports the current sum and blocks export when the inputs are invalid.
- Read the primary result and summary cards, then use the bar chart and genotype table for the full distribution.
- Select Download Excel to export the current allele assumptions and all genotype results to a validated workbook. Select Reset to return to two alleles with p = 0.7 and q = 0.3.
Input guide
Number of alleles is required and accepts the integers 2, 3, 4, or 5. Increasing it adds more allele-frequency fields and increases the number of unique genotypes according to n(n + 1)/2. For example, three alleles produce six genotypes. Changing this control resets the visible frequencies to a valid equal-frequency distribution, except the default two-allele case. A common mistake is to add an allele without rebalancing the others.
p, q, r, s, and t are required decimal frequencies for each allele. Each value must be finite and between 0 and 1. Examples include p = 0.7 and q = 0.3. Raising one allele's frequency increases its homozygous square and all heterozygous products containing that allele, but the other values must be reduced so the total remains 1. Commas, percent signs, scientific notation, and mixed text are rejected to avoid silently interpreting ambiguous input.
Output guide
Most common expected genotype identifies the genotype with the largest theoretical frequency. Total homozygous frequency is the sum of all squared allele frequencies. Total heterozygous frequency is the sum of all pairwise 2pipj terms. Expected heterozygosity shows the same heterozygous proportion as a decimal from 0 to 1, commonly written He = 1 – Σpi². Genotype frequency sum should equal 100%; a materially different value indicates invalid inputs or numerical failure.
The Expected genotype distribution bar chart compares all genotype percentages on a common zero-based scale. The Genotype frequency table lists each genotype, whether it is homozygous or heterozygous, the symbolic formula, the raw frequency, and the percentage. Zero values are valid at boundaries, while negative or above-one values are not.
Worked example
With two alleles, enter p = 0.7 and q = 0.3. The homozygous AA frequency is p² = 0.49, or 49.00%. The heterozygous Aa frequency is 2pq = 2 × 0.7 × 0.3 = 0.42, or 42.00%. The homozygous aa frequency is q² = 0.09, or 9.00%. The three results sum to 1.00, so the most common expected genotype is AA, total homozygosity is 58.00%, and expected heterozygosity is 0.4200.
Learn more
The National Research Council's population genetics overview describes Hardy-Weinberg proportions and random mating. For research applications and quality control, see the review of Hardy-Weinberg equilibrium in large-scale genomic studies.
How the model works
For allele frequencies p1 through pn that sum to 1, every homozygous genotype has expected frequency pi². Every heterozygous genotype formed from two different alleles i and j has expected frequency 2pipj. Adding every squared and pairwise term gives (p1 + p2 + ... + pn)² = 1. The calculator uses this identity directly and retains full numeric precision until display formatting.
Assumptions and interpretation
Hardy-Weinberg equilibrium assumes a very large population, random mating with respect to the locus, no mutation, no migration, and no genotype-specific natural selection. Real populations may depart from these assumptions because of drift, inbreeding, population structure, selection, gene flow, or genotyping error. The equilibrium distribution is therefore best treated as an expected reference. Observed genotype counts require a separate goodness-of-fit procedure, and small or sparse samples may require an exact test rather than a simple chi-square approximation.
Expected heterozygosity is highest when allele frequencies are relatively even and lower when one allele dominates. With two alleles, it reaches a maximum of 0.5 at p = q = 0.5. With more alleles, the maximum rises because there are more possible unlike pairs. The NCBI discussion of statistical interpretation of population-genetic evidence provides additional context for departures from equilibrium and population structure.