Chi-Square Calculator
The chi-square statistic and its exact p-value, for testing whether observed counts differ from what was expected.
Chi-square compares counts you observed with counts you expected, summing (observed − expected)² ÷ expected across every category.
How the chi-square calculator works
Chi-square compares counts you observed with counts you expected, summing (observed − expected)² ÷ expected across every category. Large values mean the observed pattern is far from the expectation; the p-value says how often chance alone would produce a gap that big.
Two conditions matter. The test works on counts, not percentages or means — converting to percentages first is the commonest error and inflates the statistic. And it becomes unreliable when expected counts are very small; the usual rule of thumb is that every expected count should be at least five, which the calculator checks and warns about.
Formula: χ² = Σ (observed − expected)² ÷ expected
Worked examples
| Inputs | χ² statistic | Note |
|---|---|---|
| Six categories against an equal split | 37.78 | χ² = 34.4, p < 0.0001 — clearly not uniform |
| A fair die rolled 60 times | 0 | χ² = 0 — a perfect fit |
| A small-count warning | 0 | expected counts under 5 |
FAQFrequently asked questions
What does chi-square test?
Whether observed counts differ from expected counts by more than chance comfortably explains.
Can I use percentages?
No. The test works on raw counts. Converting to percentages first inflates the statistic and invalidates the result.
What if my expected counts are small?
Below about five the approximation becomes unreliable. Combine categories, or use an exact test such as Fisher's.
How many degrees of freedom?
For goodness of fit, categories minus one. For a contingency table it is (rows − 1) × (columns − 1).
What does a significant result mean?
That the pattern differs from expectation. It does not say which category drove it — look at the individual contributions for that.
Where these figures come from
- NIST Digital Library of Mathematical Functions — reference definitions for elementary and special functions
- Wolfram MathWorld — definitions and formulas for every topic on this page
- NIST/SEMATECH e-Handbook of Statistical Methods — the statistical formulas (mean, variance, z, confidence intervals, sample size)
- Common Core State Standards — Mathematics — the terms and methods taught in US schools
Last checked: September 2026. Formulas are fixed by mathematics and do not change with tax years or regulations.