Chi-Square Test Calculator
Run a chi-square test of independence on a contingency table, or a goodness-of-fit test on counts.
About the Chi-Square Test Calculator
The chi-square test compares observed counts with the counts you'd expect if there were no relationship (independence) or if a stated distribution held (goodness of fit). Large differences give a large χ² and a small p-value.
The formula
χ² = Σ (Observed − Expected)² ÷ Expected
- Expected (table)
- row total × column total ÷ grand total
- df
- (rows − 1)(columns − 1), or categories − 1
Worked example
Example: p-value = 0.025347
- Inputs: Test: Independence (table); Observed counts: 25 15; 15 25.
- Formula: χ² = Σ (Observed − Expected)² ÷ Expected
- Result: p-value = 0.025347
- χ²: 5
- df: 1
- Cramér's V (strength): 0.25
Things to keep in mind
- Expected counts should be at least 5 in most cells; otherwise use Fisher's exact test.
Questions people ask
Can I use percentages?
No, use raw counts. Percentages hide the sample size.
What does Cramér's V mean?
Effect size from 0 (no association) to 1 (perfect association).