Hardy-Weinberg Calculator

Calculate allele and genotype frequencies in a population using the Hardy-Weinberg equilibrium principle.

Hardy-Weinberg Analysis

p² + 2pq + q² = 0.3600 + 0.4800 + 0.1600 = 1.000000

0.6000
p (dominant)
0.4000
q (recessive)
1200
Dominant Alleles
800
Recessive Alleles

Genotype Frequencies & Counts

AA
0.3600 (36.0%)
360 individuals
Aa
0.4800 (48.0%)
480 individuals
aa
0.1600 (16.0%)
160 individuals

About Hardy-Weinberg Equilibrium

The Hardy-Weinberg principle states that allele and genotype frequencies remain constant in a population across generations in the absence of evolutionary forces. The equation p² + 2pq + q² = 1 describes genotype frequencies, where p = dominant allele frequency and q = recessive allele frequency (p + q = 1).

What the Hardy-Weinberg Calculator Does

The Hardy-Weinberg calculator turns a single allele frequency into a complete picture of a population's genetic makeup. Given one piece of information about a gene with two alleles, it predicts the expected proportion of every genotype and the absolute number of individuals carrying each one. This is the workhorse model of population genetics, and it underpins everything from carrier screening in human medicine to conservation planning for endangered species.

The Hardy-Weinberg principle, named after mathematician G.H. Hardy and physician Wilhelm Weinberg who independently described it in 1908, states that allele and genotype frequencies stay constant from generation to generation when a population is not evolving. In other words, the gene pool reaches a stable equilibrium that acts as a null hypothesis. If real-world genotype counts match the predicted Hardy-Weinberg frequencies, no evolutionary force is detectably acting on that locus; if they deviate, something like selection, migration, or non-random mating may be at work.

This calculator handles three common starting points. You can enter the dominant allele frequency (p) directly, enter the recessive allele frequency (q) directly, or supply the count of individuals showing the recessive phenotype and let the tool back-calculate the allele frequencies. Whichever mode you choose, it reports p, q, the three genotype frequencies, individual counts scaled to your population size, and the total number of dominant and recessive alleles in the gene pool. The equilibrium check line confirms that p² + 2pq + q² sums to 1.

The Hardy-Weinberg Equations

Two linked equations describe a Hardy-Weinberg population. The first deals with allele frequencies and the second with genotype frequencies. For a single gene with one dominant allele (A) and one recessive allele (a), the frequency of A is p and the frequency of a is q.

Because every allele copy at the locus must be either A or a, the two frequencies must add to one: p + q = 1. The genotype equation is the binomial expansion of that sum squared, which gives the proportions of the three possible diploid genotypes:

  • = frequency of homozygous dominant individuals (AA)
  • 2pq = frequency of heterozygous individuals (Aa)
  • = frequency of homozygous recessive individuals (aa)

When you start from the recessive phenotype count, the calculator reverses the logic. The recessive phenotype only appears in aa individuals, so its frequency equals q². Taking the square root recovers q, and p follows as 1 - q. Multiplying each genotype frequency by the population size N gives the expected number of individuals in each category, and counting allele copies (two per diploid individual) gives the total dominant and recessive alleles in the gene pool.

Hardy-Weinberg Genotype Distribution

p + q = 1 and p² + 2pq + q² = 1

Where:

  • p= Frequency of the dominant allele A (0 to 1)
  • q= Frequency of the recessive allele a; q = 1 - p
  • = Expected frequency of homozygous dominant genotype AA
  • 2pq= Expected frequency of heterozygous genotype Aa
  • = Expected frequency of homozygous recessive genotype aa
  • N= Population size; multiply each frequency by N for individual counts

How to Use the Calculator

Start by choosing a calculation mode that matches the data you have. Each mode needs only one genetic input plus an optional population size.

  1. From dominant allele frequency (p): Enter p as a decimal between 0 and 1. The tool sets q = 1 - p, then expands the squared sum to produce all genotype frequencies.
  2. From recessive allele frequency (q): Enter q directly. The tool sets p = 1 - q and proceeds identically. This mode is handy when you already know the rare allele's frequency from a database.
  3. From recessive phenotype count: Enter how many individuals display the recessive trait, plus the total population size. The tool computes q² = count ÷ N, takes the square root to find q, then derives p.

The population size field (default 1,000) scales frequencies into real counts. If you only care about proportions, the default is fine; if you are modeling a specific sample, enter its true size. Results update instantly. The output panel shows the equilibrium check (p² + 2pq + q² should equal 1.000000), the allele frequencies p and q, total dominant and recessive allele copies, and a per-genotype breakdown of AA, Aa, and aa with both percentages and individual counts.

One important caveat the tool cannot detect for you: the recessive-count mode only works if the recessive phenotype is fully expressed in homozygotes. If the trait shows incomplete penetrance or if heterozygotes are sometimes affected, the square-root estimate of q will be biased.

Reading and Interpreting the Results

The most useful number for many genetics problems is the heterozygote frequency, 2pq. For recessive genetic disorders, heterozygotes are unaffected carriers, so 2pq estimates the fraction of healthy people silently carrying one copy of the disease allele. A classic surprise is that even for a rare disorder, carriers vastly outnumber affected individuals. The table below shows how genotype proportions shift as the recessive allele becomes rarer.

q (recessive allele) p² (AA) 2pq (Aa carriers) q² (aa affected) Carriers per affected
0.50 0.2500 0.5000 0.2500 2.0
0.10 0.8100 0.1800 0.0100 18.0
0.01 0.9801 0.0198 0.0001 198.0

Notice that when q = 0.01, only 1 in 10,000 people are affected, yet nearly 2 in 100 are carriers. This is why screening programs target carriers, not just patients. The calculator's allele-count outputs are equally informative for conservation genetics: comparing observed heterozygosity against the expected 2pq value flags inbreeding or recent population bottlenecks long before they become obvious in phenotypes.

The Five Hardy-Weinberg Assumptions

Hardy-Weinberg equilibrium is an idealized model. It holds exactly only when five conditions are met simultaneously. Each violated assumption corresponds to a recognized mechanism of evolution, which is precisely why deviations from the predicted frequencies are biologically interesting.

  • No mutation: Allele frequencies are not altered by new mutations converting one allele into another.
  • No gene flow (migration): No individuals enter or leave the population carrying different allele frequencies.
  • No natural selection: All genotypes have equal survival and reproductive success, so none is favored.
  • Random mating: Mates pair without regard to genotype at the locus in question, so allele combinations follow chance alone.
  • Infinitely large population: The population is large enough that random sampling error (genetic drift) does not shift frequencies between generations.

No real population satisfies every assumption perfectly, yet many loci sit remarkably close to equilibrium because the deviations are small or balance out. Geneticists use a chi-square goodness-of-fit test to decide whether observed genotype counts differ significantly from the calculator's Hardy-Weinberg predictions. A significant deviation is a clue worth chasing, and a non-significant result confirms the locus behaves as a sensible neutral baseline.

Where Hardy-Weinberg Is Applied

The Hardy-Weinberg framework appears across biology, medicine, and forensics. In human genetics, it estimates carrier frequencies for autosomal recessive disorders such as cystic fibrosis, sickle cell anemia, and phenylketonuria, guiding the design of population screening programs. In conservation biology, comparing observed and expected heterozygosity helps detect inbreeding and loss of genetic diversity in small or fragmented populations. In forensic science, the same equations convert allele frequencies in reference databases into the random-match probability of a DNA profile.

The model is also a teaching cornerstone. Introductory genetics courses and exams such as AP Biology routinely ask students to compute carrier frequencies from a recessive phenotype count, which is exactly the recessive-count mode of this calculator. Beyond a single locus, the same binomial logic extends to genome-wide association studies, where checking each marker for Hardy-Weinberg equilibrium is a standard quality-control filter that flags genotyping errors. Whether you are estimating disease risk, auditing a SNP array, or solving a textbook problem, this allele frequency calculator gives the expected genotype distribution in one step.

Worked Examples

From dominant allele frequency p = 0.6

Problem:

A gene has a dominant allele frequency p = 0.6 in a population of 1,000 individuals. Find the genotype frequencies and counts.

Solution Steps:

  1. 1Set q = 1 - p = 1 - 0.6 = 0.4 (frequencies must sum to 1).
  2. 2Compute genotype frequencies: p² = 0.36, 2pq = 2 × 0.6 × 0.4 = 0.48, q² = 0.16.
  3. 3Scale to N = 1,000: AA = 0.36 × 1000 = 360, Aa = 0.48 × 1000 = 480, aa = 0.16 × 1000 = 160.
  4. 4Count alleles: dominant = 2(360) + 480 = 1,200; recessive = 2(160) + 480 = 800.

Result:

p = 0.6, q = 0.4. Genotypes: 360 AA, 480 Aa, 160 aa. Gene pool: 1,200 dominant and 800 recessive alleles.

From recessive phenotype count (160 of 1,000)

Problem:

In a sample of 1,000 individuals, 160 show the recessive phenotype. Estimate the allele and genotype frequencies.

Solution Steps:

  1. 1The recessive phenotype equals q², so q² = 160 ÷ 1000 = 0.16.
  2. 2Take the square root: q = √0.16 = 0.4000, then p = 1 - q = 0.6000.
  3. 3Genotype frequencies: p² = 0.3600, 2pq = 0.4800, q² = 0.1600.
  4. 4Counts at N = 1,000: AA = 360, Aa = 480, aa = 160 (matching the 160 observed).

Result:

q = 0.4000, p = 0.6000. Expected genotypes: 360 AA, 480 Aa, 160 aa.

From recessive allele frequency q = 0.3

Problem:

A recessive allele has frequency q = 0.3 in a population of 500. Predict the carrier frequency and counts.

Solution Steps:

  1. 1Set p = 1 - q = 1 - 0.3 = 0.7.
  2. 2Genotype frequencies: p² = 0.49, 2pq = 2 × 0.7 × 0.3 = 0.42, q² = 0.09.
  3. 3Scale to N = 500: AA = 0.49 × 500 = 245, Aa = 0.42 × 500 = 210, aa = 0.09 × 500 = 45.
  4. 4Allele copies: dominant = 2(245) + 210 = 700; recessive = 2(45) + 210 = 300.

Result:

p = 0.7, q = 0.3. Genotypes: 245 AA, 210 Aa (carriers), 45 aa. Gene pool: 700 dominant and 300 recessive alleles.

Tips & Best Practices

  • Allele frequencies p and q must each fall between 0 and 1 and always sum to exactly 1.
  • Use the recessive phenotype count mode for the common exam problem of finding carrier frequency from affected individuals.
  • Heterozygote (Aa) carriers are the 2pq term and usually far outnumber affected aa individuals for rare alleles.
  • Only take the square root of q² when the recessive phenotype is fully penetrant in homozygotes.
  • Set the population size to your real sample size when you need individual counts rather than proportions.
  • Confirm the equilibrium check line reads 1.000000 to verify your inputs are consistent.
  • To test for evolution, follow up with a chi-square test comparing observed versus these expected counts.
  • Remember that p², 2pq, and q² are the AA, Aa, and aa genotype frequencies in that order.

Frequently Asked Questions

The Hardy-Weinberg equation is p² + 2pq + q² = 1, the binomial expansion of (p + q)². Here p is the dominant allele frequency and q is the recessive allele frequency, with p + q = 1. The three terms give the expected proportions of homozygous dominant (AA), heterozygous (Aa), and homozygous recessive (aa) genotypes when a population is in equilibrium.
Affected individuals with a recessive trait have genotype aa, whose frequency is q². Divide the affected count by the total population to get q², then take the square root to find q. The dominant allele frequency is simply p = 1 - q. This calculator does that automatically in the recessive phenotype count mode.
Heterozygotes can form in two ways: the A allele from the father and a from the mother, or a from the father and A from the mother. Each combination has probability pq, and adding the two equally likely arrangements gives 2pq. That factor of two is why carriers of recessive disorders are far more common than affected individuals.
Five conditions must be met at once: no mutation, no gene flow or migration, no natural selection, random mating, and an infinitely large population so genetic drift is negligible. When all five hold, allele and genotype frequencies remain constant across generations. Each violated assumption corresponds to a mechanism of evolution, which is why deviations are biologically meaningful.
Yes, but the equation expands. For three alleles with frequencies p, q, and r summing to one, genotype frequencies follow (p + q + r)² = p² + q² + r² + 2pq + 2pr + 2qr = 1. This calculator focuses on the two-allele case, which covers most introductory problems and single dominant/recessive trait analyses.
No single calculation proves evolution. The tool gives the expected genotype frequencies under equilibrium as a null hypothesis. To test for evolution you compare these expected counts against observed genotype counts using a chi-square goodness-of-fit test; a statistically significant deviation suggests an evolutionary force such as selection or non-random mating is acting on the locus.

Sources & References

Last updated: 2026-06-05

💡

Help us improve!

How would you rate the Hardy-Weinberg Calculator?

<>

Editorial Note

MyCalcBuddy Editorial Team

This page is maintained as an educational calculator reference.

Source

Formula Source: Standard Mathematical References

by Various

UpdatedLast reviewed: May 2026
CheckedFormula checks are based on standard references and internal QA review.

Privacy choices

MyCalcBuddy uses necessary storage for the site to work. Optional analytics, notifications, and future advertising features stay off unless you allow them.