Skip to content
Omnikalc

Hardy-Weinberg calculator: allele frequencies, carriers and equilibrium test

Get allele and genotype frequencies from how common a recessive trait is, or from genotype counts, with the share of carriers and a chi-square test.

Updated on
Your inputs
Start from

Value out of range

Value out of range

Value out of range

Value out of range

Results

Frequency of the dominant allele (p)

0.6000

Frequency of the recessive allele (q)

0.4000

Expected carriers Aa (2pq)

48.00%

Expected AA (p²)
36.00%
Expected aa (q²)
16.000%
Carriers: one person in
2.1
Chi-square (1 degree of freedom)
0.000
P-value of the equilibrium test
1.0000
Consistent with equilibrium

Equilibrium test for other aa counts

Frequency of the recessive allele (q)Chi-square (1 degree of freedom)P-value of the equilibrium test
100 aa current0.361710.5380.0012
130 aa current0.38142.2960.1297
160 aa current0.40000.0001.0000
190 aa current0.41751.8050.1791
220 aa current0.43406.4920.0108
250 aa current0.449513.2380.0003

What the Hardy-Weinberg principle says

In 1908, mathematician G. H. Hardy and physician Wilhelm Weinberg independently showed that, in a large population with random mating, the frequencies of alleles and genotypes stay constant from one generation to the next. If a gene has two alleles with frequencies p and q, the genotypes appear in fixed proportions: p², 2pq and q². This baseline lets geneticists estimate how many people carry a recessive allele and detect when something, such as selection or migration, is changing the population.

The formulas

  • p + q = 1
  • p² + 2pq + q² = 1: AA, Aa and aa
  • From the recessive trait frequency: q = √(share of aa)
  • From genotype counts: q = (Aa + 2 × aa) ÷ (2 × total)
  • Carriers: 2pq, or one person in 1 ÷ 2pq
  • Chi-square test: Σ (observed − expected)² ÷ expected, with 1 degree of freedom

Worked example: estimating carriers

A recessive condition affects 1 person in 2,500.

  1. q² = 1 ÷ 2,500 = 0.0004, so q = 0.02.
  2. p = 1 − 0.02 = 0.98.
  3. Carriers: 2 × 0.98 × 0.02 = 3.92%, about 1 person in 26.

So for every affected person there are about 98 healthy carriers. This is why recessive conditions persist even when they are rare.

Rare traits, common carriers

Trait frequency q Carriers (2pq)
1 in 100 0.100 18.0%, 1 in 6
1 in 1,000 0.032 6.1%, 1 in 16
1 in 2,500 0.020 3.9%, 1 in 26
1 in 10,000 0.010 2.0%, 1 in 51
1 in 20,000 0.007 1.4%, 1 in 71

Worked example: testing the equilibrium

In a sample of 1,000 individuals you count 360 AA, 480 Aa and 160 aa.

  1. q = (480 + 2 × 160) ÷ 2,000 = 0.40, p = 0.60.
  2. Expected: 360 AA, 480 Aa, 160 aa.
  3. The observed counts match exactly, so chi-square is 0 and the population is consistent with equilibrium.

A p-value below 0.05 would suggest that one of the assumptions does not hold.

The assumptions

  • A large population, so random drift is small
  • Random mating with respect to the gene
  • No new mutations, no migration in or out
  • No natural selection on the genotypes

Real populations break these rules to some degree, but for many genes the predictions are close. Departures are informative: an excess of homozygotes can point to inbreeding or to population structure.

Limits

The calculation assumes the trait is fully recessive and that everyone with the aa genotype shows it. Carrier screening in medicine relies on direct genetic testing rather than these estimates, which also vary between populations.

Frequently asked questions

What is the Hardy-Weinberg equation?

p² + 2pq + q² = 1, where p and q are the frequencies of the two alleles. p² and q² are the shares of the two homozygotes, and 2pq the share of heterozygotes.

How do you find carrier frequency from disease frequency?

Take q = √(frequency of the recessive trait), then 2pq. If 1 person in 2,500 is affected, q = 0.02 and about 3.9% of people, 1 in 26, are carriers.

What are the conditions for Hardy-Weinberg equilibrium?

A large population, random mating, and no mutation, migration or selection. Real populations rarely meet them exactly, but many genes come close.

How do you test for Hardy-Weinberg equilibrium?

Compare observed genotype counts with the expected p², 2pq and q² using a chi-square test with 1 degree of freedom. A p-value below 0.05 suggests a departure from equilibrium.

Was this calculator helpful?

Thanks for your feedback!

Results are estimates provided for information purposes. They do not replace professional advice.