Hardy-Weinberg Equilibrium Calculator

Find genotype frequencies from allele p under Hardy-Weinberg equilibrium, with counts.

Biology and LifeUpdated 2026-10-153 min read
Hardy-Weinberg Equilibrium Calculator
Allele q
...
AA homozygotes...
Aa heterozygotes...
aa homozygotes...

What it does

The Hardy-Weinberg rule gives the genotype shares you should see when nothing is pushing allele frequencies around. With two alleles A and a at frequencies p and q, random mating deals them into AA, Aa, and aa in the fixed proportions p squared, 2pq, and q squared. Teachers use it as a baseline, and field workers use it to spot when selection or structure is at work.

The tool above applies that rule at once. Type p and a population size, and it returns q plus all three genotype shares. The note below the result converts shares into whole person counts for your N, which helps when you compare a classroom sample or a study cohort against the null expectation.

Two habits keep results honest. First, keep allele frequency apart from genotype frequency: q is the share of the a allele, while q squared is the share of aa people. At p = 0.6, q = 0.4 but only 16% are aa. Second, remember the assumptions behind the page: random mating, no selection, no migration, no new mutation, and a large N. Small or structured samples drift from the expectation by chance.

The worked example uses p = 0.6 because the arithmetic stays clear and each class is large enough to picture. Defaults match that example, so the page opens already solved. Change p toward 0 or 1 to watch one homozygote take over, or set p = 0.5 to see heterozygotes peak at 50%.

Use the table below as a quick lookup for common p values, then run your own p through the tool for exact decimals. When observed counts differ from the expectation by more than sampling noise allows, that gap points to biology worth a closer look, such as selection, inbreeding, or hidden structure.

How to use

  1. Enter p, the frequency of allele A, as a decimal from 0 to 1.
  2. Enter the population size N as a whole number.
  3. Read q plus the three genotype shares in percent.
  4. Read the note for expected whole person counts in your N.
  5. Try nearby p values to see how fast the heterozygote share peaks at p = 0.5.
  6. Compare class data against these expectations before claiming selection.

Formula

q = 1 - p; AA = p squared; Aa = 2pq; aa = q squared. Counts = frequency x N.
p
Frequency of allele A, between 0 and 1.
q
Frequency of allele a, equal to 1 - p.
AA
Share of AA homozygotes, p squared.
Aa
Share of Aa heterozygotes, 2pq.
aa
Share of aa homozygotes, q squared.
N
Census size used to turn shares into expected counts.

The three shares always sum to 1 when q = 1 - p. Rounding counts to whole people can move the total by one, so the note on the tool shows rounded counts while the shares keep full precision. The model needs random mating, no selection, no migration, no new mutation, and a large population.

Worked example

Example: p = 0.6 in 1000 people

Allele A has frequency p = 0.6 in a population of 1000. Find q and the three genotype shares.

  1. q = 1 - p = 1 - 0.6 = 0.4000.
  2. AA = p squared = 0.6 x 0.6 = 0.36, shown as 36.00 %.
  3. Aa = 2pq = 2 x 0.6 x 0.4 = 0.48, shown as 48.00 %.
  4. aa = q squared = 0.4 x 0.4 = 0.16, shown as 16.00 %.
  5. Counts in 1000 people: 0.36 x 1000 = 360 AA.
  6. 480 Aa and 160 aa complete the set, and 360 + 480 + 160 = 1000.

Reference table

Genotype shares at common allele frequencies
pqAAAaaa
0.50.525.00 %50.00 %25.00 %
0.60.436.00 %48.00 %16.00 %
0.70.349.00 %42.00 %9.00 %
0.80.264.00 %32.00 %4.00 %
0.90.181.00 %18.00 %1.00 %

Limits

  • Two alleles only. More alleles need the expanded multinomial form.
  • Assumes random mating, so inbred or structured samples deviate.
  • Ignores selection, migration, mutation, and drift.
  • Small samples swing widely around the expectation by chance.

Common mistakes

  • Reading q as the aa genotype share instead of q squared.
  • Entering p as a percent like 60 instead of 0.6.
  • Forgetting that counts must round to whole people.
  • Applying the rule to tiny samples and calling noise selection.
  • Mixing up the dominant phenotype share (AA + Aa) with the A allele share p.

Try it yourself

Quick checks. Answers sit tucked under each question.

p = 0.7. What are q and the three shares?

q = 0.3000. AA = 49.00 %, Aa = 42.00 %, aa = 9.00 %.

p = 0.5 in 2000 people. Shares and counts?

q = 0.5000. Shares are 25.00 %, 50.00 %, 25.00 %. Counts are about 500 AA, 1000 Aa, 500 aa.

p = 0.9. What share is aa?

q = 0.1000. AA = 81.00 %, Aa = 18.00 %, aa = 1.00 %. Rare recessives hide mostly in heterozygotes.

Questions

What does Hardy-Weinberg equilibrium mean?

It is the null model for a two allele locus: with random mating and no selection, migration, mutation, or drift, genotype shares stay at p squared, 2pq, and q squared from one generation to the next.

How do I get q from p?

q = 1 - p. With p = 0.6, q = 0.4000. The tool prints q to four decimals so small differences stay visible.

How do I turn frequencies into counts?

Multiply each share by N and round. At p = 0.6 and N = 1000, expect about 360 AA, 480 Aa, and 160 aa.

Can p be 0 or 1?

Yes, when one allele is fixed. At p = 1, AA = 100% and the other two classes are 0%. At p = 0, aa = 100%.

Does this describe real populations exactly?

No. It is a starting model. Selection, nonrandom mating, migration, mutation, small size, and overlapping generations all push real populations away from it, which is exactly why the comparison is useful.

What should I check when numbers look wrong?

Check that p sits between 0 and 1, that N is a positive whole number, and that you read q (recessive allele) separately from q squared (recessive genotype).

Sources

How this page was checked. The formula above was matched against the cited sources, and the worked example was run through the tool on this page before publishing. If you spot an error, contact us so we can fix it and note the correction.