Skip to main content

Hardy-Weinberg Equilibrium Calculator

The Hardy-Weinberg Equilibrium Calculator models allele and genotype distributions in biological populations according to the fundamental theorem of population genetics ($p^2 + 2pq + q^2 = 1$).

Choose how your genetic data is structured: clinical disease prevalence, direct allele frequencies, or observed field sample counts.

Format for expressing homozygous recessive trait prevalence in the population.

Number of people among whom on average one person is affected (e.g., 2,500).

Percentage of the population expressing the recessive phenotype (q² × 100).

Decimal proportion of homozygous recessive individuals in the population (q²).

Choose whether you are providing p or q.

Frequency of the specified allele in the gene pool.

Observed number of homozygous dominant individuals in your sample.

Observed number of heterozygous carriers in your sample.

Observed number of homozygous recessive individuals in your sample.

Total population size to project absolute expected genotype headcounts.

Calculated Result
1 in 26 (3.92%)Ratio (1 in X)

Carrier Frequency (2pq)

Carrier Rate

1 in 26

Dominant (p)

0.9800

Recessive (q)

0.0200

Affected (q²)

1 in 2,500

Carriers in Pop

3,920

Calculation Breakdown

  1. 1. Allele Frequencies (p + q = 1)Calculated from q = √q² = √(0.000400) = 0.0200.Dominant Allele (p): 0.9800 | Recessive Allele (q): 0.0200
  2. 2. Expected Genotype Frequencies (p² + 2pq + q² = 1)Heterozygous carrier prevalence: 1 in 26 individuals.AA (p²): 96.04% | Aa (2pq): 3.92% | aa (q²): 0.0400%
  3. 3. Population ProjectionsAA: 96,040 | Aa (Carriers): 3,920 | aa (Affected): 40In a population of 100,000 individuals:

Carrier Frequency (2pq %) Across Different Recessive Allele Frequencies (q)

Interactive visualization based on your current inputs

Carrier % (2pq)
0.013253850q = 0.01 (1 in 10,000)q = 0.02 (1 in 2,500)q = 0.05 (1 in 400)q = 0.10 (1 in 100)q = 0.20 (1 in 25)q = 0.30 (1 in 11)q = 0.50 (Max Carriers)q = 0.70Recessive Allele Frequency (q)Carrier Frequency (2pq %)

What Is the Hardy-Weinberg Equilibrium Calculator?

The Hardy-Weinberg Equilibrium Calculator is a core population genetics tool that analyzes the mathematical relationship between allele frequencies and genotype frequencies in sexually reproducing diploid organisms.

Formulated independently in 1908 by English mathematician G. H. Hardy and German physician Wilhelm Weinberg, the principle demonstrated that Mendelian inheritance does not inherently cause dominant alleles to spread or recessive alleles to vanish. Instead, genotype frequencies naturally settle into stable binomial equilibrium (p2+2pq+q2=1p^2 + 2pq + q^2 = 1) after a single generation of random mating.

In medical genetics and evolutionary biology, the theorem serves two indispensable purposes: (1) calculating asymptomatic carrier rates for rare genetic diseases from observed disease incidence, and (2) serving as a null hypothesis to detect evolutionary forces acting on wild and domesticated populations.

How Does the Hardy-Weinberg Equilibrium Calculator Work?

1. Recessive Disease Prevalence Modeling: When given an incidence rate (q2q^2), the calculator takes the square root to determine recessive allele frequency: q=q2q = \sqrt{q^2}. The dominant allele frequency is then found by subtraction: p=1−qp = 1 - q.

2. Carrier Frequency Computation: The heterozygous carrier frequency (2pq2pq) is computed directly. Because pp is close to 1 for rare diseases, carriers (2pq2pq) vastly outnumber affected individuals (q2q^2) by a ratio of 2p/q2p/q.

3. Allele Counting for Sample Data: When provided with observed genotype counts (NAA,NAa,NaaN_{AA}, N_{Aa}, N_{aa}), allele frequencies are calculated directly: p=(2NAA+NAa)/2Np = (2N_{AA} + N_{Aa}) / 2N and q=(2Naa+NAa)/2Nq = (2N_{aa} + N_{Aa}) / 2N.

4. Expected Genotype Counts: Expected genotype counts under equilibrium are computed: EAA=p2×NE_{AA} = p^2 \times N, EAa=2pq×NE_{Aa} = 2pq \times N, and Eaa=q2×NE_{aa} = q^2 \times N.

5. Chi-Square Goodness-of-Fit Test: The deviation between observed and expected counts is evaluated: χ2=∑(O−E)2E\chi^2 = \sum \frac{(O - E)^2}{E} with df=1df = 1. If χ2≤3.841\chi^2 \le 3.841 (p>0.05p > 0.05), the population conforms to equilibrium. If χ2>3.841\chi^2 > 3.841 (p≤0.05p \le 0.05), equilibrium is rejected.

6. Fixation Index (Inbreeding Coefficient F): Evaluates the departure of observed heterozygosity from expected: F=1−HobsHexpF = 1 - \frac{H_{obs}}{H_{exp}}.

Hardy-Weinberg Equilibrium Calculator Formula & Variables

The core mathematical equation utilized by this calculator is expressed as:

Allele Frequencies: p + q = 1 Genotype Frequencies: p² + 2pq + q² = 1 Recessive Allele: q = √(q²) Dominant Allele: p = 1 - q Carrier Frequency: 2pq = 2 × p × q Chi-Square Test (df = 1): χ² = ∑ [(O - E)² ÷ E]

Variable Definitions

SymbolVariable Meaning & Units
pFrequency of dominant allele (A) in the gene pool
qFrequency of recessive allele (a) in the gene pool
p²Frequency of homozygous dominant genotype (AA)
2pqFrequency of heterozygous carriers (Aa)
q²Frequency of homozygous recessive affected individuals (aa)
χ²Chi-square test statistic to evaluate deviation from equilibrium (critical value 3.841 at α = 0.05)

The Hardy-Weinberg principle states that allele and genotype frequencies in a population remain constant across generations in the absence of evolutionary influences (selection, mutation, migration, genetic drift, and non-random mating).

How to Use the Hardy-Weinberg Equilibrium Calculator

  1. 1. Choose your calculation mode: Recessive Disease Prevalence, Direct Allele Frequency, or Observed Genotype Counts.
  2. 2. If using Recessive Disease mode, choose whether you are entering a ratio (e.g. 1 in 2,500), a percentage (e.g. 0.04%), or a decimal frequency.
  3. 3. If using Genotype Counts mode, enter your observed counts for AA, Aa, and aa from genetic sequencing or gel electrophoresis.
  4. 4. Enter your reference population size to project total carrier and affected headcounts.
  5. 5. Review your complete allele frequencies (p, q), genotype proportions (p², 2pq, q²), and carrier ratios.
  6. 6. Inspect the Chi-Square test statistic, p-value, and inbreeding coefficient (F) to confirm whether your population conforms to neutral panmictic equilibrium.

Step-by-Step Example Calculation

Cystic Fibrosis Carrier Calculation (1 in 2,500 affected)

Input Values:

inputMode:recessive_trait
recessiveInputType:one_in_x
oneInX:2500
populationSize:100000
Worked Steps: In Northern European populations, Cystic Fibrosis affects roughly 1 in 2,500 newborns (q² = 0.0004). Taking the square root gives a recessive allele frequency of q = 0.02, meaning the dominant normal allele frequency is p = 0.98. The carrier frequency is 2pq = 2 × 0.98 × 0.02 = 0.0392, or 3.92%. This reveals that approximately 1 in 26 people is an asymptomatic carrier of the CFTR mutation, resulting in 3,920 carriers and 40 affected individuals per 100,000 population.

Understanding Your Result

Dominant Allele Frequency (p): The proportion of normal/dominant alleles in the gene pool.

Recessive Allele Frequency (q): The proportion of mutant/recessive alleles in the gene pool.

Homozygous Dominant Frequency (p²): Expected percentage of individuals possessing two normal alleles (AA).

Carrier Frequency (2pq): Expected percentage of healthy, asymptomatic individuals carrying one mutant recessive allele (Aa).

Homozygous Recessive Frequency (q²): Expected percentage of individuals clinically affected by the autosomal recessive trait (aa).

Chi-Square Statistic (χ²) and P-Value: Quantifies whether discrepancies between observed and expected counts are due to random sampling noise or true evolutionary pressures.

Inbreeding Coefficient (F): Measures non-random mating; positive values denote inbreeding/structure, while negative values denote outbreeding/heterozygote advantage.

Factors That Affect the Result

  • Non-Random Mating: Assortative mating (phenotypic preference) or inbreeding (mating between relatives) increases homozygosity without altering allele frequencies.
  • Natural Selection: Differential survival or reproductive success changes allele frequencies over generations (e.g., lethal recessive alleles or sickle cell heterozygote advantage).
  • Genetic Drift: In small populations, random sampling of gametes causes stochastic fluctuations in allele frequencies, leading to accidental fixation or allele loss.
  • Gene Flow (Migration): Influx of migrants from populations with differing allele frequencies shifts the local gene pool equilibrium.
  • Mutation Pressure: The spontaneous conversion of allele A to a (or back-mutation) introduces new genetic variation at low baseline rates (10−510^{-5} to 10−610^{-6} per locus per generation).

When Should You Use This Calculator?

  • Genetic Counseling: Estimating the probability that a prospective parent is an asymptomatic carrier of an autosomal recessive disease.
  • Conservation Biology: Assessing loss of genetic diversity and inbreeding depression in endangered species populations.
  • Forensic Genetics: Calculating match probabilities for multi-locus STR DNA profiles across ethnic databases.
  • Genome-Wide Association Studies (GWAS): Quality control screening to detect genotyping errors, PCR allele dropout, or copy number variations when SNP markers fail HWE.

Assumptions & Limitations

  • Assumes a single autosomal bi-allelic locus in diploid organisms; X-linked or mitochondrial genes require sex-specific or haploid modifications.
  • Assumes discrete non-overlapping generations and equal allele frequencies between sexes.
  • Chi-Square goodness-of-fit test requires expected counts of at least 5 in every cell for robust asymptotic validity; small samples require Fisher’s exact test.

Frequently Asked Questions

Calculation Accuracy & Reference Note

Mathematical formulas, chi-square degrees of freedom (df=1df = 1), and inbreeding fixation formulas adhere strictly to standards in Hartl & Clark’s Principles of Population Genetics and Hedrick’s Genetics of Populations.

Standard Reference: Hartl & Clark’s Principles of Population Genetics; Hedrick’s Genetics of Populations; Strachan & Read’s Human Molecular Genetics.