Free tool

Hardy-Weinberg Calculator

Start from the homozygous recessive frequency, an allele frequency, or observed genotype counts, and get p, q and the expected genotype frequencies - plus a chi-square test when you enter counts. Every step is shown.

Built for General Biology II and AP Biology

The population

Only the aa individuals show the recessive phenotype, so their frequency is q^2.

Adds expected numbers of individuals for each genotype.

Result

Enter a frequency or counts to see p, q and the genotype frequencies.

Hardy-Weinberg problems get fast once the setup is automatic. Encodr keeps the equations and the five conditions on a spaced-repetition schedule so they are still there on exam day.

Get started free

The two Hardy-Weinberg equations

For a gene with two alleles, A at frequency p and a at frequency q:

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

p^2 is the frequency of AA individuals, 2pq of Aa carriers, and q^2 of aa individuals. The first equation is about alleles, the second about genotypes. The prediction only holds if all five conditions are met: no mutation, random mating, no gene flow, a very large population, and no natural selection. No real population meets all five, so the model is used as a baseline - a population that does not match it is evolving.

Worked example: from the recessive phenotype

16% of a population shows a recessive trait, so q^2 = 0.16. Then q = √0.16 = 0.4, p = 1 - 0.4 = 0.6, p^2 = 0.36 and 2pq = 2 × 0.6 × 0.4 = 0.48. So 36% are AA, 48% are carriers and 16% are aa. Start from q^2, never from p^2: the dominant phenotype lumps AA and Aa together, so its frequency is p^2 + 2pq, not p^2.

Worked example: counts and a chi-square test

A sample of 100 has 40 AA, 40 Aa and 20 aa. Count alleles: p = (2 × 40 + 40) ÷ 200 = 0.6 and q = 0.4. Expected counts are 0.36 × 100 = 36, 0.48 × 100 = 48 and 0.16 × 100 = 16. Chi-square = (40 - 36)^2/36 + (40 - 48)^2/48 + (20 - 16)^2/16 = 0.444 + 1.333 + 1.000 = 2.78. With 1 degree of freedom (3 genotype classes, minus 1, minus 1 for estimating p from the same data) the critical value at p = 0.05 is 3.84. 2.78 is below it, so the data do not show a significant departure from Hardy-Weinberg equilibrium. The full walkthrough is in the Hardy-Weinberg guide, and the General Biology II course has the practice cards.

From the blog

Hardy-Weinberg equilibrium explained with examples

The Hardy-Weinberg equations, the five conditions, and worked problems from q^2, the dominant phenotype, and genotype counts with a chi-square test.

Read →

What's in General Biology II

The 18 units of a second-semester college biology course, from evolution and Hardy-Weinberg to animal physiology and ecology, mapped to OpenStax chapters.

Read →

How to study for General Biology II

General Biology II mixes processes, long lists of groups, body systems and some math. Study methods for each kind of material, with examples.

Read →

How to read a phylogenetic tree

Nodes, sister taxa, basal taxa, polytomies and clades, why branch length and tip order usually mean nothing, and how parsimony picks a tree.

Read →

First-year biology, chemistry and physics, compared

What General Biology I and II, General Chemistry I and II, and College Physics I and II each cover, how they fit together, and free flashcards for each.

Read →

Related tools

Punnett Square Calculator

Enter two parent genotypes for one or two genes to get the Punnett square, gametes, and genotype and phenotype ratios with percentages.

Open tool →

Bacterial Growth Calculator

Free bacterial growth calculator: final population, number of generations or generation time from Nn = N0 x 2^n, with the working shown.

Open tool →

Serial Dilution Calculator

Free serial dilution calculator: total dilution factor across steps and CFU/mL from a plate count, with the 30-300 colony countable-range check.

Open tool →

BMR and TDEE Calculator

Estimate resting energy with the Mifflin-St Jeor equation, then multiply by an activity factor for total daily energy expenditure, in metric or US units with the working shown.

Open tool →

Macronutrient Calculator

Convert grams of carbohydrate, protein, fat and alcohol to kilocalories, or a calorie target and percent split to grams, checked against AMDR ranges.

Open tool →

All free tools