Home / Biology / Genetics / Hardy-Weinberg Equilibrium

Formula & Calculator

Hardy-Weinberg Equilibrium

This principle describes the expected frequencies of different genotypes in a population that is not evolving. It says that if certain conditions are met (no mutation, no selection, no migration, large population, random mating), the proportions of genotypes stay constant from generation to generation. The equation uses p and q for the frequencies of two alleles. For example, if p = 0.6 and q = 0.4, then p² = 0.36, 2pq = 0.48, q² = 0.16, which sum to 1. It is a fundamental concept in population genetics.

Biology Genetics Population Genetics
VORZEP · POPULATION GENETICS TOOLS

Hardy–Weinberg Equilibrium Calculator

Solve the Hardy–Weinberg relation p² + 2pq + q² = 1 for any of its three unknowns — the frequency of allele A, the frequency of allele a, or the heterozygote frequency 2pq — with step-by-step algebra, a live gamete-pool and Punnett-square schematic, and companion population-genetics metrics.

p² + 2pq + q² = 1 · p + q = 1
Solve for
Allele Frequency p (A) The frequency of the A (often the dominant or wild-type) allele in the gene pool, on a 0–1 scale. It equals the proportion of all gene copies at this locus that are A: p = (2·nAA + nAa) / (2N). p + q = 1 always holds for a two-allele locus.
p
p must lie between 0 and 1.
= 60.0% of all gene copies · p : q = 1.500 : 1
Allele Frequency q (a) The frequency of the a (often the recessive or variant) allele, on a 0–1 scale. It equals q = (2·naa + nAa) / (2N) and always satisfies q = 1 − p for a biallelic locus. Rare recessive disease alleles typically sit between q = 0.001 and q = 0.05.
q
q must lie between 0 and 1.
= 40.0% of all gene copies · q : p = 0.667 : 1
Heterozygote Frequency (2pq) The expected frequency of Aa heterozygotes under Hardy–Weinberg equilibrium. It is the product 2pq and peaks at 2pq = 0.5 when p = q = 0.5. For rare recessive alleles 2pq ≈ 2q, which is why carriers vastly outnumber affected homozygotes.
2pq
2pq must lie between 0 and 0.5.
= 48.0% of the population · 1 in 2.08 individuals
HETEROZYGOTE FREQUENCY (2pq)
0.4800 (0–1)
48.0% of population · 1 in 2.08 · AA 36.0% / Aa 48.0% / aa 16.0%
HIGH HETEROZYGOSITY
2pq = 2 · p · q
Step-by-step solution
Genotype frequencies vs. allele frequency p
AA = p² Aa = 2pq aa = q²
Genotype composition at five allele frequencies
AA = p² Aa = 2pq aa = q²
Sensitivity
Companion population-genetics metrics
Gamete pool → Punnett square → offspring genotypes — live schematic
HARDY–WEINBERG EQUILIBRIUM · p² + 2pq + q² = 1 GAMETE POOL A a p = 0.600 q = 0.400 PUNNETT SQUARE A (p) a (q) A (p) a (q) AA p² = 0.360 Aa pq = 0.240 aA pq = 0.240 aa q² = 0.160 OFFSPRING GENOTYPES AA = 0.360 Aa = 0.480 aa = 0.160 p² + 2pq + q² = 0.360 + 0.480 + 0.160 = 1.000 p + q = 0.600 + 0.400 = 1.000 · back-check p = AA + ½·Aa = 0.600
Allele A gametes and AA homozygotes Aa heterozygotes from either cross order Allele a gametes and aa homozygotes
What the Hardy–Weinberg relation really measures
p²AA homozygotes
+
2pqAa heterozygotes
+
q²aa homozygotes
=
1whole population

It is just a binomial expansion

Hardy–Weinberg equilibrium is the statement that (p + q)² = 1 expands to p² + 2pq + q² = 1. If gametes pair at random and the two alleles behave identically in transmission, the offspring genotype frequencies are the squared terms of the allele-frequency sum. Nothing more is required — no selection, no drift, no migration, no mutation, no non-random mating. Any departure from those frequencies signals that one of those assumptions is being violated.

It is a null model, not a law of nature

Real populations rarely sit exactly at Hardy–Weinberg equilibrium, and that is precisely the point. The equilibrium is the baseline against which observed genotype counts are compared. A χ² goodness-of-fit test against HWE answers a sharp question: given the allele frequencies actually present, are the genotype counts what random mating would produce? A significant deviation is evidence of inbreeding, population structure, selection, genotyping error, or assortative mating.

Heterozygosity peaks when alleles are equal

The function 2pq = 2p(1 − p) is a downward parabola with a maximum of 0.5 at p = q = 0.5. No biallelic locus can ever have more than 50% heterozygotes under Hardy–Weinberg equilibrium, no matter how the alleles are distributed. This gives a useful sanity check: a reported heterozygote frequency above 0.5 for a two-allele locus is impossible under HWE and points to a data or coding problem.

Rare recessive alleles hide in carriers

For a rare recessive allele with frequency q, the ratio of carriers to affected individuals is 2pq / q² ≈ 2/q. If q = 0.01, carriers outnumber affected homozygotes by roughly 200 to 1. This is why recessive disorders persist for many generations even under strong selection against homozygotes, and why carrier screening programmes target the heterozygous majority rather than the visibly affected minority.

How to Use This Calculator

The Hardy–Weinberg relation links three quantities: p, q and the heterozygote frequency 2pq. Pick which one the tool should solve, then supply the driver value.

1. Choose what to solve for

Select p, q or 2pq from the toggle. The calculator rearranges p² + 2pq + q² = 1 and p + q = 1 automatically for whichever quantity you pick.

2. Use realistic presets

Presets span the practical range: allele frequencies from 0.01 to 0.90, and heterozygote frequencies from 0.02 up to the theoretical maximum of 0.50 at p = q = 0.5.

3. Enter frequencies, not counts

All three fields are on a 0–1 scale. If you have raw genotype counts instead, scroll down to the genotype-count converter — it turns observed AA, Aa and aa counts into p, q, expected counts and a χ² test in one step.

4. Read the result and verdict

The result card shows the solved value together with its percentage form and the full genotype breakdown. A colour-coded verdict classifies the heterozygosity from near-monomorphic through to the theoretical maximum.

5. Check the schematic and charts

The schematic splits the gamete pool, shows the Punnett square, and draws the resulting offspring genotype bars. The chart plots p², 2pq and q² across the whole range of p, with your operating point marked.

6. Switch to Advanced for depth

Advanced mode adds a stacked genotype-composition chart, a sensitivity check on how heterozygosity responds to a change in p, and companion metrics including homozygosity, carrier-to-affected ratio and the p² : 2pq : q² ratio.

What This Tool Offers

Built around the Hardy–Weinberg relation p² + 2pq + q² = 1, the fundamental null model of population genetics.

Three-way solving

Solve for the A allele frequency p, the a allele frequency q, or the heterozygote frequency 2pq. The calculator rearranges the relation for whichever you choose.

Live Punnett schematic

A gamete pool split into p and q, a fully labelled Punnett square, and offspring genotype bars that resize as you drag the slider.

Heterozygosity verdict

Every result is classified from near-monomorphic through low, moderate and high heterozygosity up to the theoretical maximum of 2pq = 0.5 at p = q = 0.5.

Genotype-count converter

Paste observed AA, Aa and aa counts and get allele frequencies, expected genotype counts, a χ² statistic, a P-value and an automatic HWE verdict.

Dual visualisations

A curve chart of p², 2pq and q² across the full range of p, plus an advanced stacked-bar chart of genotype composition at five allele frequencies.

Reference tables

A full genotype-frequency lookup grid, real-world allele frequency examples from clinical genetics, and a complete variable reference table.

Reference Tables & Conversions

A genotype-count converter with an automatic Hardy–Weinberg test, a full genotype-frequency lookup grid, and representative allele frequencies from clinical genetics.

Genotype counts → allele frequencies & Hardy–Weinberg test

n
n
n
= 1,000 individuals · p = 0.6000 · q = 0.4000 · expected AA/Aa/aa = 360.0 / 480.0 / 160.0 · χ² = 0.000 (df = 1) · P = 1.000 → consistent with HWE

Genotype Frequency Lookup

Exact Hardy–Weinberg genotype frequencies across the full range of p. Carriers per affected is the ratio 2pq / q².

pqAA = p²Aa = 2pqaa = q²Carriers per affected

Representative Allele Frequencies in Human Populations

Approximate allele frequencies for well-known variants, with the Hardy–Weinberg genotype frequencies they imply. Values are indicative and vary strongly between populations.

Variant / traitq (variant)pAffected q²Carriers 2pq1 carrier inNotes

Variable Reference

SymbolMeaningTypical rangeUnits
pFrequency of allele A0 – 1dimensionless
qFrequency of allele a0 – 1dimensionless
p²Expected AA homozygote frequency0 – 1dimensionless
2pqExpected Aa heterozygote frequency0 – 0.5dimensionless
q²Expected aa homozygote frequency0 – 1dimensionless
NNumber of individuals sampled1 – 10⁶count
χ²Goodness-of-fit statistic vs. HWE0 – ∞dimensionless
FISInbreeding coefficient within populations−1 – 1dimensionless

What Does p² + 2pq + q² = 1 Measure?

The Hardy–Weinberg relation describes the genotype frequencies expected at a single biallelic locus when a population is large, mates at random, and is not subject to selection, mutation, migration or drift. Under those conditions the allele frequencies do not change from one generation to the next, and the genotype frequencies settle into the fixed proportions p², 2pq and q². It is the simplest and most widely used null model in population genetics, and it underpins everything from clinical carrier screening to forensic DNA statistics.

Hardy–Weinberg Formula

The defining relationship is the expansion of the squared allele-frequency sum:

(p + q)² = p² + 2pq + q² = 1

with the allele-frequency constraint:

p + q = 1   ⟹   q = 1 − p

Allele frequencies are recovered from genotype counts by counting gene copies:

p = (2·nAA + nAa) / (2N)
q = (2·naa + nAa) / (2N)

And the deviation from equilibrium is tested with a χ² goodness-of-fit statistic on one degree of freedom:

χ² = Σ (O − E)² / E   with   EAA = N·p²,   EAa = N·2pq,   Eaa = N·q²

Hardy–Weinberg Variables

SymbolMeaningNotes
pFrequency of allele AProportion of all gene copies at the locus that are A
qFrequency of allele aEquals 1 − p for a biallelic locus
p²AA homozygote frequencyProbability that two randomly drawn gametes are both A
2pqAa heterozygote frequencyTwo equally likely orders: A then a, or a then A
q²aa homozygote frequencyProbability that two randomly drawn gametes are both a
NSample sizeNumber of individuals genotyped
FISInbreeding coefficientDeficit of heterozygotes relative to HWE; FIS = 1 − Hobs/2pq

How Each Variable Affects the Genotype Frequencies

Only one quantity actually varies at a biallelic locus: the allele frequency p. Everything else follows deterministically. As p moves from 0 to 1, the AA frequency p² rises monotonically from 0 to 1, the aa frequency q² falls monotonically from 1 to 0, and the heterozygote frequency 2pq traces a symmetric parabola that starts at 0, peaks at 0.5 when p = q = 0.5, and returns to 0. That single curve is the reason no biallelic locus under HWE can ever exceed 50% heterozygotes.

The practical consequence is that rare alleles are almost entirely hidden in heterozygotes. When q is small, q² becomes negligible while 2pq stays close to 2q, so the ratio of carriers to affected individuals is approximately 2/q. For a recessive disease allele at q = 0.02 — roughly the frequency of the common cystic fibrosis allele in northern Europe — the affected frequency is only 1 in 2,500, but about 1 in 25 people are carriers. The allele is essentially invisible in the phenotype and survives almost entirely in the heterozygous state.

Hardy–Weinberg Calculation Examples

Given: p = 0.60 — solve for the full genotype distribution
q = 1 − 0.60 = 0.40
AA = p² = 0.60² = 0.360
Aa = 2pq = 2 × 0.60 × 0.40 = 0.480
aa = q² = 0.40² = 0.160
Check: 0.360 + 0.480 + 0.160 = 1.000
Given: heterozygote frequency 2pq = 0.42 — solve for p and q
2p(1 − p) = 0.42 ⟹ p² − p + 0.21 = 0
p = [1 ± √(1 − 0.84)] / 2 = [1 ± 0.40] / 2
p = 0.70, q = 0.30   (or p = 0.30, q = 0.70 — the mirror solution)
Given: observed counts AA = 360, Aa = 480, aa = 160 (N = 1,000)
p = (2×360 + 480) / 2,000 = 1,200 / 2,000 = 0.600
q = (2×160 + 480) / 2,000 = 800 / 2,000 = 0.400
Expected AA = 1,000 × 0.36 = 360.0, Aa = 1,000 × 0.48 = 480.0, aa = 1,000 × 0.16 = 160.0
χ² = 0.000 (df = 1), P = 1.000 ⟹ consistent with Hardy–Weinberg equilibrium
Given: a recessive disease with affected frequency q² = 1 in 2,500
q = √(1/2,500) = 0.020, p = 0.980
Carrier frequency 2pq = 2 × 0.980 × 0.020 = 0.0392 ≈ 1 in 26
Carriers outnumber affected by 2pq / q² = 0.0392 / 0.0004 = 98 to 1

Frequently Asked Questions

Five conditions: the population is effectively infinite (so genetic drift is negligible), mating is random with respect to the locus, there is no selection acting on the alleles, there is no mutation, and there is no migration into or out of the population. When all five hold, allele frequencies stay constant across generations and genotype frequencies settle immediately into the p², 2pq, q² proportions — in fact a single generation of random mating is enough to reach them from any starting genotype distribution. The equilibrium is a null model: its value is that departures from it are informative, not that real populations satisfy it.

The function 2pq = 2p(1 − p) is a downward-opening parabola in p. Its derivative is 2 − 4p, which is zero at p = 0.5, and the second derivative is negative, so p = 0.5 is the global maximum. Substituting gives 2 × 0.5 × 0.5 = 0.5. Because p and q must sum to 1, the most balanced the allele frequencies can be is 50/50, and that is exactly when heterozygotes are most numerous. Any reported heterozygosity above 0.5 at a biallelic locus is mathematically impossible under HWE and usually indicates a data-entry error, a mis-specified locus, or a third allele being collapsed into one of the two.

Count gene copies rather than individuals. Every AA homozygote contributes two A alleles, every Aa heterozygote contributes one, and every aa homozygote contributes none, so p = (2·nAA + nAa) / (2N) where N is the total number of individuals. Similarly q = (2·naa + nAa) / (2N). The two must sum to 1, which is a useful arithmetic check. Once you have p, the expected Hardy–Weinberg genotype counts are simply N·p², N·2pq and N·q², and comparing them with the observed counts gives the χ² statistic. The converter card above performs the whole calculation for you.

A significant result (conventionally P < 0.05) means the observed genotype counts deviate from what random mating at the observed allele frequencies would produce. It does not tell you which assumption is violated. In practice the usual culprits are population structure (the sample mixes subpopulations with different allele frequencies, which produces a heterozygote deficit — the Wahlund effect), inbreeding or assortative mating (also a heterozygote deficit), genotyping error or null alleles (typically a heterozygote deficit), or heterozygote advantage and negative assortative mating (a heterozygote excess). Selection is often invoked but is rarely the simplest explanation; technical and demographic causes should be excluded first.

Because selection acts on phenotypes, not on alleles. A recessive allele in a heterozygote produces no disease phenotype, so it is invisible to selection and is passed on at the full Mendelian rate. Under Hardy–Weinberg, the ratio of carriers to affected individuals is 2pq / q² ≈ 2/q, so the rarer the allele, the more of it hides in heterozygotes. For a fully recessive lethal allele the equilibrium frequency under mutation–selection balance is q = √(μ/s), where μ is the mutation rate and s the selection coefficient against homozygotes. That square root is why even strongly deleterious recessive alleles settle at appreciable frequencies rather than being eliminated.

Yes. For k alleles with frequencies p₁, p₂, …, pk summing to 1, the genotype frequencies are the terms of the multinomial expansion of (p₁ + p₂ + … + pk)². A homozygote for allele i has frequency pi², and a heterozygote carrying alleles i and j has frequency 2pipj. The overall heterozygosity is 1 − Σpi², which for k equally frequent alleles equals (k − 1)/k. This calculator handles the biallelic case, which is by far the most common in clinical and teaching settings, but the same logic extends directly.

Inbreeding does not change allele frequencies, but it redistributes genotype frequencies away from heterozygotes and towards homozygotes. If F is the inbreeding coefficient, the genotype frequencies become AA = p² + F·pq, Aa = 2pq(1 − F) and aa = q² + F·pq. Setting F = 0 recovers Hardy–Weinberg exactly. The deficit of heterozygotes is directly measurable as FIS = 1 − Hobserved/2pq, which is why observed and expected heterozygosities are routinely compared in population-genetic studies. A positive FIS indicates a heterozygote deficit; a negative value indicates an excess.

Calculating...

Variables

Symbol Quantity Unit
p Dominant allele frequency
q Recessive allele frequency

What it means

The Hardy‑Weinberg equilibrium principle states that allele and genotype frequencies in a population remain constant from generation to generation in the absence of evolutionary influences. For a gene with two alleles (A and a) with frequencies p and q (p + q = 1), the genotype frequencies are AA = p², Aa = 2pq, and aa = q². This provides a null model for detecting evolution; significant deviations indicate factors like selection, mutation, or genetic drift. It is widely used in population genetics to estimate allele frequencies, to study genetic disorders, and to assess the impact of non‑random mating. In conservation biology, it helps monitor genetic diversity. Understanding this law is essential for evolutionary biology, medicine (carrier frequencies), and forensic science.

Worked example

Hardy‑Weinberg Equilibrium – Two Detailed Examples

Real‑World
Scenario: A population of wild rabbits has a gene for fur colour where the dominant allele (A) codes for brown fur and the recessive allele (a) codes for white fur. A biologist samples the population and finds that the frequency of the recessive allele (q) is 0.3. Using the Hardy‑Weinberg principle, she calculates the expected genotype frequencies to see if the population is in equilibrium. This helps her determine whether evolutionary forces like natural selection or genetic drift are acting on the population.
ParameterValue
q (frequency of recessive allele)0.3
1p = 1 − q = 0.7
2p² = (0.7)² = 0.49 (homozygous dominant)
32pq = 2 × 0.7 × 0.3 = 0.42 (heterozygous)
4q² = (0.3)² = 0.09 (homozygous recessive)
Result AA: 0.49, Aa: 0.42, aa: 0.09 ✓ Expected genotype frequencies
Scenario: In a human population, the frequency of the recessive allele for a rare genetic disorder (cystic fibrosis) is known to be 0.02. A genetic counsellor uses the Hardy‑Weinberg equation to estimate the proportion of carriers (heterozygotes) in the population. This information is crucial for assessing the risk of passing the disorder to offspring and for making informed reproductive decisions.
ParameterValue
q0.02
1p = 1 − 0.02 = 0.98
22pq = 2 × 0.98 × 0.02 = 0.0392 ≈ 3.9%
Result ~3.9% carriers ✓ Carrier frequency
Insight: The Hardy‑Weinberg principle predicts that allele frequencies remain constant in a large, random‑mating population with no evolutionary forces. It provides a null model for detecting evolutionary change.

Common mistakes

  • Allele frequencies: p and q represent the frequencies of the two alleles (p + q = 1). Ensure they sum to 1 before using.
  • Genotype frequencies: p² (AA), 2pq (Aa), q² (aa) – they must sum to 1.
  • Assumptions: Random mating, no mutation, no migration, no selection, large population – deviations affect equilibrium.
  • Chi‑square test: Use to test if observed genotype frequencies differ significantly from expected.
  • Multiple alleles: The formula extends to multiple alleles (p+q+r+...=1) – not just two.

Applications

The Hardy‑Weinberg equilibrium principle describes how allele and genotype frequencies remain constant in a population from generation to generation in the absence of evolutionary forces. The equation p² + 2pq + q² = 1 relates allele frequencies (p and q) to genotype frequencies for a single gene with two alleles. This is a foundational concept in population genetics, used to estimate carrier frequencies for recessive diseases, to test whether a population is evolving, and to study genetic diversity. Public health researchers use it to predict the prevalence of genetic disorders in populations. Conservation biologists apply it to monitor genetic health in endangered species. By understanding Hardy‑Weinberg equilibrium, professionals can assess the impact of migration, mutation, selection, and genetic drift on populations. It is a key tool in genetic counseling, epidemiology, and evolutionary biology.

  • Estimation of carrier frequencies for recessive genetic diseases (e.g., cystic fibrosis)
  • Testing for evolutionary forces (selection, drift, migration) in populations
  • Genetic counseling and risk assessment for hereditary conditions
  • Conservation genetics – monitoring genetic diversity in endangered species
  • Population genetics research and education

Suggest an improvement

Found a mistake? Have a better example? Let us know.
You may send up to 3 suggestions per 24 hours.

Page details

1,523

Views
  • Published July 8, 2026
  • Last updated October 22, 2026