Chi-Square Calculator
Run a chi-square test for independence on a contingency table or a goodness-of-fit test on observed vs. expected counts. Returns the statistic, p-value, critical values, and a significance verdict.
Chi-square test
Chi-square statistic
4.5
df = 1 ยท p-value = 0.0339
Critical (a = 0.05)
3.8415
Critical (a = 0.01)
6.6349
Significant at the 0.05 level. Reject the null hypothesis.
Expected counts under independence
| 25 | 25 |
| 20 | 20 |
Frequently Asked Questions about the Chi-Square Calculator
What is the difference between the independence test and goodness-of-fit?
The independence test asks whether two categorical variables in a contingency table are related (for example, gender and product preference). Goodness-of-fit asks whether a single set of observed counts matches a hypothesized distribution (for example, whether a die rolled 600 times is fair). Both use the same chi-square formula but differ in how expected counts are derived.
How are expected values calculated for independence?
For each cell, expected = (row total times column total) divided by the grand total. This is the count you would see if the row and column variables were truly independent. The calculator shows the full expected table beneath your input so you can compare it cell-by-cell with the observed counts.
What does the p-value mean?
The p-value is the probability of seeing a chi-square statistic at least as large as the one you got, assuming the null hypothesis is true. A small p-value (typically below 0.05) means the observed pattern would be unlikely under the null, so you reject the null and conclude the variables are related or the distribution does not fit.
How do I read the critical values at 0.05 and 0.01?
If your chi-square statistic is greater than the critical value at alpha 0.05, the result is significant at that level. The same logic applies for 0.01, which is a stricter threshold. The critical values depend only on the degrees of freedom and come from the chi-square distribution table.
How are degrees of freedom calculated?
For the independence test, df equals (rows minus 1) times (columns minus 1). For goodness-of-fit, df equals the number of categories minus 1 (subtract more if you estimated parameters from the data). Degrees of freedom set the shape of the chi-square distribution, which in turn fixes the p-value and critical values.