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.

CategoryObserved (O)Expected (E)

Chi-Square Critical Values (α = 0.05)

dfχ² critical (α = 0.05)χ² critical (α = 0.01)Typical use case
13.8416.6352-category goodness of fit
25.9919.2103-category or 2×2 contingency
37.81511.3454-category goodness of fit
49.48813.2775-category test
511.07015.0866-category test
916.91921.6662×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?

ConditionChi-Square GoFFisher's ExactMcNemar
All expected counts ≥ 5✓ StandardAlso 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-valueAdd Cramér's VAdd 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.

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.

Frequently Asked Questions