Chi-Square Test Calculator
Test whether two categorical variables are associated. Paste your contingency table to get the Pearson chi-square, degrees of freedom, exact p-value, and Cramér's V — plus Yates' correction and Fisher's exact test for 2×2 tables.
Planning the study instead? Size it with our Sample Size Calculator and Margin of Error Calculator.
Contingency Table
Pearson Chi-Square
Enter a contingency table to test for association
Methodology
Pearson Chi-Square:
χ² = Σ (O − E)² / ECramér's V:
V = √( χ² / (N · (min(r,c) − 1)) )Expected counts E_ij = (row total × column total) / N. Degrees of freedom = (rows − 1)(columns − 1). The p-value is the upper-tail probability of the chi-square distribution.
2×2 tables additionally report Yates' continuity correction and Fisher's exact test (two-sided), which is preferred when expected counts are small.
Assumptions: independent observations, mutually exclusive categories, and adequate expected frequencies. As a rule of thumb (Cochran, 1954), no more than 20% of cells should have an expected count below 5, and none below 1.
Effect size (Cohen, 1988): for df* = min(r,c) − 1 = 1, Cramér's V ≈ 0.10 small, 0.30 medium, 0.50 large (thresholds scale by 1/√df*).
Built by Lensym — focused on valid, reliable survey research.
Understanding the Chi-Square Test of Independence
The chi-square test of independence is the most common way to analyze the relationship between two categorical survey questions — for example, whether response to a question differs by group. It compares the counts you observed with the counts you would expect if the two variables were unrelated.
When to Use This Calculator
- Comparing categorical responses across groups (e.g., region × preference)
- Testing associations in cross-tabulated survey data
- Analyzing experiment outcomes with categorical results
- Checking independence in any two-way frequency table
Significance vs. Effect Size
A significant p-value tells you an association is unlikely to be due to chance, but not how strong it is. With large samples even trivial associations become significant. Always pair the p-value with an effect size — Cramér's V here — to describe the practical strength of the relationship.
Small Samples
When expected counts are small, the chi-square approximation is unreliable. For 2×2 tables this calculator reports Fisher's exact test, which is valid regardless of sample size. For larger tables, consider combining sparse categories.
For broader context on analyzing survey responses, see our guide on how to analyze survey data.
Frequently Asked Questions
What does a chi-square test of independence tell you?
It tests whether two categorical variables are associated (related) or independent. The null hypothesis is that the variables are independent — that the distribution of one does not depend on the other. A small p-value (typically < 0.05) is evidence of an association. The test does not tell you the direction or strength of the relationship, which is why you also report an effect size like Cramér’s V.
When should I use Fisher’s exact test instead?
Use Fisher’s exact test for 2×2 tables when expected cell counts are small (a common rule is any expected count below 5). The chi-square test relies on a large-sample approximation that breaks down with sparse data, whereas Fisher’s exact test computes the exact probability. This calculator reports Fisher’s exact (two-sided) automatically for 2×2 tables.
What is Yates’ continuity correction?
Yates’ correction subtracts 0.5 from each |O − E| before squaring in 2×2 tables. It makes the discrete chi-square statistic better approximate the continuous chi-square distribution, producing a more conservative (larger) p-value. It applies only to 2×2 tables and is shown automatically for them. Many statisticians now prefer Fisher’s exact test over Yates’ correction for small samples.
How do I interpret Cramér’s V?
Cramér’s V is a chi-square-based effect size ranging from 0 (no association) to 1 (perfect association). For tables where the smaller dimension minus one equals 1, Cohen (1988) suggests roughly 0.10 = small, 0.30 = medium, 0.50 = large. For larger tables, these thresholds scale down by 1/√(min(rows, cols) − 1), which this calculator accounts for.
What assumptions does the chi-square test make?
Observations must be independent, categories mutually exclusive, and the data must be raw counts (not percentages or averages). Expected frequencies should be adequate: a widely used guideline (Cochran, 1954) is that no more than 20% of cells have expected counts below 5 and none below 1. When these conditions fail, combine categories or use an exact test.
Can I paste data straight from SPSS or Excel?
Yes. Copy the cell counts of your crosstab (just the counts, without row/column totals) and paste them in. The calculator auto-detects commas, tabs, and semicolons, so values copied from Excel or a CSV export work directly. Results match SPSS’s Crosstabs chi-square output.