Hardy-Weinberg Equilibrium Calculator
The Hardy-Weinberg equation is one of the foundational tools of population genetics, describing what genotype frequencies to expect in a population that isn’t actively evolving at a given gene. Given just one number — the frequency of the dominant allele, p — this calculator instantly derives the expected proportions of all three genotypes: homozygous dominant, heterozygous, and homozygous recessive.
Below the calculator you’ll find the five core assumptions behind Hardy-Weinberg equilibrium, why the p² + 2pq + q² = 1 equation works mathematically, a worked example with the exact default numbers, how real populations deviate from equilibrium and what that reveals, how researchers use HWE as a null hypothesis, common mistakes, a reference table, and an expanded FAQ.
Hardy-Weinberg Equilibrium Calculator
🧬 Blogyz CalcEstimates only — formulas follow the official standard for this stat, but always confirm against your league’s exact scoring rules.
The Five Assumptions Behind Hardy-Weinberg Equilibrium
The Hardy-Weinberg principle only holds exactly true under five idealized conditions: no mutation introducing new alleles, no migration bringing alleles in or out of the population, no natural selection favoring any genotype, completely random mating with respect to the gene in question, and an infinitely large population size so random chance doesn’t skew allele frequencies between generations.
No real population perfectly satisfies all five conditions simultaneously, which is exactly what makes Hardy-Weinberg so useful as a scientific tool — it’s not meant to describe reality precisely, but to serve as a theoretical baseline. Comparing real, observed genotype frequencies against the Hardy-Weinberg expectation is how geneticists detect that evolutionary forces are actually at work in a population.
Why p² + 2pq + q² = 1 Works
The Hardy-Weinberg genotype equation is really just the binomial expansion of (p + q)², where p and q are the frequencies of the two alleles. Expanding (p + q)² algebraically gives p² + 2pq + q² — and because p + q always equals 1, that expansion must also equal 1² = 1. Each term has a direct genetic meaning: p² is the probability of randomly drawing two A alleles (AA genotype), q² is the probability of drawing two a alleles (aa genotype), and 2pq is the probability of drawing one of each, doubled because there are two ways to form a heterozygote (A from mom and a from dad, or vice versa).
This elegant connection between basic probability and population genetics is part of why the Hardy-Weinberg equation, first described independently by G.H. Hardy and Wilhelm Weinberg in 1908, remains a cornerstone of genetics education more than a century later — it converts a simple allele frequency into a complete, testable prediction for genotype proportions across an entire population.
A Worked Example
Using this calculator’s default value of p = 0.7 (meaning 70% of alleles in the population’s gene pool are the dominant A allele), q = 1 − 0.7 = 0.3. Expected genotype frequencies: AA = p² = 0.7² = 0.49 (49.0%), Aa = 2pq = 2 × 0.7 × 0.3 = 0.42 (42.0%), and aa = q² = 0.3² = 0.09 (9.0%). Adding these three together: 49.0% + 42.0% + 9.0% = 100.0%, confirming the equation balances exactly.
Notice that even though the dominant allele A is far more common (70% of the gene pool), the homozygous dominant genotype AA only accounts for 49% of the population — less than half. This is a common surprise for students first learning Hardy-Weinberg: high allele frequency does not directly translate to an equally high genotype frequency, because of how the squaring and cross-term math works out.
How Real Populations Deviate From HWE
When observed genotype frequencies in a real population don’t match the Hardy-Weinberg prediction, that mismatch is informative rather than a failure of the model. Deviation can indicate natural selection favoring or disfavoring a particular genotype, non-random mating patterns such as inbreeding or assortative mating, genetic drift in a small population where chance plays an outsized role, or recent migration introducing alleles from a genetically distinct population.
A classic example is inbreeding, which tends to increase the observed frequency of both homozygous genotypes (AA and aa) above the Hardy-Weinberg prediction while decreasing the observed heterozygote (Aa) frequency below it — even while the underlying allele frequencies p and q stay exactly the same.
HWE as a Null-Hypothesis Test in Genetics Research
In modern genetics research, Hardy-Weinberg equilibrium is routinely used as a statistical null hypothesis — the default assumption that no evolutionary force is acting on a given gene, against which real data gets tested. Researchers commonly run a chi-square test comparing observed genotype counts against Hardy-Weinberg expected counts to formally determine whether a population’s genotype distribution deviates significantly from equilibrium at a particular locus.
This approach shows up across many fields, from screening large genomic datasets for genotyping errors (since real technical errors often produce HWE deviations that look biologically implausible) to detecting genes that may be under active selection pressure in wild or human populations.
Common Mistakes When Working With Hardy-Weinberg
A frequent mistake is confusing allele frequency with genotype frequency — treating p directly as “the percentage of the population with genotype AA” rather than correctly squaring it first. As the worked example above shows, these two numbers can differ substantially (70% allele frequency versus 49% genotype frequency in this case), so it’s important to keep the distinction clear.
Another common error is forgetting the factor of 2 in the heterozygote term — using pq instead of 2pq. Since there are two distinct ways to end up heterozygous (A from one parent and a from the other, in either order), omitting the factor of 2 will always undercount the true expected heterozygote frequency.
Interpreting Genotype Frequencies in Practice
Once you have the three expected genotype frequencies, it’s worth pausing to interpret what they actually mean for a population. The heterozygote frequency (2pq) is maximized precisely when p and q are both close to 0.5, and it shrinks toward zero as either allele becomes very rare or very common — this is why heterozygosity is often used as a rough proxy for a population’s overall genetic diversity at a given gene.
Geneticists also use the expected homozygous recessive frequency (q²) to estimate how common a recessive trait or condition should be in a population, working backward from an observed q² to solve for q, and then for the expected carrier frequency 2pq — a technique widely used in population-level genetic counseling and public health screening programs.
| Term | Meaning | Default Example (p=0.7) |
|---|---|---|
| p² | Expected AA (homozygous dominant) frequency | 0.49 (49.0%) |
| 2pq | Expected Aa (heterozygous) frequency | 0.42 (42.0%) |
| q² | Expected aa (homozygous recessive) frequency | 0.09 (9.0%) |
| p² + 2pq + q² | Sum — always equals 1 | 1.00 (100.0%) |
FAQ
What does it mean for a population to be “in Hardy-Weinberg equilibrium”?
It means the population’s observed genotype frequencies closely match what the p² + 2pq + q² equation predicts from the allele frequencies, indicating no strong evolutionary force is currently disrupting that balance at the gene in question.
Who developed the Hardy-Weinberg principle?
It was independently derived in 1908 by British mathematician G.H. Hardy and German physician Wilhelm Weinberg, which is why it carries both of their names.
Does Hardy-Weinberg equilibrium mean a population isn’t evolving at all?
It only means the specific gene tested isn’t showing detectable deviation from the five idealized assumptions — other genes in the same population can still be actively evolving.
Can allele frequencies themselves change while still staying in HWE?
Yes — the equilibrium refers to the relationship between allele and genotype frequencies staying stable within a single generation of random mating; allele frequencies can still shift gradually across generations due to selection, drift, or migration.
Why does an infinite population size matter for the assumptions?
In small populations, random chance (genetic drift) can cause allele frequencies to fluctuate unpredictably between generations regardless of selection, which violates the idealized math the equation assumes.
How is Hardy-Weinberg used in medical genetics?
It’s commonly used to estimate carrier frequencies for recessive genetic conditions in a population, using the observed frequency of affected individuals (q²) to back-calculate the carrier (heterozygote) frequency.
What if p is entered as 0 or 1?
Those are valid edge cases — p = 0 means the population is fixed for the recessive allele (100% aa), and p = 1 means it’s fixed for the dominant allele (100% AA); the calculator handles both correctly.
Does Hardy-Weinberg apply to genes on sex chromosomes?
The standard equation assumes an autosomal gene; genes on the X or Y chromosome require a modified version of the equation because males and females don’t carry the same number of allele copies.
Is one generation of random mating enough to reach Hardy-Weinberg equilibrium?
Yes — remarkably, for an autosomal gene, a single generation of random mating is mathematically sufficient to bring genotype frequencies into Hardy-Weinberg proportions, assuming the other four conditions hold.
How does this relate to allele frequency calculations?
Hardy-Weinberg takes an allele frequency as its starting input — you can calculate that allele frequency directly from genotype counts using a dedicated allele frequency calculator, then feed the result into this equation.
