Percentages and Math

Hardy-Weinberg Calculator

Enter how many individuals have each genotype to test whether the population matches Hardy-Weinberg proportions.

Your numbers

Homozygous for the first allele. Example value.

Heterozygous. Example value.

Homozygous for the second allele. Example value.

Result

p-value of the chi-square test (1 degree of freedom)

0.6379

Chi-square 0.2215.

Frequency of allele A (p)
0.5425
Frequency of allele a (q)
0.4575
Chi-square
0.2215
p-value
0.6379
Inbreeding coefficient F
0.0149
Individuals
1,000

Observed and expected genotypes

GenotypeObservedExpectedDifference
AA298294.313.69
Aa489496.39-7.39
aa213209.313.69
Total1,0001,000.00
How this was calculated
  1. p = (2 x AA + Aa) / (2 x N) = (2 x 298 + 489) / 2,000 = 0.5425, and q = 1 - p = 0.4575.
  2. Expected counts are p^2 x N, 2pq x N and q^2 x N: 294.31, 496.39, 209.31.
  3. Chi-square = the sum of (observed - expected)^2 / expected = 0.2215. With 1 degree of freedom (3 genotypes, minus 1, minus 1 for the estimated allele frequency) the p-value is 0.6379.
  • A p-value above your cutoff means no evidence of departure was found, not proof that the population is in equilibrium. The test also assumes one gene with two alleles and a random sample.

Calculated using SumPanda.com · https://sumpanda.com/hardy-weinberg-calculator/

Results are estimates for general information. Verify important figures before relying on them.

Next step

How to use the hardy-weinberg calculator

  1. Count the individuals in your sample with each genotype and enter them as AA, Aa and aa. A is one allele of a gene and a is the other.
  2. Read the allele frequencies p (for A) and q (for a), then the expected counts for each genotype if the population is in equilibrium.
  3. Check the chi-square value and its p-value with 1 degree of freedom. A small p-value is evidence that the population is not in Hardy-Weinberg proportions.
  4. The inbreeding coefficient F compares the heterozygotes you saw with the number expected: positive means fewer than expected.

Formula

p = (2 AA + Aa) / (2 N) q = 1 - p

expected counts: AA = p^2 N, Aa = 2 p q N, aa = q^2 N

chi-square = sum of (observed - expected)^2 / expected, with 1 degree of freedom

F = 1 - (observed Aa) / (expected Aa)

The Hardy-Weinberg principle says that, with random mating and no selection, migration or mutation, allele frequencies stay the same and genotype frequencies settle at p squared, 2pq and q squared. The p-value is the upper tail of the chi-square distribution with one degree of freedom.

A blood group sample of 1,000 people

A classic data set has 298 people with genotype MM (AA here), 489 with MN (Aa) and 213 with NN (aa). The allele frequency p is (2 x 298 + 489) / 2000 = 0.5425, so q is 0.4575. The expected counts are 294.31, 496.39 and 209.31. The chi-square is 0.2215 with a p-value of 0.6379, so there is no sign of departure from equilibrium. F is 0.0149.

Contrast a sample of 10 AA, 2 Aa and 38 aa. Here p is 0.22, only 2 heterozygotes are seen against 17.16 expected, the chi-square is 39.02 and the p-value is about 0.0000000004, with F = 0.8834. That pattern, a shortage of heterozygotes, can come from inbreeding, a mixed population or a genotyping problem.

What the test can and cannot say

A large p-value means the data are consistent with equilibrium; it does not prove it, especially in a small sample. A small p-value shows the genotypes depart from the expected proportions but not why. The usual suspects are non-random mating, population mixing, selection, genotyping errors and a sample drawn from related individuals.

The chi-square approximation is poor when an expected count is below 5, and the page warns you. For rare alleles in small samples an exact test is the better choice.

Using it with other tools

To predict the offspring of a particular cross, use the Punnett Square Generator. For other tests of counts against expectations, the Chi-Square Calculator handles tables and goodness of fit, and the Odds Ratio and Relative Risk Calculator compares two groups.

More genetics tools

For crosses and sequences, try the Punnett Square Generator and DNA Sequence Toolkit.

Assumptions and limits

  • The gene has two alleles, and each person in the sample has exactly one genotype.
  • Mating is random and there is no selection, migration or mutation in the population being modeled.
  • The sample is random and the people in it are not close relatives.
  • Counts are whole numbers of individuals, and the chi-square needs expected counts of about 5 or more.
  • The example counts are an illustration. Replace them with your own.

Formulas reviewed October 10, 2026. See the calculation methodology for how SumPanda rounds, tests and sources its formulas.

Frequently asked questions

Why is there only one degree of freedom?

There are three genotype counts, which are fixed by the total, so two are free. Estimating the allele frequency from the data uses up one more, leaving one degree of freedom.

What if the p-value is exactly 0.05?

That depends on the rule you chose before looking at the data. This page only reports the figure and does not label the result.

What does it mean if only one allele is present?

Then every individual is the same genotype and nothing varies, so there is nothing to test. The page says the test does not apply.

Can I use this for a sex-linked gene?

No. The formulas are for a gene on an autosome. Genes on sex chromosomes have different expected proportions in males and females.