b2KIT

Hardy-Weinberg Equilibrium Calculator

Calculate allele and genotype frequencies under Hardy-Weinberg equilibrium. Test populations for evolutionary forces.

Tested tool guide Tested browser tools Checked August 16, 2026

What Hardy-Weinberg Equilibrium Calculator does, with a checked example

For a diploid population with two alleles, this calculator converts allele frequencies into the Hardy-Weinberg genotype proportions p^2, 2pq, and q^2. It can also compare observed genotype counts with the counts expected from their estimated allele frequencies. The most common mistake is using pq for the heterozygote frequency; because either allele can come from either parent, the expected frequency is 2pq. Expected proportions describe an equilibrium model, not a guarantee about the genotypes observed in a sample.

Worked example

A concrete input and expected output from the current implementation.

Input

Allele A frequency (p): 0.60
Allele a frequency (q): 0.40

Expected output

Expected AA frequency: 0.36 (36%)
Expected Aa frequency: 0.48 (48%)
Expected aa frequency: 0.16 (16%)

The three frequencies are p^2 = 0.60^2 = 0.36, 2pq = 2 x 0.60 x 0.40 = 0.48, and q^2 = 0.40^2 = 0.16. They sum to 1.00.

How the result is produced

1

From alleles to genotypes

The two allele frequencies are represented by p and q, with p + q = 1 for a two-allele locus. Hardy-Weinberg equilibrium predicts homozygote frequencies of p^2 and q^2 and a heterozygote frequency of 2pq. Multiplying each frequency by population or sample size gives its corresponding expected genotype count.

2

From genotype counts to a fit check

For observed counts nAA, nAa, and naa in a sample of N individuals, p is calculated as (2nAA + nAa) / (2N), while q is (2naa + nAa) / (2N). Expected counts are then Np^2, N(2pq), and Nq^2. Comparing those expectations with the observed counts indicates how closely the sample fits equilibrium.

Good uses

  • Predict the proportions of AA, Aa, and aa individuals when the frequencies of two alleles are known.
  • Convert observed diploid genotype counts into allele frequencies before comparing the sample with Hardy-Weinberg expectations.
  • Check a genetics exercise or population dataset for a departure that may warrant investigating selection, migration, nonrandom mating, drift, genotyping error, or population structure.

Limits and checks

  • The p^2 + 2pq + q^2 model assumes exactly two alleles whose frequencies sum to 1. Multiallelic, haploid, or sex-linked cases require different bookkeeping.
  • Agreement with Hardy-Weinberg expectations does not prove that evolutionary forces are absent. A limited sample may lack power, and opposing effects can produce little visible departure at one locus.
  • A departure does not identify its cause. Selection, population subdivision, nonrandom mating, migration, sampling variation, and data errors can create different or overlapping patterns in the observed genotypes.

Common questions

Can this calculator tell me which evolutionary force affected the population?

No. It can show whether observed genotype frequencies differ from the proportions predicted by Hardy-Weinberg equilibrium, but that difference is not diagnostic of one cause. Identifying a cause requires study design, biological context, replicate samples, and checks for population structure, related individuals, sampling effects, and genotype quality.

Can I infer allele frequency from the frequency of a recessive phenotype?

Only if the recessive phenotype reliably represents the aa genotype and Hardy-Weinberg equilibrium is a defensible assumption. In that case the phenotype frequency is q^2, so q is its square root and p = 1 - q. Without those conditions, taking the square root can give a misleading allele-frequency estimate.

References and verification

The example and behavioral notes were checked against the browser implementation. Standards and primary references below define the relevant format, formula, or platform behavior.

Related Tools