Chi-Square Calculator
The TableSigma chi-square calculator runs a goodness-of-fit test (observed counts vs. an expected ratio) or a contingency-table independence test (up to 6×6), returning χ², degrees of freedom, the p-value and a step-by-step Σ(O−E)²/E breakdown.
Example pre-filled: Mendel's dihybrid cross (315 round-yellow, 108 round-green, 101 wrinkled-yellow, 32 wrinkled-green) tested against the expected 9:3:3:1 ratio.
χ² (df = 3) =
0.4700
p = 0.9254
Step by step: Σ(O−E)²/E
| Observed (O) | Expected (E) | (O−E)²/E |
|---|---|---|
| 315 | 312.75 | 0.0162 |
| 108 | 104.25 | 0.1349 |
| 101 | 104.25 | 0.1013 |
| 32 | 34.75 | 0.2176 |
Every value is computed live from the regularized incomplete gamma function (precision: 4 decimal places); reference: NIST/SEMATECH e-Handbook of Statistical Methods. Look up a critical value any time on the chi-square table.


How the two test modes work
Goodness of fit
Tests whether observed category counts match an expected ratio. Expected count for each category = (total observed) × (that category's share of the ratio). Degrees of freedom = number of categories − 1. The worked example above is Mendel's classic dihybrid-cross result: 315, 108, 101, 32 observed against a 9:3:3:1 expected ratio gives χ² ≈ 0.47, df = 3, a high p-value that supports the expected genetic ratio.
Contingency table (independence)
Tests whether two categorical variables are independent, using a table with r rows and c columns (up to 6×6 here). Expected count for each cell = (row total × column total) / grand total. Degrees of freedom = (rows−1)×(columns−1). A small p-value suggests the two variables are associated rather than independent.
Report an error in this table
Worked examples from students
No examples yet — share how you used this table for a class problem.
Submissions are reviewed before they appear here.
FAQ
What is a chi-square goodness-of-fit test used for?
Checking whether observed category counts (like Mendelian genetics ratios or dice rolls) match a theoretical or expected distribution.
What does it mean if an expected cell is less than 5?
The chi-square test's approximation to the true sampling distribution becomes less reliable with small expected counts; many textbooks recommend combining categories or using Fisher's exact test instead when this happens.
How is a contingency table chi-square test different from goodness of fit?
Goodness of fit compares one set of observed counts to a single expected distribution; a contingency table tests whether two categorical variables are independent of each other, using expected counts derived from the row and column totals.