Calculate chi-square statistics, p-values, and test significance instantly
Open Chi-Square CalculatorThe chi-square (X²) test is a statistical test used to determine if there is a significant association between two categorical variables. It compares observed frequencies in a contingency table to the frequencies we would expect if there were no association.
Where O = observed frequency and E = expected frequency
For a full discussion of each assumption and what to do when they're violated, see the Assumptions guide.
A researcher wants to test if there's an association between smoking status and lung disease. They collect data from 200 patients:
Using CrossTabs.com, upload your data and select the row and column variables. The calculator instantly provides X², degrees of freedom, and p-value.
P-value < 0.05: There is a statistically significant association between the variables (reject null hypothesis)
P-value ≥ 0.05: No significant association found (fail to reject null hypothesis)
For a detailed step-by-step interpretation workflow, see Interpreting Results.
CrossTabs.com automatically calculates effect sizes. Learn more about bias-corrected Cramér's V and all available effect size measures:
CrossTabs.com offers a full-featured free chi-square calculator online:
Suppose you're testing whether a new drug is associated with recovery. You survey 120 patients. (For the full mathematical derivation, see the Chi-Square Test documentation.)
| Recovered | Not Recovered | Total | |
|---|---|---|---|
| Drug | 40 | 20 | 60 |
| Placebo | 25 | 35 | 60 |
| Total | 65 | 55 | 120 |
Step 1: Calculate expected frequencies. For the Drug + Recovered cell: E = (60 × 65) / 120 = 32.5. Repeat for all cells.
Step 2: Compute χ². χ² = (40−32.5)²/32.5 + (20−27.5)²/27.5 + (25−32.5)²/32.5 + (35−27.5)²/27.5 = 1.73 + 2.05 + 1.73 + 2.05 = 7.56
Step 3: Find the p-value. With df = 1, χ² = 7.56 gives p = 0.006. Since p < 0.05, the association is statistically significant.
Step 4: Report effect size. Cramér's V = √(7.56/120) = 0.25 (small-to-medium effect).
| Your Data | Recommended Test |
|---|---|
| Two categorical variables, all expected counts ≥ 5 | Chi-square test (this calculator) |
| Any expected count < 5 or small sample | Fisher's exact test |
| Paired/matched categorical data | McNemar's test |
| Need to quantify the strength of association | Cramér's V or odds ratio |
| Ordinal categories | Gamma or Kendall's tau |
| Need to determine sample size before collecting data | Power analysis |
A p-value less than 0.05 is the conventional threshold for statistical significance. However, you should also report the effect size (such as Cramér's V) because large samples can produce significant p-values even for trivially small associations.
Degrees of freedom (df) for a chi-square test of independence equal (number of rows − 1) × (number of columns − 1). For a 2×2 table, df = 1. For a 3×4 table, df = 6.
Chi-square uses a large-sample approximation to calculate p-values, while Fisher's exact test computes the exact probability. Use Fisher's exact test when any expected cell count is below 5 or the total sample size is less than 20. See the assumptions guide for details.