Hardy Weinberg calculator for allele and genotype frequencies

This Hardy Weinberg calculator uses the two equations from OpenStax Biology: p + q = 1 and p² + 2pq + q² = 1. Example from the book: 245 YY, 210 Yy and 45 yy pea plants give p = 0.7 and q = 0.3, and the expected genotype frequencies 0.49, 0.42 and 0.09.

Example: Start from: genotype counts (AA, Aa, aa) · Homozygous dominant AA 245 · Heterozygous Aa 210 · Homozygous recessive aa 45 → Allele frequencies: p = 0.7, q = 0.3 · heterozygous 42 %. Source: OpenStax Biology 2e, 19.1 Population Evolution: Hardy-Weinberg principle, p + q = 1 and p² + 2pq + q² = 1; example 500 pea plants (245 YY, 210 Yy, 45 yy) → p = 0.7, q = 0.3, genotype frequencies 0.49 / 0.42 / 0.09; assumes a very large population without mutation, migration or selection (read 10.10.2026). Updated: .

My ToolboxYour inputs are saved in this browser only.

Result

Allele frequencies
p = 0.7, q = 0.3 · heterozygous 42 %
Expected genotype frequencies
QuantityValue
Alleles in the gene pool2 × 500 = 1,000
p = dominant alleles ÷ all alleles(2 × 245 + 210) ÷ 1,000 = 0.7
p (dominant allele)0.7
q (recessive allele)1 − 0.7 = 0.3
AAp² = 0.49 = 49 % (expected 245)
Aa (carriers)2pq = 0.42 = 42 % (expected 210)
aaq² = 0.09 = 9 % (expected 45)
Calculated for Hardy-Weinberg equilibrium: a very large population without mutation, migration or selection. Real populations deviate from it.

How it is calculated

p + q = 1 and p² + 2pq + q² = 1. In OpenStax Biology p stands for the frequency of the dominant allele and q for the recessive one. If alleles combine at random, p² of the population is homozygous dominant, 2pq heterozygous and q² homozygous recessive. The principle assumes a very large population with no mutation, migration or selection; real populations are compared against it.

The OpenStax example

A population of 500 pea plants has 245 YY, 210 Yy and 45 yy. Each plant carries two alleles, so the gene pool has 1000 alleles. Y alleles: 2 × 245 + 210 = 700, so p = 700 ÷ 1000 = 0.7; y alleles: 210 + 2 × 45 = 300, so q = 0.3. Expected frequencies: p² = 0.49, 2pq = 0.42, q² = 0.09 – exactly 245, 210 and 45 of 500 plants, so this population is in equilibrium.

From the recessive phenotype to carriers

Recessive share q²qpCarriers 2pq
9 %0.30.742 %
1 %0.10.918 %
0.04 % (1 in 2500)0.020.983.92 % (about 1 in 25.5)

Only the homozygous recessive genotype can be seen from the phenotype, as OpenStax notes; the calculation gives the rest. A rare recessive trait therefore has many more hidden carriers: at q² = 1 in 2500, almost 4 % of people carry the allele. Whether observed genotype counts fit the expected ones is tested with the chi-square test calculator; the basics of combining probabilities are in the probability calculator.

Frequently asked questions

What do p and q mean in Hardy-Weinberg?

p is the frequency of the dominant allele, q that of the recessive allele. With only two alleles, p + q = 1.

How do I find p and q from genotype counts?

Count the alleles: p = (2 × AA + Aa) ÷ (2 × total). For 245, 210 and 45 plants: (490 + 210) ÷ 1000 = 0.7, q = 0.3.

How do I get q from the recessive phenotype?

q = √q². If 9 % show the recessive trait, q = √0.09 = 0.3 and p = 0.7.

How many carriers are there?

Carriers are the heterozygotes, 2pq. With p = 0.7 and q = 0.3 that is 0.42, i.e. 42 %.

What are the conditions of Hardy-Weinberg equilibrium?

A very large population with no mutation, no migration and no selection for or against a genotype. No real population meets them completely.

How do I test whether a population is in equilibrium?

Compare the observed genotype counts with the expected ones (p², 2pq, q² times the population size), for example with a chi-square test.

Sources and legal basis

As of: · Editorial policy

Related tools