Skip to content
The Calculatorz
Genetics

Hardy–Weinberg Equilibrium Calculator

Calculate allele frequencies from genotype counts and test whether a population fits Hardy–Weinberg equilibrium with a chi-square test.

Results are calculation aids for study and laboratory planning. Follow your protocol, kit instructions and supervisor's guidance, and verify critical values independently.

Observed genotype counts

Population sample

How to use this calculator

Enter the observed number of individuals of each genotype for one gene with two alleles. The calculator estimates the allele frequencies p and q, the genotype counts expected under Hardy–Weinberg equilibrium, and a chi-square goodness-of-fit test with one degree of freedom. A p-value below 0.05 suggests the population departs from equilibrium.

Formula

p = (2 × AA + Aa) ÷ (2N) and q = 1 − p, where N is the number of individuals. Expected counts: AA = p²N, Aa = 2pqN, aa = q²N. χ² = Σ (observed − expected)² ÷ expected, with 1 degree of freedom (3 genotype classes − 1 − 1 estimated allele frequency).

Calculator credits

Calculator developmentJulia Edwards

Editorial supervision

Expert reviewJanBioinformatics Graduate, Genomic Data Analyst

Published byThe Calculatorz

Last updated

Read how we research, test, review and correct our calculators in our editorial policy.

Frequently asked questions

What does Hardy–Weinberg equilibrium mean?

It describes a population in which allele and genotype frequencies stay constant from generation to generation because there is no selection, mutation, migration or genetic drift, and mating is random.

What are p and q?

p is the frequency of the dominant allele and q the frequency of the recessive allele in the gene pool. For a gene with two alleles, p + q = 1.

Why is there only one degree of freedom?

There are three genotype classes, but one degree of freedom is lost because the total is fixed and another because p is estimated from the same data.

Can I use phenotype counts instead?

Only if heterozygotes can be told apart. With complete dominance you can estimate q as √(frequency of the recessive phenotype), but you cannot then test equilibrium with this method.

What if an expected count is very small?

Chi-square tests become unreliable when expected counts are below about 5. Use an exact test for small samples or rare alleles.

Does a significant result prove selection?

No. A departure can come from inbreeding, population structure, genotyping errors, migration or chance, as well as selection.

References & methodology sources

These sources support the calculator’s formula, definitions, thresholds, units or result interpretation.

  1. Hardy, G. H. (1908). Mendelian proportions in a mixed population. Science, 28(706), 49–50. View source
  2. Clark, M. A., Douglas, M., & Choi, J. (2018). Biology 2e. OpenStax. View source
  3. Illowsky, B., & Dean, S. (2023). Introductory statistics 2e. OpenStax. View source
  4. Casella, G., & Berger, R. L. (2002). Statistical inference (2nd ed.). Duxbury. View source
  5. Croarkin, C., & Tobias, P. (Eds.). (2012). NIST/SEMATECH e-handbook of statistical methods. National Institute of Standards and Technology. View source