Skip to main content
Calcimator

Hardy-Weinberg Calculator

Calculate genotype frequencies (p², 2pq, q²) from allele frequencies using the Hardy-Weinberg equilibrium equation.

About this calculator

The Hardy-Weinberg principle describes the genotype frequencies you'd expect in a population that is NOT evolving — no mutation, no migration, no selection, no genetic drift, and random mating — making it the null hypothesis population geneticists test real populations against. Given the dominant allele frequency p (the calculator derives the recessive frequency q as 1 − p, since the two must sum to 1), the expected genotype frequencies fall out of expanding (p + q)²: p² for homozygous dominant (AA), 2pq for heterozygous (Aa), and q² for homozygous recessive (aa), and this calculator computes all three directly from that expansion. Multiplying each frequency by your population size gives expected head counts — how many AA, Aa, and aa individuals you'd see in a population of, say, 1,000 people or organisms at true equilibrium.

In practice, biologists use these numbers as a baseline: comparing observed genotype counts in a real sample against these expected counts (often via a chi-square test) reveals whether the population is actually evolving, and if so, which equilibrium assumption is likely being violated. A common mixup is treating p and q as genotype frequencies rather than allele frequencies — p and q describe the proportion of a single allele in the gene pool, not the proportion of individuals carrying it, and only their squares and cross-product translate allele frequencies into genotype frequencies. Also note the equation only applies to a single gene locus with two alleles in a large, randomly mating, diploid population.

Inputs

Results

Dominant Allele Freq (p)

0.6

Recessive Allele Freq (q)

0.4

AA Genotype Freq (p²)

0.36

Aa Genotype Freq (2pq)

0.48

aa Genotype Freq (q²)

0.16

Expected AA Individuals360
Expected Aa Individuals480
Expected aa Individuals160
How to Use This Calculator
  1. Enter Dominant Allele Frequency (p) and Population Size.
  2. Review Dominant Allele Freq (p), Recessive Allele Freq (q), and AA Genotype Freq (p²).
  3. Use Aa Genotype Freq (2pq) and aa Genotype Freq (q²) to inform your decision.
  4. Use the chart to visualize the results and explore different scenarios by adjusting inputs.

How the result changes with Dominant Allele Frequency (p)

Dominant Allele Frequency (p)Dominant Allele Freq (p)Recessive Allele Freq (q)AA Genotype Freq (p²)
0.30.30.70.09
0.450.450.550.2025
0.90.90.10.81
1101

What each input means

Dominant Allele Frequency (p)
Frequency of the dominant allele in the population (0 to 1). The recessive allele frequency q is calculated as 1 - p.
Population Size
Total number of individuals in the population for expected count calculations.

How this is calculated

Formula

p² + 2pq + q² = 1, where p + q = 1

Worked example, using the default values

  1. Identify Input Parameters
    Dominant Allele Frequency (p) = 0.6, Population Size = 1000 = 2 input(s) provided
  2. Calculate Dominant Allele Freq
    Dominant Allele Freq
    0.6 = 0.6
  3. Calculate Recessive Allele Freq
    Recessive Allele Freq
    0.4 = 0.4
  4. Calculate AA Genotype Freq
    AA Genotype Freq
    0.36 = 0.36
  5. Calculate Expected AA Individuals
    Expected AA Individuals
    360 = 360
  6. Calculate Expected Aa Individuals
    Expected Aa Individuals
    480 = 480

Engine last updated . Checked against 2 independently-derived tests — how we verify calculators. Built by Paul Gunder, a software engineer, not a licensed financial, medical, or legal professional.

Frequently Asked Questions

Why does the heterozygous frequency use 2pq instead of just pq?

The factor of 2 accounts for the two distinct ways a heterozygote can form — the dominant allele can come from the mother and the recessive from the father, or vice versa. Expanding (p + q)² gives p² + 2pq + q², and the cross-term captures both parental combinations, which is why heterozygotes typically outnumber either homozygous class when p and q are close to equal.

What does it mean if a real population's observed genotype counts don't match this calculator's expected counts?

Since Hardy-Weinberg equilibrium assumes no mutation, migration, selection, genetic drift, and fully random mating, a mismatch between observed and expected counts (typically tested with a chi-square test) signals that the real population is violating at least one of those assumptions — in other words, it's evolving. This calculator only produces the equilibrium expectation; it doesn't run that statistical test itself.

Can I use this calculator for a gene with three alleles, or for a haploid organism?

No. The p² + 2pq + q² formula this calculator implements is specifically the two-allele, diploid expansion, and it only takes a single allele frequency p (deriving q as 1 − p). A locus with three or more alleles requires a different multinomial expansion with additional cross-terms that this engine doesn't compute.

Why do I only need to enter p and not q separately?

Because p and q represent the frequencies of the only two alleles at that locus, they're required to sum to exactly 1, so the calculator derives q as 1 − p automatically rather than asking for a redundant second input that could be entered inconsistently with p.

The questions that sit next to this one — chosen by subject, including calculators filed under a different category.

More in Science & Physics.