Chi-Square Calculator
Reviewed by CalcMulti Editorial Team·Last updated: ·← Statistics Hub
The chi-square (χ²) test is used to determine whether observed frequencies differ significantly from expected frequencies. It works with categorical data and does not assume a normal distribution.
This calculator supports the goodness of fit test (does data match an expected distribution?) and outputs the χ² statistic, degrees of freedom, p-value, and test conclusion at the α = 0.05 significance level.
Formula
χ² = Σ (O − E)² / E df = k − 1 (goodness of fit)
- O
- observed frequency in each category
- E
- expected frequency in each category
- k
- number of categories
- df
- degrees of freedom
Enter observed and expected frequencies for each category. All expected values should be ≥ 5.
| Category | Observed (O) | Expected (E) | |
|---|---|---|---|
Chi-Square Critical Values (α = 0.05)
| df | χ² critical (α = 0.05) | χ² critical (α = 0.01) | Typical use case |
|---|---|---|---|
| 1 | 3.841 | 6.635 | 2-category goodness of fit |
| 2 | 5.991 | 9.210 | 3-category or 2×2 contingency |
| 3 | 7.815 | 11.345 | 4-category goodness of fit |
| 4 | 9.488 | 13.277 | 5-category test |
| 5 | 11.070 | 15.086 | 6-category test |
| 9 | 16.919 | 21.666 | 2×5 contingency table |
Common Mistakes
Expected frequencies below 5
Chi-square is an approximation that breaks down when any expected cell count is below 5. Combine categories or use Fisher's exact test. Chi-square with small expected counts produces an inflated test statistic.
Using raw proportions instead of counts
Chi-square requires actual frequencies (counts), not percentages or proportions. Convert: if 30% of 100 people chose option A, enter O = 30, not 0.30.
Forgetting to calculate expected values correctly
For independence tests, expected = (row total × column total) / grand total — not simply n/k. For goodness of fit, expected = n × hypothesised proportion for each category.
Chi-Square vs Other Categorical Tests — Which to Use?
| Condition | Chi-Square GoF | Fisher's Exact | McNemar |
|---|---|---|---|
| All expected counts ≥ 5 | ✓ Standard | Also works | — |
| Any expected count < 5 | — | ✓ Use this | — |
| Paired / before-after categorical data | — | — | ✓ |
| 2×2 table, large sample | ✓ (Yates correction) | ✓ | ✓ if paired |
| 3+ categories, large sample | ✓ | — | — |
| Need effect size alongside p-value | Add Cramér's V | Add odds ratio | — |
Case Study: Candy Colour Preference Survey — Testing Equal Distribution
A market researcher at a candy brand surveyed n = 200 consumers about their preferred candy colour (Red, Blue, Green, Yellow). The null hypothesis was equal preference — 50 expected in each category. Observed counts: Red = 72, Blue = 43, Green = 56, Yellow = 29.
χ² = (22²/50) + (7²/50) + (6²/50) + (21²/50) = 9.68 + 0.98 + 0.72 + 8.82 = 20.20, df = 3. The critical value at α = 0.05 with df = 3 is 7.815. χ² = 20.20 far exceeds it, p < 0.0001 — strong evidence to reject equal preference.
Red was the dominant choice (36% of responses), Yellow the least popular (14.5%). The brand increased Red-packaging inventory by 44% and discontinued the Yellow variant in the following production run. The Red SKU retail velocity improved 18% in the next quarter — confirming the survey's statistical signal.
Related Calculators
Compare means of two groups
P-Value Calculatorp-value from any test statistic
Normal Distribution CalculatorContinuous probability distribution
Sample Size CalculatorMinimum sample for hypothesis tests
Z-Score CalculatorStandard score for continuous data
Statistics HubAll statistics calculators
Disclaimer
Chi-square results are approximate and assume expected cell counts ≥ 5. For small samples or sparse tables, consider Fisher's exact test. Statistical significance does not imply practical significance.