Enter the allele frequencies of a gene, or just the share of a population that shows a recessive trait, and this Hardy-Weinberg calculator returns the expected genotype frequencies p², 2pq and q², the carrier rate and a frequency square that shows where each number comes from. It works for two to five alleles, so it doubles as a genotype frequency calculator for multi-allele loci.
The frequency square on the page is a Punnett square for a whole population. Instead of one parent’s gametes on each axis it carries every allele in the gene pool, scaled by how common it is. With two alleles at frequencies p and q the four cells hold p², pq, qp and q², and adding the two heterozygous cells gives the equation p² + 2pq + q² = 1. The square makes the assumption visible: every gamete meets every other gamete at random, which is what random mating means.
Most textbook problems start from the number of affected individuals. Switch the calculator to From recessive % and type that share as q². Suppose 4% of a population shows a recessive condition:
Eight times more people carry the allele than show the condition, which is why recessive disorders persist even when affected individuals rarely reproduce.
Real loci often have more than two alleles: the ABO blood group has three. Set the allele count and enter a frequency for each; the calculator keeps the total at 1 and draws the full square. For frequencies 0.5, 0.3 and 0.2 the homozygotes are 0.25, 0.09 and 0.04 and the three heterozygote classes are 0.30, 0.20 and 0.12, six genotypes that again add up to 1. The rows below the square list every class with its share, so you can read off how many people carry a particular rare allele.
The equation only predicts the next generation if five conditions hold: no new mutations, no migration into or out of the population, no natural selection on the locus, random mating with respect to the trait, and a population large enough for chance to average out. Real populations bend at least one of them, and that is the point of the calculation: compare the expected genotype frequencies with the ones you count, and a mismatch tells you something is acting on the gene. A chi-square test is the standard way to decide whether the difference is more than sampling noise.
Every value updates as you type. The square can be saved as PNG, JPG or SVG and the genotype table as CSV, and the share button copies a link with your frequencies in it. For the inheritance of a single cross rather than a population, use the Punnett square calculator.
p and q are the frequencies of the two alleles at a locus and add up to 1. Squaring the sum gives the genotype frequencies of the next generation under random mating: p² homozygous for the first allele, 2pq heterozygous and q² homozygous for the second allele.
Take the square root of the affected (homozygous recessive) frequency to get q, subtract it from 1 to get p, and multiply 2pq. If 1 in 25 people are affected, q² = 0.04, q = 0.2, p = 0.8 and the carrier frequency 2pq = 0.32, so 32% of the population carries one copy.
No mutation, no migration in or out of the population, no natural selection, random mating and a population large enough that genetic drift is negligible. When all five hold, allele frequencies do not change from one generation to the next.
Yes. Set the allele count to 3, 4 or 5 and enter a frequency for each. The frequency square then shows every homozygous and heterozygous genotype, for example the six genotypes of a three-allele locus.
Because the allele frequencies you typed do not add up to 1. The calculator shows a warning with the actual total; press Balance to 1 to scale the values proportionally, or correct one of them by hand.
They use the same idea. A Punnett square combines the gametes of two parents; the Hardy-Weinberg frequency square combines the gametes of a whole population, weighting each allele by how common it is. The cells are population frequencies instead of one family's odds.