Solved.tools: Free Online Calculators & Tools

We use cookies for analytics and advertising. Learn more about our cookie policy

Hardy-Weinberg Equilibrium Calculator

Last updated: 23 August 2026

Reviewed by Gavin Meiring, Lead research and primary author · Doctoral Candidate (Corporate Governance) · Research and drafting assisted by AI

Hardy-Weinberg Equilibrium Calculator

Calculate allele and genotype frequencies. p² + 2pq + q² = 1

StandardBiologyHardy-Weinberg Principle
Was this helpful?


Hardy-Weinberg Equilibrium Calculator

The Hardy-Weinberg equilibrium calculator computes the relationship between allele frequencies and genotype frequencies in a population, based on the Hardy-Weinberg principle. It solves for any of the five variables (p, q, p², 2pq, q²) given the others, and is used by population geneticists, by medical researchers estimating carrier frequencies for genetic diseases, by conservation biologists assessing genetic diversity in endangered populations, by forensic scientists calculating match probabilities, by students learning Mendelian genetics at the population level, and by genetic counsellors explaining inheritance risks. The principle states that, in the absence of evolutionary forces, allele and genotype frequencies remain constant from generation to generation.

How to Use the Hardy-Weinberg Calculator

  1. Choose which variable to solve for: p (dominant allele frequency), q (recessive allele frequency), p² (homozygous dominant), 2pq (heterozygous), or q² (homozygous recessive).
  2. Enter the known values. Because p + q = 1, you typically only need one allele frequency; the other is computed automatically.
  3. Click Calculate to see the result.
  4. The result panel shows the solved value plus the implied frequencies for all genotypes.

The Formula

The Hardy-Weinberg principle has two fundamental equations:

p + q = 1 (allele frequencies sum to 1)

p² + 2pq + q² = 1 (genotype frequencies sum to 1)

Where:

  • p = frequency of the dominant allele
  • q = frequency of the recessive allele
  • = frequency of homozygous dominant individuals
  • 2pq = frequency of heterozygous individuals (carriers)
  • = frequency of homozygous recessive individuals

Once p (or q) is known, all other values are determined:

  • q = 1 − p
  • p² = p × p
  • q² = q × q
  • 2pq = 2 × p × q

For loci with more than two alleles (e.g., ABO blood groups), the principle extends to:

(p + q + r)² = p² + q² + r² + 2pq + 2pr + 2qr = 1

Worked Examples

Example 1, Cystic fibrosis carrier frequency

Cystic fibrosis is an autosomal recessive disease. In a European population, the disease frequency (q²) is about 1 in 2,500 = 0.0004. What is the carrier frequency?

q = √0.0004 = 0.02 (2%) p = 1 − q = 0.98 2pq = 2 × 0.98 × 0.02 = 0.0392 = 3.92%

So about 1 in 25 Europeans is a carrier, even though only 1 in 2,500 has the disease. This is why recessive diseases can be surprisingly common.

Example 2, Sickle cell and malaria

In some African populations, the sickle cell allele (HbS) reaches high frequency because heterozygotes are protected against malaria. If the disease frequency (HbS/HbS) is 4%, what is the allele frequency?

q² = 0.04 q = 0.20 (20%) p = 0.80 2pq = 2 × 0.80 × 0.20 = 0.32 = 32%

So 32% of the population are heterozygotes (mostly protected against malaria), 64% are homozygous normal (HbA/HbA), and 4% are homozygous sickle cell (mostly symptomatic).

Example 3, White fur in a deer population

A wildlife biologist counts 100 deer and observes 9 white (recessive) and 91 brown. What are the allele frequencies?

q² = 9/100 = 0.09 q = 0.30 (30%) p = 0.70 (70%) p² = 0.49 → 49 homozygous dominant (brown) 2pq = 0.42 → 42 heterozygous (brown carriers) q² = 0.09 → 9 homozygous recessive (white)

The 91 brown deer include 49 homozygous + 42 heterozygous carriers. So 42 of the 91 brown deer actually carry the white allele.

When the Principle Holds

Hardy-Weinberg equilibrium holds only when:

  1. No mutation at the locus
  2. No selection (no fitness differences between genotypes)
  3. No migration (no gene flow in or out)
  4. No genetic drift (infinitely large population)
  5. Random mating (no assortative mating)

Real populations violate one or more of these assumptions, but Hardy-Weinberg is the null model against which real populations are compared. Significant deviations from expected genotype frequencies signal that some evolutionary force is at work.

Common Calculations Using Hardy-Weinberg

Carrier risk for an affected child. If both parents are carriers (2pq each), the chance of an affected child is q² = (1/4) × (1/4) = 1/16? No, simpler: each parent produces gametes with q = 1/2 × 0.02 = 0.01 frequency of the recessive allele (assuming they're heterozygous carriers), so the probability of an affected child is q² = 0.01² = 1/10,000 per child.

Actually simpler: if both parents are known carriers (Aa × Aa), each child has 25% chance of being affected (aa), 50% chance of being a carrier (Aa), and 25% chance of being homozygous dominant (AA). This is standard Mendelian inheritance.

Forensic DNA match probability. The probability that a randomly chosen person matches a DNA profile at multiple loci is the product of individual allele frequencies (assuming independence, the product rule). With 13 standard CODIS loci, match probabilities can be 1 in a quadrillion or smaller.

Conservation genetics. Small populations lose heterozygosity over time due to drift. The Hardy-Weinberg expected heterozygosity (2pq) is compared to observed heterozygosity to detect inbreeding.

Common Mistakes

Confusing allele and genotype frequencies. Allele frequencies are p and q (sum to 1). Genotype frequencies are p², 2pq, q² (also sum to 1). They are different scales.

Using disease frequency as q. The disease (homozygous recessive) frequency is q². To get q, take the square root. This is a common error, especially for rare diseases.

Assuming random mating. Hardy-Weinberg assumes random mating. In populations with assortative mating (e.g., people tend to marry within ethnic groups), allele frequencies at some loci deviate from expectations.

Forgetting that Hardy-Weinberg is a model. It is a description of what would happen in the absence of evolutionary forces. Real populations are rarely in perfect equilibrium, but the principle gives a useful baseline.

Frequently Asked Questions

What is Hardy-Weinberg equilibrium? Hardy-Weinberg equilibrium is the principle that, in the absence of evolutionary forces (mutation, selection, migration, drift, non-random mating), allele and genotype frequencies in a population remain constant from generation to generation. It was formulated independently by G. H. Hardy and Wilhelm Weinberg in 1908.

Why does the formula use 2pq for heterozygotes? A heterozygote can arise from two different gamete combinations: a p-gamete from one parent + a q-gamete from the other, OR a q-gamete from one + a p-gamete from the other. These are equally likely, giving 2 × p × q.

How are allele frequencies estimated? By counting alleles in a sample of the population. For diploid organisms, each individual carries two alleles per autosomal locus. Total alleles = 2 × sample size. Allele frequency = (count of that allele) / (total alleles).

What does it mean if observed frequencies don't match Hardy-Weinberg? Deviations from expected Hardy-Weinberg proportions suggest that one or more evolutionary forces are operating. Common causes: selection, inbreeding, population substructure (Wahlund effect), genotyping errors, or null alleles.

Is the ABO blood group system in Hardy-Weinberg? Approximately, yes, at least within large, randomly mating populations. The ABO system has three alleles (I^A, I^B, i) with six possible genotypes. The principle extends naturally to multi-allele systems.

What is the heterozygote advantage? When heterozygotes (2pq) have higher fitness than either homozygote, selection actively maintains both alleles. Classic examples: sickle cell trait and malaria resistance, HLA diversity and immune function.

How is Hardy-Weinberg used in genetic counselling? For autosomal recessive diseases, knowing the population carrier frequency (2pq) allows estimation of the chance that a randomly chosen partner is also a carrier. The probability of an affected child is then q² (the risk per pregnancy, if both parents are carriers).

What about X-linked genes? Hardy-Weinberg for X-linked genes is more complex because males are hemizygous (only one X). Allele frequencies are computed differently for the two sexes, and equilibrium is approached more slowly than for autosomal loci.


**Q:**Can the Hardy-Weinberg Equilibrium Calculator be used for professional or commercial purposes?A: Yes, the Hardy-Weinberg Equilibrium Calculator The Hardy-Weinberg Equilibrium Calculator provides mathematically correct results that are suitable for professional, commercial, and educational use. the Hardy-Weinberg Equilibrium Calculator formulas used are well-established and validated against reference standards.

**Q:**How often are the formulas behind the Hardy-Weinberg Equilibrium Calculator updated? When standards change (e.g., new physical constants, revised tax brackets, updated standards), the Hardy-Weinberg Equilibrium Calculator is updated to reflect the current authoritative source. Each calculator's references section, including the Hardy-Weinberg Equilibrium Calculator, lists the specific sources used.

References

  • Hardy, G. H. "Mendelian Proportions in a Mixed Population" (1908), Science 28: 49-50.
  • Weinberg, W. "Über den Nachweis der Vererbung beim Menschen" (1908), Jahreshefte des Vereins für vaterländische Naturkunde in Württemberg 64: 368-382.
  • Hartl, D. L. & Clark, A. G. Principles of Population Genetics, Sinauer Associates.
  • Hedrick, P. W. Genetics of Populations, Jones & Bartlett.
  • Real, L. A. Ecological Genetics, Princeton University Press.