Hardy–Weinberg Calculator

Find genotype frequencies from an allele frequency.

How it is calculated

The Hardy–Weinberg principle links allele frequencies to genotype frequencies in a population. With two alleles, p is the frequency of the dominant allele and q = 1 − p that of the recessive one. Expected genotype frequencies come from (p + q)2 = p2 + 2pq + q2: homozygous dominant p2, heterozygous 2pq, homozygous recessive q2. The tool takes p as a fraction between 0 and 1 (not a percentage) and shows each genotype as a percentage. The model assumes random mating, a large population, no selection, no mutation and no migration, so real populations may deviate.

Worked example

Take p = 0.7, so q = 1 − 0.7 = 0.30. Homozygous dominant: 0.72 = 49.00%. Heterozygous: 2 × 0.7 × 0.3 = 42.00%. Homozygous recessive: 0.32 = 9.00%. The three add up to 100%. Note that 91% of individuals show the dominant trait (49% + 42%), although the recessive allele itself is 30% of all alleles.

Try this example →

Common mistakes

  • Entering p as a percentage such as 70 instead of the fraction 0.7.
  • Treating the dominant phenotype frequency as p2; it is p2 + 2pq, because heterozygotes also show the dominant trait.
  • Confusing the recessive phenotype frequency q2 with the allele frequency q; the allele frequency is the square root.
  • Applying the model to a population under strong selection or with non-random mating.

Sources

About this calculator

This calculator finds expected genotype frequencies from an allele frequency under the Hardy–Weinberg principle: for a gene with two alleles at frequencies p and q (where p + q = 1), the genotype frequencies in a population at equilibrium are p² (homozygous dominant), 2pq (heterozygous), and q² (homozygous recessive) — the expansion of (p + q)².

Population geneticists use this as a null-hypothesis baseline: real populations are compared against Hardy–Weinberg expectations to detect evolutionary forces like natural selection, genetic drift, non-random mating, or migration, since a population only stays in equilibrium absent these pressures. It's taught in every introductory genetics course as the foundation of population genetics.

Was this helpful?

You can pick up to 3 reactions.

Comments (1)

  • Editorial team

    Most real questions arrive the other way round: you know how common a recessive condition is and need the allele frequency. If it affects 1 person in 2,500, then q squared is 0.0004, so q is 0.02 and you should enter p = 0.98. The tool then shows carriers, 2pq, at 3.92%. This only holds under the model's assumptions, such as random mating. What trait or dataset are you working with, and how is your frequency measured?

Popular calculators

All Calculators