/

Hardy-Weinberg Calculator — Allele & Genotype Frequency Solver with Steps

Hardy-Weinberg Calculator — Allele & Genotype Frequency Solver with Steps
Population Genetics Tool

Hardy-Weinberg Calculator

Solve all Hardy-Weinberg equations — p, q, p², 2pq, and q² — from any single known value or observed counts, with complete step-by-step working. The fastest Hardy-Weinberg equilibrium calculator online.

p + q = 1
p² + 2pq + q² = 1
Hardy-Weinberg Calculator — All Modes
q² =
q²=0.09 (cystic fibrosis–style)
q²=0.04 → q=0.2, p=0.8
q²=0.25 → q=0.5, p=0.5
q²=0.01 → q=0.1, p=0.9
q²=0.16 → q=0.4, p=0.6
p =
p=0.6 → q=0.4, p²=0.36
p=0.7 → q=0.3, 2pq=0.42
p=0.8 → q=0.2, q²=0.04
p=0.5 → balanced
p=0.9 → q=0.1, q²=0.01
q =
q=0.3 → p=0.7, p²=0.49
q=0.4 → p=0.6, 2pq=0.48
q=0.2 → p=0.8, q²=0.04
q=0.1 → p=0.9, rare recessive
q=0.5 → p=q balanced
AA (Hom. Dominant)
Aa (Heterozygous)
aa (Hom. Recessive)
640 AA, 320 Aa, 40 aa (N=1000)
810 AA, 180 Aa, 10 aa (N=1000)
36 AA, 48 Aa, 16 aa (N=100)
490 AA, 420 Aa, 90 aa (N=1000)
Population size N = (for expected counts)
Error
p Dominant allele freq.
q Recessive allele freq.
p² (AA) Hom. dominant freq.
2pq (Aa) Heterozygous freq.
q² (aa) Hom. recessive freq.
p²+2pq+q² Verification (= 1)
p² + 2pq + q² = 1 ✓
Step-by-Step Working
Population Projector — Expected counts in N = 10,000 individuals
AA (p²×N)
Aa (2pq×N)
aa (q²×N)
Observed vs Hardy-Weinberg Expected Frequencies
Genotype Observed Count Observed Freq. HW Expected Freq. Difference

Allele frequencies derived from observed counts: p = (2×AA + Aa)/(2N), q = (2×aa + Aa)/(2N). HW expected frequencies use these observed p and q values.

Genotype Frequency Distribution
AA (p²) — Hom. Dominant
Aa (2pq) — Heterozygous
aa (q²) — Hom. Recessive
Genotype Frequency Calculator

Enter either p or q to instantly calculate all three genotype frequencies (p², 2pq, q²) and see a visual stacked bar.

p² — AA
2pq — Aa
q² — aa

Stacked Genotype Bar

AA
Aa
aa
p² + 2pq + q² = 1 ✓
Allele / Gene Frequency Calculator

Enter observed allele counts to calculate p and q. Example: out of 200 total alleles, 140 are A → p = 0.70, q = 0.30.

p — Dominant Allele Frequency p = A / (A+a)
q — Recessive Allele Frequency q = a / (A+a)
p + q = 1 ✓
Phenotype Frequency Calculator

Enter p or q to find the expected phenotype frequencies. Recessive phenotype = q². Dominant phenotype = p² + 2pq.

Dominant Phenotype = p² + 2pq
Recessive Phenotype = q²
Dominant + Recessive phenotype freq. = 1 ✓

The Hardy-Weinberg Equations Explained

This Hardy-Weinberg calculator solves both fundamental Hardy-Weinberg equations simultaneously from any single known value — giving you p, q, p², 2pq, and q² in one click. Named after G.H. Hardy and Wilhelm Weinberg (1908), the Hardy-Weinberg principle describes the allele and genotype frequency distribution in a non-evolving population.

The Hardy-Weinberg principle rests on two equations that must both hold true simultaneously:

p + q = 1 Allele frequency equation — the frequencies of all alleles must sum to 1
p² + 2pq + q² = 1 Genotype frequency equation — the frequencies of all genotypes must sum to 1

What Each Variable Means

SymbolMeaningGenotype / PhenotypeRange
pFrequency of the dominant allele (A)Allele frequency0 to 1
qFrequency of the recessive allele (a)Allele frequency0 to 1
Frequency of homozygous dominant genotypeAA individuals0 to 1
2pqFrequency of heterozygous genotypeAa individuals (carriers)0 to 0.5
Frequency of homozygous recessive genotypeaa individuals (show recessive trait)0 to 1

What Is Hardy-Weinberg Equilibrium in Plain Language?

A population is in Hardy-Weinberg equilibrium when its allele frequencies stay exactly the same from generation to generation — it is not evolving. Think of it as a genetic "null hypothesis": if the Hardy-Weinberg equation holds, nothing is driving evolution in that population.

The Five Hardy-Weinberg Conditions

No Mutations
No Migration (Gene Flow)
Random Mating
Infinite Population
No Natural Selection

If any of the five Hardy-Weinberg conditions is violated, allele frequencies will change and the population is evolving. Real populations rarely satisfy all five conditions perfectly — but the Hardy-Weinberg equation provides an essential baseline for detecting evolutionary forces.

How to Use the Hardy-Weinberg Equation — Step-by-Step

The method you use depends on what information is given. Here is the complete four-mode approach used in this Hardy-Weinberg equilibrium calculator:

Mode A — Starting From q² (Most Common Exam Problem)

  1. Identify q² from the problem: "X% of the population shows the recessive phenotype" → q² = X/100
  2. Calculate q = √(q²) using a square root
  3. Calculate p = 1 − q (from p + q = 1)
  4. Calculate p² = p × p (homozygous dominant frequency)
  5. Calculate 2pq = 2 × p × q (heterozygous/carrier frequency)
  6. Verify: p² + 2pq + q² = 1 ✓

Mode B — Starting From p (Dominant Allele Frequency Known)

  1. Use p + q = 1 → q = 1 − p
  2. Calculate p² = p × p
  3. Calculate 2pq = 2 × p × q
  4. Calculate q² = q × q

Mode C — Starting From q (Recessive Allele Frequency Known)

  1. Use p + q = 1 → p = 1 − q
  2. Continue as Mode B

Mode D — Starting From Observed Counts (AA, Aa, aa)

  1. Total N = AA + Aa + aa
  2. Total alleles = 2N (each individual carries 2 alleles)
  3. p = (2×AA + Aa) / (2N) — count all A alleles, divide by total alleles
  4. q = (2×aa + Aa) / (2N) — count all a alleles, divide by total alleles
  5. Expected: p², 2pq, q² — compare to observed q²=aa/N, 2pq=Aa/N, p²=AA/N
  6. Note: observed q² = aa/N (divided by total individuals, not total alleles)

Worked Example 1 — Classic q² Problem (Mode A)

Problem: 9% of a population shows the recessive phenotype. Find all allele and genotype frequencies.

  1. q² = 0.09 (9% = 0.09)
  2. q = √0.09 = 0.30
  3. p = 1 − 0.30 = 0.70
  4. p² = 0.70 × 0.70 = 0.49 (49% AA)
  5. 2pq = 2 × 0.70 × 0.30 = 0.42 (42% Aa carriers)
  6. Verify: 0.49 + 0.42 + 0.09 = 1.00 ✓

Worked Example 2 — Given p (Mode B)

Problem: The dominant allele frequency is p = 0.6. Find all frequencies.

  1. p = 0.6 (given)
  2. q = 1 − 0.6 = 0.4
  3. p² = 0.6² = 0.36 (36% AA)
  4. 2pq = 2 × 0.6 × 0.4 = 0.48 (48% Aa)
  5. q² = 0.4² = 0.16 (16% aa)
  6. Verify: 0.36 + 0.48 + 0.16 = 1.00 ✓

Worked Example 3 — Observed Counts (Mode D)

Problem: In a sample of 1000 individuals: 640 AA, 320 Aa, 40 aa. Are they in Hardy-Weinberg equilibrium?

  1. N = 640 + 320 + 40 = 1000
  2. Total alleles = 2 × 1000 = 2000
  3. p = (2×640 + 320) / 2000 = 1600/2000 = 0.80
  4. q = (2×40 + 320) / 2000 = 400/2000 = 0.20
  5. HW Expected: p²=0.64, 2pq=0.32, q²=0.04
  6. Observed: AA/N=0.64, Aa/N=0.32, aa/N=0.04
  7. Difference: 0% — population IS in Hardy-Weinberg equilibrium ✓

What Does p Represent in the Hardy-Weinberg Principle?

In the Hardy-Weinberg equation, p represents the frequency of the dominant allele in the gene pool of a population. It is a proportion between 0 and 1, where p = 1 means every allele in the population is dominant (A), and p = 0 means no dominant alleles exist.

For a gene with two alleles (A dominant, a recessive), p counts the fraction of all alleles in the population that are the A version:

  • p = (number of A alleles) / (total number of alleles) = (2×AA + Aa) / (2N)
  • Each AA individual contributes 2 A alleles; each Aa individual contributes 1 A allele
  • p is related to q by the Hardy-Weinberg allele equation: p + q = 1

p is an allele frequency, not a genotype frequency. The genotype frequency of AA individuals is p² (not p). This distinction is one of the most common sources of confusion in Hardy-Weinberg problems.

What Does q Represent in Hardy-Weinberg?

In the Hardy-Weinberg equation, q represents the frequency of the recessive allele in the population. Like p, it is a proportion between 0 and 1. When you know q, you can find p instantly using p = 1 − q, because p + q = 1.

  • q = (number of a alleles) / (total number of alleles) = (2×aa + Aa) / (2N)
  • The most common Hardy-Weinberg starting point: q² is observable (recessive phenotype), q = √(q²)
  • q² is the genotype frequency of homozygous recessive (aa) individuals — the ones who show the recessive trait

Worked Examples — Six Full Solutions

Example 1 — Cystic Fibrosis Style: q² = 0.09

  1. q² = 0.09 → q = √0.09 = 0.30
  2. p = 1 − 0.30 = 0.70
  3. p² = 0.49 | 2pq = 0.42 | q² = 0.09
  4. In 10,000 individuals: 4,900 AA, 4,200 Aa, 900 aa
  5. Verify: 0.49 + 0.42 + 0.09 = 1 ✓

Example 2 — Given p = 0.6 (Mode B)

  1. p = 0.6, q = 0.4 (via p + q = 1)
  2. p² = 0.36 | 2pq = 0.48 | q² = 0.16
  3. In 10,000: 3,600 AA, 4,800 Aa, 1,600 aa
  4. Verify: 0.36 + 0.48 + 0.16 = 1 ✓

Example 3 — Given q = 0.3 (Mode C)

  1. q = 0.3, p = 1 − 0.3 = 0.7
  2. p² = 0.49 | 2pq = 0.42 | q² = 0.09
  3. Same result as Example 1 — q=0.3 and q²=0.09 are equivalent starting points
  4. Verify: 0.49 + 0.42 + 0.09 = 1 ✓

Example 4 — Rare Recessive: q² = 0.01

  1. q² = 0.01 → q = √0.01 = 0.10
  2. p = 1 − 0.10 = 0.90
  3. p² = 0.81 | 2pq = 0.18 | q² = 0.01
  4. Key insight: 18% are carriers (Aa) but only 1% show the recessive phenotype (aa)
  5. Verify: 0.81 + 0.18 + 0.01 = 1 ✓

Example 5 — Observed Counts: 640 AA, 320 Aa, 40 aa (Mode D)

  1. N = 1000, total alleles = 2000
  2. p = (1280 + 320)/2000 = 0.80
  3. q = (80 + 320)/2000 = 0.20
  4. HW Expected: p²=0.64, 2pq=0.32, q²=0.04
  5. Observed: 0.640, 0.320, 0.040 — Difference ≈ 0% → In equilibrium ✓

Example 6 — Given p² Only: p² = 0.49

  1. p = √0.49 = 0.70
  2. q = 1 − 0.70 = 0.30
  3. p² = 0.49 | 2pq = 2×0.7×0.3 = 0.42 | q² = 0.09
  4. Verify: 0.49 + 0.42 + 0.09 = 1 ✓

Frequently Asked Questions

What is p in the Hardy-Weinberg principle?
In the Hardy-Weinberg principle, p represents the frequency of the dominant allele in a population. It is a decimal between 0 and 1. p is related to q by p + q = 1, so p = 1 − q. The frequency of the homozygous dominant genotype (AA) is p², not p itself.
How do you calculate allele frequency from genotype counts?
Given AA, Aa, aa counts: N = AA + Aa + aa. p = (2×AA + Aa)/(2N). q = (2×aa + Aa)/(2N). Each AA contributes 2 A alleles; each Aa contributes 1 A allele; each aa contributes 0 A alleles. Note: observed q² = aa/N (not aa/2N — q² is a genotype frequency per individual, not per allele).
What happens when a population is in Hardy-Weinberg equilibrium?
When a population is in Hardy-Weinberg equilibrium, allele frequencies and genotype frequencies remain constant from generation to generation — the population is not evolving. Genotype frequencies follow p² + 2pq + q² = 1. All five conditions must be met: no mutations, no migration, random mating, infinite population size, and no natural selection.
When allele frequencies remain constant, this is known as what?
When allele frequencies remain constant from generation to generation, this is known as Hardy-Weinberg equilibrium (also called genetic equilibrium). It means the population is not evolving at that locus. The Hardy-Weinberg principle, established in 1908, defines this stable state mathematically.
What are the five conditions for Hardy-Weinberg equilibrium?
The five Hardy-Weinberg conditions: (1) No mutations — alleles don't change. (2) No migration — no gene flow in or out. (3) Random mating — no mating preference by genotype. (4) Infinitely large population — no genetic drift. (5) No natural selection — all genotypes equally fit. Violating any single condition causes the population to evolve away from Hardy-Weinberg equilibrium.
What is the difference between allele frequency and genotype frequency?
Allele frequency (p and q) measures how common a particular allele version is among all alleles in the population — p + q = 1. Genotype frequency (p², 2pq, q²) measures how common each two-allele combination is among all individuals — p² + 2pq + q² = 1. Under Hardy-Weinberg equilibrium, allele frequencies predict genotype frequencies exactly.
How do you use the Hardy-Weinberg equation when given q²?
Step 1: q = √(q²). Step 2: p = 1 − q. Step 3: p² = p×p. Step 4: 2pq = 2×p×q. Step 5: verify p²+2pq+q² = 1. Example: q²=0.09 → q=0.3, p=0.7, p²=0.49, 2pq=0.42. This is the most common Hardy-Weinberg exam question format.
Why is q² used as the starting point in most Hardy-Weinberg problems?
Because q² is the only genotype that is directly observable from phenotype alone. Homozygous recessive individuals (aa) always show the recessive trait — you can count them. AA and Aa individuals look identical (both show the dominant phenotype), so you cannot distinguish them by looking. Starting from q² (observable) and working backwards to q and p is the standard Hardy-Weinberg approach.

Related Calculators

HW Equations
p + q = 1 Allele frequency equation
p² + 2pq + q² = 1 Genotype frequency equation
q = √(q²) Key solving step from recessive phenotype
p = 1 − q Most common first step
Quick Reference
p² = p × p AA — Hom. dominant freq.
2pq = 2 × p × q Aa — Heterozygous (carrier) freq.
q² = q × q aa — Hom. recessive freq.
q = √(q²) Recessive allele from phenotype freq.
p_obs = (2AA+Aa)/2N p from observed counts
q_obs = (2aa+Aa)/2N q from observed counts
Quick Examples
q²=0.09 → q=0.3, p=0.7
q²=0.04 → q=0.2, p=0.8
p=0.6 → q=0.4, p²=0.36
p=0.7 → q=0.3, 2pq=0.42
q=0.3 → p=0.7, q²=0.09
640AA 320Aa 40aa
q²=0.01 → rare recessive
q²=0.25 → p=q=0.5

Share This Tool

Share the Hardy-Weinberg Calculator with students!

Free chemistry, physics, biology & math calculators with step-by-step solutions. Trusted by 100,000+ students. Solve any science problem instantly!

Newsletter

Subscribe to our Newsletter to be updated. We promise not to spam.

Copyright © 2026 SciSolveLab. All Rights Reserved

Scroll to Top