Skip to content
Tezmy Tools

Hardy-Weinberg Calculator

Find allele and genotype frequencies p, q, p², 2pq and q² and test for equilibrium

Carriers (Aa, 2pq)

32%

p = 0.8, q = 0.2

p (dominant allele A)
0.8
q (recessive allele a)
0.2
p² (AA)
0.64 (64%)
2pq (Aa)
0.32 (32%)
q² (aa)
0.04 (4%)
Expected AA, Aa, aa (counts)
640, 320, 40

Assumes a large, randomly mating population with no selection, mutation, migration or drift. The p + q = 1 and p² + 2pq + q² = 1 rules only hold under those conditions.

Runs in your browser. Nothing is uploaded.

About the Hardy-Weinberg Calculator

Hardy-Weinberg Calculator finds the allele and genotype frequencies of a population that is in Hardy-Weinberg equilibrium. Start with the share of people who show the recessive trait (q²), with one allele frequency (p or q), or with counts of AA, Aa and aa individuals, and the page gives p, q, p² (homozygous dominant), 2pq (carriers) and q² (homozygous recessive), with expected counts for your population size. If you enter counts, it also runs a chi-square test to see whether the population fits equilibrium.

Updated October 2026

How to use the Hardy-Weinberg Calculator

  1. 1Choose what you know: q², q, p or the genotype counts.
  2. 2Enter the value as a decimal such as 0.04 or a percentage such as 4%, or the counts.
  3. 3Read p, q and the three genotype frequencies.
  4. 4Enter a population size to see expected counts of each genotype.
  5. 5With counts, read the chi-square verdict.

The two equations

With two alleles, the allele frequencies add up to 1: p + q = 1. After one round of random mating, the genotypes appear in the proportions p² for AA, 2pq for Aa and q² for aa, and these also add up to 1. The beauty of the principle is that it lets you turn the one number you can observe, the share with the recessive trait, into the whole picture.

A worked example

Suppose 4% of a population shows a recessive trait. Then q² = 0.04, so q = 0.2 and p = 0.8. The homozygous dominant share is p² = 0.64, the carrier share is 2pq = 0.32 and the recessive share is q² = 0.04. In a population of 1,000 that means about 640 AA, 320 Aa and 40 aa people.

  • p² + 2pq + q² = 0.64 + 0.32 + 0.04 = 1
  • Carriers are far more common than affected people
  • Most copies of a rare recessive allele are hidden in carriers

Testing real data

If you have counts, the page works out p from them and compares the observed numbers with the expected ones. A significant difference suggests that one of the conditions, such as random mating, does not hold. Small expected counts make the test unreliable, so use enough individuals.

Related tools

Practise crosses with the Punnett Square Calculator, test hypotheses with the Chi-Square Calculator and compute chances with the Probability Calculator. The Blood Type Calculator shows ABO inheritance.

Features

  • Start from q², q, p or genotype counts
  • Carrier frequency 2pq
  • Expected counts for a population
  • Chi-square test against equilibrium
  • Accepts percentages
  • Private: nothing is uploaded

Frequently asked questions

What is the Hardy-Weinberg principle?

In a large population with random mating and no selection, mutation, migration or drift, allele and genotype frequencies stay constant from generation to generation, and the genotype frequencies are p², 2pq and q².

What are p and q?

p is the frequency of the dominant allele A and q the frequency of the recessive allele a. Together p + q = 1.

How do I find the carrier frequency from the disease rate?

Take the square root of the share of affected people to get q, find p = 1 − q, and compute 2pq. If 1 in 2,500 people is affected (q² = 0.0004), q = 0.02 and carriers are about 2 × 0.98 × 0.02 = 3.9%.

How is the chi-square test used?

It compares the observed counts with those expected under equilibrium. A value below 3.841 (one degree of freedom at the 5% level) means the population fits equilibrium.

Why must I use the recessive trait to start?

Heterozygotes look like the homozygous dominant, so only the recessive phenotype can be counted directly from its appearance.

When does the principle not apply?

Small populations, non-random mating such as inbreeding, natural selection, mutation and migration all change the frequencies.

Can I enter a percentage?

Yes. Type 4% instead of 0.04.

Is my data stored?

No. Everything runs in your browser.

Related tools