Skip to content
Calc.

Hardy-Weinberg Calculator (Allele and Genotype Frequencies)

Find allele frequencies (p, q) and the expected genotype frequencies (p², 2pq, q²) from one known value: the recessive phenotype frequency, the recessive allele frequency or the dominant allele frequency, assuming Hardy-Weinberg equilibrium.

Last updated: September 2026

Frequency

0.48

Formula below · 2 sources (frontiersin.org, gfmer.ch) · Updated Sep 2026

Compare with similar

About this calculator

The Hardy-Weinberg principle (Hardy 1908, Weinberg 1908) says that in a large, randomly mating population with no mutation, migration or selection, allele and genotype frequencies stay constant from one generation to the next. For one gene with two alleles, A (frequency p) and a (frequency q), p + q = 1 and the genotype frequencies are p² (AA), 2pq (Aa) and q² (aa), which sum to (p + q)² = 1.

The calculator starts from whichever single value you know. Most often that is the recessive phenotype frequency: only aa individuals show a recessive trait, so their share is q², and q = √(q²). With q known, p = 1 − q, and every genotype frequency follows. Choose the output: the carrier (heterozygote) frequency 2pq, either homozygote, or either allele frequency. Multiply a genotype frequency by the population size for an expected count.

Limits: the frequency must be a proportion between 0 and 1 (enter 0.16, not 16). Working back from a phenotype assumes the population is in equilibrium; with inbreeding or strong selection the estimate of q is off. For a rare recessive disorder 2pq ≈ 2q: a condition affecting 1 in 10,000 births gives q = 0.01 and about 1 in 50 carriers.

How to use

Example 1 — flower colour. 16% of plants in a field show the recessive white flower. Choose 'Recessive phenotype frequency (q²)', enter 0.16 and show 2pq. q = √0.16 = 0.4, p = 0.6, 2pq = 2 × 0.6 × 0.4 = 0.48: 48% of the plants are red-flowered carriers. Switching the output gives p² = 0.36 and q² = 0.16; 0.36 + 0.48 + 0.16 = 1. Example 2 — carrier frequency. Cystic fibrosis affects about 1 in 2,500 births in populations of European descent. Enter q² = 0.0004 (1 ÷ 2,500) and show 2pq: q = 0.02, p = 0.98, 2pq = 0.0392, about 1 in 25 people.

Frequently asked questions

What are the assumptions of Hardy-Weinberg equilibrium?

Five strict assumptions: (1) large population size — no genetic drift (random sampling effects that change allele frequencies in small populations); (2) random mating — no assortative mating, no inbreeding; (3) no mutation — allele frequencies don't change through new mutations or back-mutations; (4) no migration — no gene flow into or out of the population; (5) no natural selection — all genotypes have equal fitness. Real populations always violate at least some of these assumptions to some degree; Hardy-Weinberg is a null hypothesis, not a description of any actual population. Deviations from expected H-W genotype frequencies (tested with chi-square) indicate which assumption is violated and by how much. The principle is most useful as a baseline expectation against which to detect evolutionary forces or to estimate allele frequencies from genotype data when the assumptions approximately hold.

How do I calculate carrier frequency for a recessive genetic disease?

If the disease occurs in 1 out of N newborns, then q² = 1/N (assuming H-W holds for the population). Take the square root to get q = √(1/N). Then p = 1 − q (for a two-allele system). The carrier frequency is 2pq, which for rare diseases is approximately 2q (since p ≈ 1). Example: cystic fibrosis at 1/2500 → q² = 0.0004 → q = 0.02 → carriers 2 · 0.98 · 0.02 ≈ 0.039 ≈ 1 in 25 people. Tay-Sachs at 1/3500 in Ashkenazi Jews → q ≈ 0.017 → carriers ≈ 3.3% or 1 in 30. Phenylketonuria at 1/10000 → q ≈ 0.01 → carriers ≈ 2% or 1 in 50. The pattern: carrier frequencies are dramatically higher than disease frequencies, which is why pre-conception or prenatal carrier screening is so cost-effective for population health.

How do I test whether a population is in Hardy-Weinberg equilibrium?

Compare observed genotype counts to expected counts using a chi-square goodness-of-fit test. Step 1: calculate p and q from observed allele frequencies (count alleles, not genotypes). Step 2: compute expected genotype counts as p²·N (AA), 2pq·N (Aa), q²·N (aa) where N = total individuals. Step 3: χ² = Σ (observed − expected)² / expected, summed over the three genotypes. Step 4: compare against the chi-square distribution with degrees of freedom = (number of genotypes − number of alleles) = 3 − 2 = 1 for a biallelic locus. A p-value below 0.05 suggests the population deviates significantly from H-W expectations. Common causes: assortative mating, inbreeding (excess homozygotes), heterozygote advantage (excess heterozygotes), recent migration, sampling bias.

What are the most common mistakes people make with Hardy-Weinberg?

The first is forgetting that p + q must equal 1 for a two-allele locus, which is why this calculator asks for one value and derives the other. The second is confusing allele frequency (p, q) with genotype frequency (p², 2pq, q²); 30% of people having the disease genotype (q² = 0.3) is very different from 30% allele frequency (q = 0.3, q² = 0.09). The third is applying H-W expectations to small populations (less than ~1000 individuals) where genetic drift can produce substantial deviation even without selection. The fourth is assuming H-W applies across populations; combining genotype counts from two genetically distinct populations always produces an apparent excess of homozygotes (the Wahlund effect) even if each subpopulation is in H-W. The fifth is using H-W for sex-linked loci without adjustment; X-linked traits have different expected frequencies in males (hemizygous) vs females (homozygous or heterozygous).

When should I not use this calculator?

Skip it for loci with more than two alleles (most actual genetic loci have multiple variants); use the multinomial expansion (p² + q² + r² + 2pq + 2pr + 2qr = 1 for three alleles) or specialised population-genetics software. Don't use it for X-linked or Y-linked traits without adjusting for hemizygous males; the expected frequencies differ between sexes for sex-linked loci. Avoid it for populations known to violate H-W assumptions strongly (small isolated populations, populations with strong recent migration or selection, founder populations); the equilibrium frequencies don't apply meaningfully. It's the wrong tool for analysing multi-locus haplotypes, linkage disequilibrium, or polygenic traits where multiple loci interact. Finally, don't use it to "prove" no selection is occurring; the H-W test has limited power to detect mild selection over a few generations, and absence of evidence isn't evidence of absence.

Related calculators

Sources & references

How we check our calculators

Think a result is wrong? Report a problem with this calculator.