Chi-Square Test Calculator (Independence and Goodness of Fit)
Run a chi-square test on a table of counts, with expected counts, residuals and an APA sentence.
Two chi-square tests
- Test of independence: are two categorical variables related? Enter a table of counts, with one row per category of one variable and one column per category of the other. For example, rows could be groups and columns could be responses.
- Goodness of fit: do observed counts match an expected pattern? Enter the observed counts, and either leave the expected box empty for equal frequencies or enter the expected counts or proportions.
Worked example: test of independence
A survey asked 140 people whether they preferred option A, B or C, split by two groups. The counts are 20, 15, 30 in the first row and 25, 30, 20 in the second. Expected counts come from the totals: (row total × column total) ÷ grand total. The result is χ²(2, N = 140) = 6.88, p = .032, Cramér’s V = 0.22, so there is a significant association of small to moderate strength.
Worked example: goodness of fit
A die-like spinner landed on four colours 18, 22, 29 and 31 times in 100 spins. If it is fair, each colour is expected 25 times. χ²(3, N = 100) = 4.40, p = .221, so there is no evidence that the spinner is unfair.
Formulas and conditions
- χ² = Σ (O − E)² ÷ E, with E the expected count in each cell.
- Degrees of freedom: (rows − 1) × (columns − 1) for independence, and categories − 1 for goodness of fit.
- Expected counts should be at least 5 in most cells. The calculator warns you if not, and for a small 2 × 2 table Fisher’s exact test may be better.
- For a 2 × 2 table, the Yates continuity correction can be switched on. It makes the test more conservative.
- Cramér’s V measures the strength of the association from 0 to 1. For 2 × 2 tables, about 0.1 is small, 0.3 medium and 0.5 large.
The standardized residuals table shows which cells differ most from expectation: values beyond about ±2 stand out. For critical values, see the chi-square table.
How to cite this page
CalcPulse. (2026). Chi-Square Test Calculator. https://calcpulse.com/chi-square-test-calculator/
Frequently asked questions
What is a chi-square test of independence?
A test of whether two categorical variables are associated, using a table of counts.
What are expected counts?
The counts you would see in each cell if the variables were independent. They are (row total × column total) ÷ grand total.
What if some expected counts are below 5?
The chi-square approximation becomes unreliable. Combine categories, collect more data, or use Fisher's exact test for a small 2 × 2 table.
What is the difference between independence and goodness of fit?
Independence uses a two-way table to test a relationship between two variables. Goodness of fit uses one set of counts to test them against an expected pattern.
How do I read Cramér's V?
It runs from 0 (no association) to 1 (perfect association). It is not affected by the sample size, so it tells you how strong an association is, not just whether it exists.
Last updated