Chi-Square Calculator
Enter observed and expected frequencies (same count, comma-separated). Expected values must be > 0.
Chi-Square Test — Formula
Goodness-of-fit formula
χ² = Σ (O − E)² / E
df = k − 1 (where k = number of categories)
Example: 4 categories, each expected 25
Observed: 25, 30, 20, 25 → χ² = (0 + 1 + 1 + 0) = 2, df = 3, p ≈ 0.57 (not significant)
Related Calculators
When to Use a Chi-Square Test
The chi-square test checks whether observed data fits an expected distribution, or whether two categorical variables are independent. Use the goodness-of-fit test when you have one variable and want to see if its distribution matches a theoretical one — for example, testing if a die is fair by rolling it 60 times and expecting 10 of each face. Use the test of independence when you have two categorical variables in a contingency table — for example, testing if gender and product preference are related.
Key assumptions: observations must be independent, all expected frequencies should be ≥ 5 (for small samples, use Fisher's exact test instead), and the data must be counts, not percentages.
Interpreting Chi-Square Results
The chi-square statistic (χ²) measures total deviation between observed and expected counts. A larger χ² means a bigger difference. The p-value tells you the probability of seeing a χ² this large if the null hypothesis is true. The standard threshold is p < 0.05 — below that, you reject the null hypothesis.
| p-value | Interpretation |
|---|---|
| p > 0.05 | Fail to reject null — data fits expected distribution |
| p < 0.05 | Reject null at 5% significance — significant difference |
| p < 0.01 | Reject null at 1% significance — strong evidence |
Interpreting Chi-Square Test Results
The chi-square (χ²) statistic measures how much observed frequencies deviate from expected frequencies. A χ² value near 0 means observations match expectations closely. A large χ² value indicates a significant discrepancy. To determine significance, compare your χ² value to the critical value for your chosen significance level (typically α = 0.05) and degrees of freedom (df = number of categories minus 1). If χ² > critical value, reject the null hypothesis — the difference is statistically significant.
The p-value is the probability of observing a χ² value as extreme as yours if the null hypothesis were true. A p-value below 0.05 is conventionally considered statistically significant. For a 2×2 contingency table, df = 1; the critical value at α = 0.05 is 3.841. Common applications include testing whether a die is fair, whether disease rates differ across age groups, and whether survey responses are independent of demographics.
Chi-Square Critical Values (α = 0.05)
| Degrees of Freedom | Critical Value | Reject H₀ if χ² > |
|---|---|---|
| 1 | 3.841 | 3.841 |
| 2 | 5.991 | 5.991 |
| 3 | 7.815 | 7.815 |
| 4 | 9.488 | 9.488 |
| 5 | 11.070 | 11.070 |
| 10 | 18.307 | 18.307 |
