Hardy Weinberg Equilibrium Calculator
Calculate allele and genotype frequencies using the Hardy-Weinberg equation. Test populations for HWE with chi-square analysis and find carrier
Hardy Weinberg Equilibrium Calculator
Calculator
Adjust values & calculateEnter your values below. Every result is computed in your browser โ no data is sent to any server.
Formula: p^2 + 2pq + q^2 = 1 ; p + q = 1
Worked example โ Carrier frequency = 3.92% (approximately 1 in 25 people)
Formula
p^2 + 2pq + q^2 = 1 ; p + q = 1
Where p = frequency of dominant allele (A), q = frequency of recessive allele (a), p^2 = frequency of AA genotype, 2pq = frequency of Aa genotype (carriers), q^2 = frequency of aa genotype. The sum of all genotype frequencies equals 1.
Worked Examples
Example 1: Cystic Fibrosis Carrier Frequency
Problem:Cystic fibrosis affects 1 in 2,500 Caucasians. What is the carrier frequency?
Solution:q squared = 1/2500 = 0.0004 q = sqrt(0.0004) = 0.02 p = 1 - 0.02 = 0.98 Carrier frequency (2pq) = 2 x 0.98 x 0.02 = 0.0392
Result:Carrier frequency = 3.92% (approximately 1 in 25 people)
Example 2: Testing HWE with Observed Data
Problem:In 500 individuals: 280 AA, 190 Aa, 30 aa. Is this in HWE?
Solution:p = (2x280 + 190) / 1000 = 0.75, q = 0.25 Expected: AA = 0.5625 x 500 = 281.25, Aa = 0.375 x 500 = 187.5, aa = 0.0625 x 500 = 31.25 Chi-square = (280-281.25)^2/281.25 + (190-187.5)^2/187.5 + (30-31.25)^2/31.25 = 0.0056 + 0.0333 + 0.05 = 0.0889
Result:Chi-square = 0.089 < 3.841 โ Population IS in HWE
Frequently Asked Questions
What is the Hardy-Weinberg equilibrium equation?
The Hardy-Weinberg equation states that p squared + 2pq + q squared = 1, where p is the frequency of the dominant allele and q is the frequency of the recessive allele. Additionally, p + q = 1. The term p squared represents the frequency of homozygous dominant (AA) individuals, 2pq represents heterozygous (Aa) carriers, and q squared represents homozygous recessive (aa) individuals. This equation predicts genotype frequencies from allele frequencies in an ideal population at equilibrium, serving as a null model against which evolutionary change can be detected.
What are the five conditions for Hardy-Weinberg equilibrium?
For a population to remain in Hardy-Weinberg equilibrium, five conditions must be met: (1) No mutation, so alleles are not converted from one form to another. (2) Random mating, meaning individuals do not choose mates based on genotype. (3) No natural selection, so all genotypes have equal fitness. (4) Infinitely large population size, eliminating genetic drift. (5) No gene flow, meaning no migration into or out of the population. In reality, no natural population meets all conditions perfectly, but HWE serves as a useful baseline for detecting evolutionary forces.
How do you use Hardy-Weinberg to find carrier frequency?
To find carrier frequency, first determine q squared from the frequency of affected (homozygous recessive) individuals. Take the square root to get q, then calculate p = 1 - q. The carrier frequency is 2pq. For example, if a disease affects 1 in 10,000 people, then q squared = 0.0001, q = 0.01, p = 0.99, and carrier frequency = 2 x 0.99 x 0.01 = 0.0198, or about 1 in 50 people. This application is particularly important in medical genetics for estimating how many people carry a recessive disease allele without showing symptoms.
What causes a population to deviate from Hardy-Weinberg equilibrium?
Any violation of the five HWE assumptions can cause deviation. Natural selection changes allele frequencies by favoring certain phenotypes. Genetic drift causes random fluctuations in small populations. Mutation introduces new alleles. Gene flow (migration) adds or removes alleles. Non-random mating (assortative mating, inbreeding) alters genotype frequencies. Population bottlenecks and founder effects also cause deviations. The chi-square test can detect significant deviations from expected HWE proportions, helping identify which evolutionary forces may be acting.
What does an excess of homozygotes mean when a population fails the Hardy-Weinberg test?
A surplus of both homozygous classes with a matching shortfall of heterozygotes is the commonest direction of departure, and it has three routine explanations. Inbreeding raises homozygosity genome-wide, and its magnitude is summarised by the fixation index F = 1 - (observed heterozygosity / expected heterozygosity), which is zero at equilibrium and approaches 1 as heterozygotes vanish. The Wahlund effect produces the identical signature with no inbreeding at all, when two subpopulations carrying different allele frequencies are pooled and analysed as a single sample. The technical version is a null allele that fails to amplify, so genuine heterozygotes are miscalled as homozygotes for whichever allele did amplify. A deviation in the opposite direction, more heterozygotes than expected, more often points to a duplicated locus or to paralogous sequences collapsed onto one marker.
Why does the chi-square test for Hardy-Weinberg use only one degree of freedom?
There are three genotype classes, but two constraints are imposed on them. One degree of freedom is lost because the observed counts must sum to the sample total, and a second is lost because the allele frequency p was estimated from those same counts rather than supplied independently. That leaves 3 - 1 - 1 = 1 degree of freedom, giving the familiar critical value of 3.841 at alpha 0.05. When any expected genotype count falls below about 5, the chi-square approximation degrades and an exact test is preferable.
How do you apply Hardy-Weinberg to an X-linked locus?
Males are hemizygous, carrying a single X, so they have no heterozygous class and the frequency of affected males equals q directly rather than q squared. Females follow the usual p squared, 2pq, q squared proportions. That asymmetry explains why X-linked recessive conditions appear far more often in males: if 1 in 5,000 males is affected, q is 0.0002, affected females occur at q squared, about 1 in 25 million, while carrier females sit near 2q, roughly 1 in 2,500.
What is the highest heterozygote frequency a two-allele locus can reach?
The heterozygote term 2pq peaks when p and q are both 0.5, where it equals exactly 0.5. No two-allele locus in Hardy-Weinberg proportions can have more than half its individuals heterozygous, no matter how the allele frequencies are arranged. The term falls away quickly as frequencies become skewed: at p = 0.9 the expected heterozygote frequency is 2 x 0.9 x 0.1 = 0.18. Observing markedly more heterozygotes than this ceiling allows is a signal of genotyping error or of pooled, structured samples.
Why do genotype frequencies reach equilibrium after only one generation of random mating?
Random mating is equivalent to drawing gametes at random from a shared pool, so offspring genotypes are simply the products of allele frequencies: p squared, 2pq and q squared. The starting genotype proportions do not matter, which is why a population of nothing but heterozygotes lands on equilibrium in a single generation. One caveat applies to autosomal loci when the sexes start with different allele frequencies: those frequencies equalise in the first generation and Hardy-Weinberg proportions are then reached in the second.
What does a Hardy-Weinberg failure mean in a genome-wide association study?
In GWAS pipelines the test is run as a quality-control filter rather than as biology. A marker that deviates strongly in healthy controls almost always reflects a technical fault such as poor genotype cluster separation, a failed assay, or a copy-number region that confuses allele calling, so the SNP is dropped. Deviation confined to the case group is treated differently, because genuine association can distort genotype proportions there. Cryptic population structure or sample duplication can also produce failures across many markers at once.
References
Background & Theory
History
Reviewed for accuracy by Daniel Agrici, Founder & Lead Developer ยท Editorial policy
Related Calculators
๐งฎAlpaca Gestation Calculator
Calculate alpaca gestation with inputs, formulas, and instant results.
๐งฎCat Pregnancy Calculator โ Due Date & Gestation
Calculate cat pregnancy with inputs, formulas, and instant results.
๐งฎCow Gestation Calculator
Calculate cow gestation with inputs, formulas, and instant results.
๐งฎDog Pregnancy Calculator: Due Date by Breed
Calculate dog pregnancy with inputs, formulas, and instant results.
๐งฎGoat Gestation Calculator
Calculate goat gestation with inputs, formulas, and instant results.
๐งฎGuinea Pig Pregnancy Calculator โ Due Date
Calculate guinea pig pregnancy with inputs, formulas, and instant results.
๐งฎLlama Gestation Calculator
Calculate llama gestation with inputs, formulas, and instant results.
๐งฎMare Gestation Calculator
Calculate mare gestation with inputs, formulas, and instant results.