Statistics & Probability

Chi-Square Test Calculator

Chi-square test of independence for a contingency table, or goodness of fit to given proportions.

Tool no.
ECT-P09
Rev
1.0
Updated
Oct 2026
Method
Pearson chi-square
Examples

Given

Columns separated by spaces or tabs; paste a table from a spreadsheet.

Answers

Chi-square statistic =—
Runs in your browser. Nothing you enter is uploaded.Chi-square tests
How to use this calculator

For independence, type the table of observed counts with one row per line. For goodness of fit, give the observed counts and either the hypothesized proportions (adding to 1) or the expected counts.

Formulas

Statisticχ²0 = Σ(O − E)²/E
IndependenceEij = (row total)(column total)/n, df = (r − 1)(c − 1)
Goodness of fitEi = npi, df = k − 1 − (parameters estimated)

Worked example

Is the column variable independent of the row variable for the table 20 30 50 / 40 30 30? (the default)

  1. Row totals 100 and 100, column totals 60, 60, 80, n = 200; E = 30, 30, 40 in each row.
  2. χ²0 = 10/3 + 0 + 2.5 + 10/3 + 0 + 2.5 = 11.67 with df = 2.
  3. P = 0.0029 < 0.05: reject independence.

Frequently asked questions

What if expected counts are small?

The test needs most expected counts of at least 5. Combine sparse categories, or use Fisher’s exact test for 2 × 2 tables.

Is there a continuity correction?

This calculator doesn’t apply Yates’ correction; most engineering statistics texts don’t for tables larger than 2 × 2.