Audited 29 Jul 2026·Last updated 28 Oct 2026·6 citations·Tier 2·0 uses

Chi-Square Calculator for Genetic Ratios

Test offspring counts against 3:1, 1:1, 1:2:1, 9:3:3:1, 1:1:1:1 or Hardy-Weinberg with a chi-square goodness-of-fit test; degrees of freedom are set for you.

Chi-Square Calculator for Genetic Ratios

Expected ratio (your null hypothesis)
The class with the largest share of the ratio. For 9:3:3:1 that is the double-dominant class; for 3:1 the dominant phenotype; for Hardy-Weinberg the AA homozygotes. Whole numbers only.
individuals
The second class in ratio order. For 3:1 the recessive phenotype; for 1:2:1 and Hardy-Weinberg the heterozygotes.
individuals
Used only by ratios with three or more classes, and by the Hardy-Weinberg option (the aa homozygotes). Ignored entirely for 3:1 and 1:1, so a leftover value here cannot affect a two-class test.
individuals
Used only by the four-class ratios 9:3:3:1 and 1:1:1:1. Ignored by every other option.
individuals
Significance level (alpha)
Chi-square statistic
0.47
The chi-square statistic, Σ (observed − expected)² ÷ expected over the classes of your ratio; a pure number that is zero for a perfect fit.
Degrees of freedom
3
P-value
0.9254
Critical value
7.8147
Total offspring scored
556 individuals
Smallest expected count
34.75
Conclusion
Fail to reject: chi-square 0.4700 does not exceed the critical value 7.8147 at alpha = 0.05 with 3 degrees of freedom. The data are consistent with a 9:3:3:1 ratio — which is not the same as proving it.

Background.

Mendel scored 556 seeds from his dihybrid pea cross: 315 round and yellow, 108 round and green, 101 wrinkled and yellow, 32 wrinkled and green. A perfect 9:3:3:1 split of 556 would have been 312.75, 104.25, 104.25 and 34.75. Real crosses never land exactly on the ratio, so the useful question is whether the miss is the sort that random sampling produces on its own, or big enough to make you doubt the hypothesis — and start looking for linkage, a lethal genotype, poor survival of one class or a scoring mistake.

The chi-square goodness-of-fit test turns that question into a number. Each class contributes its squared excess or shortfall divided by the count expected, and the total is compared with the chi-square distribution for the right number of degrees of freedom. That last number is where most errors creep in. For a fixed Mendelian ratio it is the number of classes minus one, but a Hardy-Weinberg test loses a second degree of freedom because the allele frequency is estimated from the very counts being tested. Choosing the ratio here sets the degrees of freedom for you.

Six hypotheses are available: 3:1 and 1:2:1 for monohybrid crosses, 1:1 and 1:1:1:1 for testcrosses, 9:3:3:1 for a dihybrid F2, and Hardy-Weinberg proportions for genotype counts sampled from a population. Alongside the statistic you get the degrees of freedom, the p-value, the critical value at your chosen significance level, the smallest expected count so you can judge whether the approximation holds, and a verdict worded no more strongly than the test allows.

What is chi-square calculator for genetic ratios?

A goodness-of-fit test asks whether counts falling into categories match proportions fixed in advance. The statistic, χ² = Σ (O − E)² ÷ E, is zero for a perfect fit and grows as the fit worsens; squaring makes excesses and shortfalls count alike, and dividing by E means a miss of 10 weighs far more in a class expecting 20 than in one expecting 2,000. If the hypothesis is true, the statistic follows a chi-square distribution approximately, and the p-value is the chance of a value at least as large. In genetics the expected counts come from a segregation ratio, or, for a population sample, from the Hardy-Weinberg proportions p², 2pq and q².

How to use this calculator.

  1. Pick the ratio your hypothesis predicts. The choice also fixes the degrees of freedom, so there is nothing to look up.
  2. Enter whole-number counts in ratio order. For 9:3:3:1 put the double-dominant class first, the two single-dominant classes next in either order (they share an expected count), and the double-recessive last; for 1:2:1 and Hardy-Weinberg enter AA, Aa, then aa. Fields a ratio does not use are ignored.
  3. Choose the significance level before you look at the result; switching from 0.05 to 0.10 because a test came close defeats its purpose.
  4. Read the verdict, then the smallest expected count. Below 5 the verdict adds a caution that the p-value is only approximate.
  5. For Hardy-Weinberg tests on genotyping data with a rare allele, confirm a borderline result with an exact test, and remember that a strong departure at a single marker is routinely checked as possible genotyping error before it is read as biology.

The formula.

χ² = Σ (O − E)² ⁄ E df = k − c

Expected counts first: each class receives the total N times its share of the ratio, so for 9:3:3:1 the shares are 9/16, 3/16, 3/16 and 1/16. They are not rounded to whole individuals, since rounding them shifts the statistic. Then χ² = Σ (O − E)² ÷ E over the classes. NIST's handbook gives the degrees of freedom as k − c, where k is the number of classes and c is one plus the number of parameters estimated from the data. The one is the constraint that expected counts must add up to the observed total. A fixed Mendelian ratio estimates nothing, so df = k − 1: 1 for 3:1 and 1:1, 2 for 1:2:1, 3 for 9:3:3:1 and 1:1:1:1. In Hardy-Weinberg mode the allele frequency is estimated by gene counting, p = (2 × AA + Aa) ÷ 2N, expected counts are p²N, 2pqN and q²N, and df = 3 − 2 = 1. The critical value is the point of the chi-square distribution cutting off an upper tail of size alpha, worked out from the distribution itself; at 0.05 it is 3.841 for 1 df, 5.991 for 2 and 7.815 for 3, matching NIST's printed table. The hypothesis is rejected when χ² exceeds that value, which always coincides with the p-value falling below alpha. Counts must be whole and non-negative with a total above zero, and a Hardy-Weinberg sample containing only one allele is refused because there is nothing to test.

A worked example.

Example

Mendel's 556 seeds give expected counts of 556 × 9/16 = 312.75 round and yellow, 556 × 3/16 = 104.25 for each single-dominant class, and 556 × 1/16 = 34.75 wrinkled and green. Class by class: (315 − 312.75)² ÷ 312.75 = 5.0625 ÷ 312.75 = 0.0162; (108 − 104.25)² ÷ 104.25 = 14.0625 ÷ 104.25 = 0.1349; (101 − 104.25)² ÷ 104.25 = 10.5625 ÷ 104.25 = 0.1013; (32 − 34.75)² ÷ 34.75 = 7.5625 ÷ 34.75 = 0.2176. The sum is χ² = 0.4700. Four classes with nothing estimated give 4 − 1 = 3 degrees of freedom, and the critical value at alpha 0.05 is 7.8147. The statistic falls far short of it, so the 9:3:3:1 hypothesis is not rejected; the p-value of 0.9254 means that a departure at least this large would turn up about 93% of the time by chance alone if the ratio were exactly right. Notice which class contributes most: the wrinkled green seeds, missing their expectation by only 2.75, outweigh the round yellow seeds that missed by 2.25, because a deviation counts relative to the size of the class it occurs in.

alpha0.05
observed3101
observed2108
expected Ratio9:3:3:1
observed1315
observed432

Frequently asked questions.

Why does a Hardy-Weinberg chi-square test have only 1 degree of freedom?
Because p is estimated from the counts being tested. Take 60 AA, 30 Aa and 10 aa: p = 150 ÷ 200 = 0.75, expected counts are 56.25, 37.5 and 6.25, and χ² = 4.0. With 1 df the p-value is 0.0455, a rejection at 0.05. Wrongly using 2 df gives about 0.135 and a critical value of 5.991, so the departure would pass unnoticed.
My counts are close to 3:1, so why does the test reject?
Sample size. Mendel's 787 long and 277 short stems give χ² = 0.6065 and p = 0.4361. Multiply both counts by ten, keeping the identical 74% proportion, and χ² becomes 6.0652 with p = 0.0138, a rejection. Large samples detect small real deviations, so judge how big the departure is as well as whether it is significant.
What could cause a significant departure from the expected ratio?
Linkage is the classic one: a dihybrid testcross of 412, 88, 94 and 406 gives χ² = 404.64 against 1:1:1:1, with 18.2% recombinants. Others include a lethal genotype (a 2:1 ratio instead of 3:1), reduced viability of one class, epistasis producing ratios such as 9:3:4 or 9:7, incomplete penetrance and misclassified offspring.
How small can the expected counts be?
The rule of thumb traces to Cochran's 1954 paper and circulates as at least 5 per class, at least 10, or at least 5 in 80% of classes with none below 1; NIST states no minimum. A caution appears below 5 — for example a 1:2:1 test on 16 offspring, where the end classes expect 4. With counts that small, an exact test is the safer choice.
With only 20 offspring, can the test tell 3:1 from 1:1?
Rarely. A split of 12 to 8 gives χ² = 2.4 (p = 0.1213) against 3:1 and χ² = 0.8 (p = 0.3711) against 1:1, so neither is rejected. Failing to reject means the data are consistent with the ratio, not that it is proven; small samples are consistent with almost anything plausible.
Were Mendel's results too good to be true?
In 1936 R. A. Fisher argued that, taken across all his experiments, Mendel's counts agree with expectation more closely than chance would usually allow. A single p-value of 0.9254 is not suspicious on its own; Fisher's case rested on many such fits together, and why the agreement was so close has been debated ever since.

References& sources.

  1. [1]NIST/SEMATECH (2012). e-Handbook of Statistical Methods, §1.3.5.15 'Chi-Square Goodness-of-Fit Test'. Source for the test statistic χ² = Σ(O−E)²/E, for the degrees-of-freedom rule k − c where c is the number of estimated parameters plus one, and for the rejection rule χ² > χ²₁₋α,k₋c. Independent, free, US National Institute of Standards and Technology; retrieved 2026-07-29.
  2. [2]NIST/SEMATECH (2012). e-Handbook of Statistical Methods, §1.3.6.7.4 'Critical Values of the Chi-Square Distribution'. Used as the independent check on this page's arithmetic: no critical value is taken from a table here, and the computed values reproduce all nine table entries for 1 to 3 degrees of freedom at probability levels 0.90, 0.95 and 0.99 — 2.706 / 3.841 / 6.635, 4.605 / 5.991 / 9.210 and 6.251 / 7.815 / 11.345. Independent, free, NIST; retrieved 2026-07-29.
  3. [3]Abbott, S. & Fairbanks, D. J. (2016). Experiments on plant hybrids by Gregor Mendel. Genetics 204(2):407–422, doi:10.1534/genetics.116.195198. PMC5068836. An annotated modern English translation of Mendel's 1866 paper, and the source of both worked examples on this page: the dihybrid F2 counts (556 seeds; 315 round and yellow, 101 angular and yellow, 108 round and green, 32 angular and green) and the monohybrid stem-length counts (1,064 plants; 787 long, 277 short). Independent, free via PubMed Central; retrieved 2026-07-29.
  4. [4]NCBI dbSNP FAQ Archive, 'Hardy Weinberg Equilibrium Data'. NCBI Bookshelf NBK573517. Corroborates the degrees-of-freedom rule used by the Hardy-Weinberg mode — recording the argument that because only one independent parameter is being estimated there should only be 1 degree of freedom — and records NCBI's stated intention to move from the chi-square test to Fisher's exact test because the latter is a better way to assess Hardy-Weinberg proportions when the sample size is small. Independent, free, US National Institutes of Health; retrieved 2026-07-29.
  5. [5]Wigginton, J. E., Cutler, D. J. & Abecasis, G. R. (2005). A note on exact tests of Hardy-Weinberg equilibrium. American Journal of Human Genetics 76(5):887–893. PubMed 15789306. Source of the caveat attached to the Hardy-Weinberg mode: the chi-square goodness-of-fit test can have inflated type I error rates even in relatively large samples — for example 1,000 individuals containing about 100 copies of the minor allele — and an exact test should be preferred there. Independent; abstract free on PubMed, full text paywalled at the publisher; retrieved 2026-07-29.
  6. [6]Cochran, W. G. (1954). Some methods for strengthening the common χ² tests. Biometrics 10(4):417–451, doi:10.2307/3001616. The origin of the minimum-expected-count rule of thumb that this page reports and cautions on. Note that the rule circulates in several incompatible forms — expected counts of at least 5, of at least 10, or at least 5 in 80 % of cells with none below 1 — and NIST's goodness-of-fit section states no minimum at all. Independent; paywalled at JSTOR — cited bibliographically for the rule's origin. Checked 2026-07-29.

How this page was produced

Published by
Quanta Calculator
Primary sources
6 cited below
Method
χ² = Σ (O − E)² ⁄ E df = k − c
Published
Last verified

Built with AI assistance and verified by automated tests against the cited sources — every worked example on this page is computed by the same code that runs the calculator. How we build and check calculators.

In this category

Embed

Quanta Pro

Paid features are coming later.

  • All 1560 calculators remain free
  • No billing is enabled
Coming soon