Chi-Square Calculator (Goodness of Fit)
A chi-square goodness of fit test asks whether the counts you actually observed match the counts you expected. Enter both lists of frequencies and the calculator gives you the chi-square statistic (χ²), the degrees of freedom and the p-value.
Chi-Square Formula
χ² = Σ (O − E)² / E
- O = the observed frequency in a category
- E = the expected frequency in that category
- Add up (O − E)² / E for every category
- Degrees of freedom = number of categories − 1
Expected frequencies should usually be at least 5 in each category for the p-value to be reliable.
Worked Example
You expect three outcomes equally often, so with 60 trials you expect 20, 20, 20. You actually observe 10, 20, 30.
- Category 1: (10 − 20)² / 20 = 100 / 20 = 5.
- Category 2: (20 − 20)² / 20 = 0.
- Category 3: (30 − 20)² / 20 = 100 / 20 = 5.
- χ² = 5 + 0 + 5 = 10, with df = 3 − 1 = 2.
- The p-value is 0.0067, under 0.05 — the observed counts differ significantly from what was expected.
How to Use This Calculator
- Enter the observed frequencies — the counts you actually saw, one per category.
- Enter the expected frequencies in the same order — the counts your hypothesis predicts.
- Click “Run Chi-Square Test” to see χ², the degrees of freedom and the p-value.
- Read the p-value: under 0.05 means the observed counts differ significantly from the expected counts at the 5% level.
Frequently Asked Questions
What does a chi-square goodness of fit test check?
It checks whether the counts you observed across categories match the counts you expected. A large chi-square value with a small p-value means the observed counts differ from the expected counts more than chance alone would explain.
What should the expected frequencies be?
The counts your hypothesis predicts for each category. For a fair die rolled 60 times, each face is expected 10 times. The expected frequencies should usually be at least 5 in each category.
What does the p-value mean here?
It is the probability of seeing a chi-square value at least this large if the observed counts really matched the expected counts. A p-value under 0.05 is usually called statistically significant.
Can expected frequencies be different for each category?
Yes. Expected frequencies do not have to be equal. Enter a different expected count for each category when your hypothesis predicts an uneven split, such as 50%, 30% and 20%.