Chi-Square Test of Independence Calculator
Enter an r×c contingency table of counts to run Pearson's chi-square test of independence with expected frequencies, residuals, Cramér's V, and a right-tail p-value.
Paste a table of counts, one row per line, the counts separated by tabs, commas or spaces. The grid takes the size of the paste, from 2×2 up to 10×10:
Related Calculators
Cramér's V Calculator
Cramér's V, bias-corrected V, phi, Tschuprow's T and the contingency coefficient for any 2×2 to 10×10 table, with the chi-square p-value and Cohen's size label.
Chi-Square Goodness of Fit Calculator
Test whether observed category counts match expected proportions or counts with χ², df, residuals, and p-value.
Fisher's Exact Test Calculator
Exact two-sided and one-sided p-values for 2×2 tables via the hypergeometric distribution, with odds ratio.
Learn More
Chi-Square Test in Excel: CHISQ.TEST Step by Step
Run a chi-square test of independence or goodness of fit in Excel: expected counts, CHISQ.TEST, cell contributions, Cramér's V and a checked 2×3 example.
How to Read a Chi-Square Table
Find the chi-square critical value from the degrees of freedom and significance level, with a table of common values, three worked examples and software equivalents.
Hypotheses
H0: The two variables are independent (no association). Ha: They are not independent. The test statistic is χ² = Σ (O − E)² / E with df = (r − 1)(c − 1).
χ² = Σ (O − E)² / E
E_{ij} = (row total × column total) / N
df = (r − 1)(c − 1)
Worked example (matches Load example)
Table: rows [12, 8, 4] and [6, 9, 7]. N = 46, df = 2, χ² ≈ 2.795, p ≈ 0.247, Cramér's V ≈ 0.247 (the bias-corrected V, from the Cramér's V calculator, is 0.129). The p-value is above 0.05, so we do not reject independence at α = 0.05.
Software equivalents
- Excel: CHISQ.TEST(actual_range, expected_range)
- R: chisq.test(matrix, correct = FALSE)
- Python: scipy.stats.chi2_contingency(obs, correction=False)
Related guides and calculators
When expected counts are small use Fisher's exact test, and for paired yes/no data the McNemar test. To measure the strength of an association in a table of any size use the Cramér's V calculator, which also gives the bias-corrected V, phi and Tschuprow's T; in a 2×2 table see also the odds ratio and relative risk calculators and relative risk vs odds ratio; to test one variable against expected proportions use the chi-square goodness of fit test. The chi-square test explained and chi-square test in Excel guides show the working.
Frequently Asked Questions
What is the chi-square test of independence?
It tests whether two categorical variables are related in a contingency table by comparing observed counts to counts expected if the variables were independent.
How are expected counts calculated?
For each cell, expected = (row total × column total) / grand total, assuming row and column margins are fixed.
When should I use Fisher's exact test instead?
For 2×2 tables with small expected counts (often any expected < 5), Fisher's exact test is preferred because the chi-square approximation is unreliable.
What does Cramér's V measure?
Cramér's V is an effect size between 0 and 1 for the strength of association after a significant chi-square test; larger values mean a stronger relationship.
Do standardized residuals show which cells differ?
Yes. Large positive or negative standardized residuals flag cells that contribute most to the chi-square statistic compared with independence.
What is the 80% rule for expected counts?
Guidelines suggest all expected counts should be at least 5, and no more than 20% of cells should have expected counts below 5.
How do I run this in Python?
Use scipy.stats.chi2_contingency(table, correction=False) for Pearson's chi-square; set lambda_='log-likelihood' for the G statistic.
What are the degrees of freedom?
For an r×c table, df = (r − 1)(c − 1).
Embed This Calculator
Add this free calculator to your course page or LMS.
Adjust the height value to fit your page.