Chi-Square Calculator

Run a chi-square test of independence on a contingency table or a goodness-of-fit test on one row of counts. The calculator shows the expected counts, each (O − E)²/E contribution, χ², the degrees of freedom and the p-value.

χ²
11.21
p-value
0.0037
df
2
At α = 0.05
Significant
Observed (expected) counts
Col 1Col 2Col 3Total
Row 148 (50)35 (40)17 (10)100
Row 252 (50)45 (40)3 (10)100
Total1008020200

Cells show observed (expected) counts.

Step-by-step working

  1. Expected count for each cell = row total × column total ÷ grand total50 40 10 50 40 10
  2. For each cell compute (O − E)² ÷ E0.08 0.625 4.9 0.08 0.625 4.9
  3. Add them upχ² = 11.21
  4. Degrees of freedom = (rows − 1)(columns − 1)df = 2
  5. p-value = area to the right of χ² on the chi-square curvep = 0.0037

Formula χ² = Σ (O − E)² ÷ E independence: E = row total × column total ÷ grand total

Ask the tutor about your result

An AI tutor reads your inputs and results above and explains them in plain English. The numbers come from the calculator; the explanation is AI-written, so check it against your notes.

Test of independence

Asks whether two categorical variables are related, for example study habit (rows) and pass/fail (columns). If they were independent, each cell’s expected count would be row total × column total ÷ grand total. Large gaps between observed and expected counts give a large χ² and a small p-value. Degrees of freedom = (rows − 1)(columns − 1).

Goodness of fit

Asks whether one set of counts matches expected proportions: is a die fair (all six faces equal)? Do M&M colours match the company’s stated mix? Enter the observed counts and, optionally, the expected counts or proportions. Degrees of freedom = categories − 1.

The test needs counts (not percentages or means), independent observations, and expected counts of at least 5 in each cell.

Frequently asked questions

Can I enter percentages?

Not as observed values: chi-square needs actual counts. You can give expected values as proportions or percentages in the goodness-of-fit test; they are scaled to your total.

Is the chi-square test one-tailed?

Yes, it is right-tailed: only large values of χ² count as evidence against the null hypothesis.