Hardy-Weinberg Calculator

p, q, p², 2pq and q² from genotype counts or the recessive phenotype frequency, with a chi-square test for equilibrium.

p² + 2pq + q² = 1 and p + q = 1. If 4% of a population shows a recessive trait, q² = 0.04 so q = 0.2, p = 0.8 and carriers are 2pq = 0.32, about 1 in 3.

Free, runs in your browser. Nothing you enter is uploaded.

How to use it

  1. Choose what you know: genotype counts, the share of the population with the recessive trait, or p.
  2. Enter the numbers.
  3. Read p, q, carrier frequency and, for counts, the chi-square test result.

What you enter

What you get

Formula

p + q = 1 | p² + 2pq + q² = 1 | p = (2AA + Aa) / 2N | χ² = Σ (O − E)² / E, df = 1

Worked example: genotype counts

Input: AA 360, Aa 480, aa 160

Result: p = 0.6, q = 0.4; χ² = 0, in equilibrium

Observed counts match expected exactly, so there is no evidence of selection or non-random mating.

Questions

How do you solve a Hardy-Weinberg problem?

Start from what you know. If you know the share showing the recessive phenotype, that is q²; take its square root for q, then p = 1 − q, and genotype frequencies are p², 2pq and q².

How do you calculate allele frequency from genotype counts?

p = (2 × AA + Aa) ÷ (2 × total). Each individual carries two alleles.

How do I test for Hardy-Weinberg equilibrium?

Compare observed genotype counts with expected (p²N, 2pqN, q²N) using chi-square with 1 degree of freedom. p < 0.05 suggests the population is not in equilibrium.

What are the Hardy-Weinberg assumptions?

Random mating, a large population, and no mutation, migration or selection.

Limitations

References

Related reading

More Genetics

All free tools · By Dr. Zubair Khalid, DVM, MS, PhD.