Chi-Square Calculator
Enter your observed and expected values below to instantly get the chi-square statistic.
The Chi-Square Formula
χ² = Σ (O − E)² / E. For each category, subtract expected from observed, square it, divide by expected, then add up every category's contribution.
Worked example
Observed: 10, 20, 30, 40. Expected: 20, 20, 20, 20.
(10−20)²/20 + (20−20)²/20 + (30−20)²/20 + (40−20)²/20 = 5 + 0 + 5 + 20 = 30
χ² = 30
A second example
Observed: 15, 25, 20, 20. Expected: 20, 20, 20, 20.
(15−20)²/20 + (25−20)²/20 + (20−20)²/20 + (20−20)²/20 = 1.25 + 1.25 + 0 + 0 = 2.5
χ² = 2.5 — much smaller than the first example, meaning these observed counts are much closer to what was expected.
Keep going
- Chi-square and t-test are both hypothesis tests, just for different kinds of data; the t-test calculator compares a sample mean instead of comparing observed and expected category counts. T-Test Calculator
Frequently Asked Questions
What is a chi-square goodness-of-fit test?
It tests whether observed data matches an expected distribution. A large chi-square statistic means the observed values are far from what was expected; a small one means they're close.
What is the chi-square formula?
χ² = Σ (O − E)² / E, summed over every category, where O is the observed count and E is the expected count.
What do you do with the chi-square statistic once you have it?
Compare it to a critical value from a chi-square distribution table, based on your degrees of freedom (number of categories minus 1) and chosen significance level. If your statistic exceeds the critical value, the difference between observed and expected is considered statistically significant.
What counts as a large chi-square value?
It depends on your degrees of freedom and chosen significance level. For 3 degrees of freedom (4 categories) at the common 0.05 significance level, the critical value is about 7.815 — a computed statistic above that suggests the observed and expected frequencies differ by more than chance alone.
What's a common mistake when running this test?
Using percentages or proportions instead of raw counts for O and E. The chi-square goodness-of-fit test needs actual observed and expected frequencies (counts of things), and the observed and expected totals should match before you start.
Related Calculators
- Standard Deviation Calculator — Statistics
- Percentile Calculator — Statistics
- Mean, Median, Mode Calculator — Statistics
- Variance Calculator — Statistics