Chi-Square Calculator

Test observed counts against expected ones, or check whether two categorical variables are related, with expected counts shown cell by cell.

Separate columns with spaces or tabs. Paste straight from a spreadsheet.

χ²
9.8438
p-value
0.0073

Significant at α = 0.05 with 2 degrees of freedom. The variables appear to be associated.

Cramér’s V = 0.265

Observed, expected and contribution to χ²

Col 1Col 2Col 3Row total
Row 120 (E 21.43; 0.095)15 (E 21.43; 1.929)25 (E 17.14; 3.601)60
Row 230 (E 28.57; 0.071)35 (E 28.57; 1.446)15 (E 22.86; 2.701)80
Total505040140

Cells with the largest (O − E)²/E contribute most to the result and show where the pattern departs from expectation.

Explain my result

An AI tutor reads your numbers and explains what they mean in plain words. Sends only the inputs and results shown above.

Chi-square formula

χ² = Σ (O − E)² ÷ E

Each cell compares what you observed with what the null hypothesis predicts. Squaring and dividing by E makes a difference of 10 matter more in a cell expecting 20 than in one expecting 2,000. The total is compared with a chi-square distribution with the appropriate degrees of freedom to get the p-value; you can also convert any χ² value with the p-value calculator.

Frequently asked questions

What is the difference between goodness of fit and a test of independence?

Goodness of fit compares one categorical variable’s counts with a set of expected proportions, such as checking whether a die is fair. A test of independence uses a two-way table to check whether two categorical variables are associated, such as whether preferred study method differs by year group.

How are expected counts calculated?

For independence: expected = row total × column total ÷ grand total. For goodness of fit: expected = total count × the hypothesised proportion for that category.

What if some expected counts are below 5?

The chi-square approximation becomes unreliable. The usual rule (from W. G. Cochran) is that no expected count should be below 1 and no more than 20% below 5. Combine sparse categories, collect more data, or use Fisher’s exact test for 2×2 tables.

Can I enter percentages instead of counts?

Observed values must be raw counts, never percentages, because the test depends on sample size. Expected values for goodness of fit can be proportions or counts; they are rescaled to the observed total.

What is Cramér’s V?

An effect size for a test of independence, from 0 (no association) to 1 (perfect association). A significant χ² in a huge sample can have a tiny V, meaning the association is real but weak.