Terms can also be expected counts or fractions - they are scaled to the observed total.

Observed counts

Chi-square test calculator for genetics

Type the offspring you counted in each phenotype class, choose the Mendelian ratio you expected, and this chi-square calculator reports the χ² statistic, the degrees of freedom, the p-value and a plain verdict on whether your cross fits the ratio. It is a goodness-of-fit test built for genetics, with the classic ratios one tap away and room for up to eight categories.

What the test asks

A Punnett square predicts a ratio; a real cross produces counts that never match it exactly. The chi-square test asks whether the gap between the two is small enough to blame on chance. For every category it takes the squared difference between observed and expected counts, divides by the expected count, and adds the results: χ² = Σ (O − E)² / E. A deviation in a small category weighs more than the same deviation in a large one, which is why the recessive class usually decides the outcome.

Mendel’s dihybrid cross, tested

Mendel’s F2 peas gave 315 round yellow, 108 round green, 101 wrinkled yellow and 32 wrinkled green seeds, 556 in total. Against a 9:3:3:1 ratio the expected counts are 312.75, 104.25, 104.25 and 34.75. The categories contribute 0.016, 0.135, 0.101 and 0.218, so χ² = 0.470 with 3 degrees of freedom. The p-value is 0.925: a deviation this size or larger would appear in 92% of repeated experiments if the ratio were true, so the data fit. The calculator opens with this example loaded.

Reading the result

How to run your own test

A monohybrid example: 705 dominant and 224 recessive plants tested against 3:1 give χ² = 0.391 and p = 0.532, a fit. The same tool checks whether genotype counts agree with Hardy-Weinberg expectations, and the ratios themselves come from the Punnett square calculator.

Frequently asked questions

What does the chi-square test tell me about a genetic cross?

It measures how far your observed offspring counts are from the counts a Mendelian ratio predicts, and turns that distance into a probability. A p-value at or above 0.05 means the deviation is the kind you get from random sampling, so the data are consistent with the ratio; a smaller p-value means the ratio is unlikely to be the true explanation.

How are the expected counts calculated?

Add up all observed offspring, then split that total in the expected ratio. For 556 offspring and a 9:3:3:1 ratio the expected counts are 556 × 9/16 = 312.75, then 104.25, 104.25 and 34.75. The calculator does this automatically when you change the ratio or the counts.

What are degrees of freedom in a chi-square goodness-of-fit test?

The number of categories minus one. Two phenotype classes give 1 degree of freedom, the four classes of a dihybrid cross give 3. The degrees of freedom decide which critical value applies: 3.841 for df 1 and 7.815 for df 3 at the 0.05 level.

Can I use the calculator with a ratio that is not on the preset list?

Yes. Type any ratio into the expected ratio field, such as 1:1:1:1:1:1 for a six-sided die or 27:9:9:9:3:3:3:1 for a trihybrid cross. Terms can be counts or fractions; the calculator scales them to your observed total and adjusts the number of categories to match.

Does the chi-square test work with small samples?

The approximation gets rough when an expected count drops below about 5. With very few offspring, collect more data or combine categories before trusting the p-value. Larger samples also make the test more sensitive to small real deviations.