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
How to Use This Calculator
- Enter Dominant Allele Frequency (p) and Population Size.
- Review Dominant Allele Freq (p), Recessive Allele Freq (q), and AA Genotype Freq (p²).
- Use Aa Genotype Freq (2pq) and aa Genotype Freq (q²) to inform your decision.
- 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.3 | 0.3 | 0.7 | 0.09 |
| 0.45 | 0.45 | 0.55 | 0.2025 |
| 0.9 | 0.9 | 0.1 | 0.81 |
| 1 | 1 | 0 | 1 |
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 = 1Worked example, using the default values
- Identify Input ParametersDominant Allele Frequency (p) = 0.6, Population Size = 1000 = 2 input(s) provided
- Calculate Dominant Allele FreqDominant Allele Freq0.6 = 0.6
- Calculate Recessive Allele FreqRecessive Allele Freq0.4 = 0.4
- Calculate AA Genotype FreqAA Genotype Freq0.36 = 0.36
- Calculate Expected AA IndividualsExpected AA Individuals360 = 360
- Calculate Expected Aa IndividualsExpected Aa Individuals480 = 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.
Related Calculators
The questions that sit next to this one — chosen by subject, including calculators filed under a different category.
Punnett Square Generator
Calculate offspring genotype and phenotype ratios from parent genotypes using a Punnett square for monohybrid crosses.
BiologyCell Doubling Time
Calculate cell doubling time, growth rate, and generation count from optical density measurements over time.
BiologyBeer-Lambert Law Calculator
Calculate concentration from absorbance using the Beer-Lambert law (A = εlc). Also computes transmittance.
More in Science & Physics.