Skip to content

Chi-Square Test Calculator

Type your counts into the table, or paste one from a spreadsheet…

Type your counts into the table, or paste one from a spreadsheet, to test whether the rows and columns are related, with each cell’s expected count beside it.

exp 43.5

exp 26.6

exp 21.9

exp 47.2

exp 29

exp 23.8

exp 46.3

exp 28.4

exp 23.3

RowsColumns3 × 3 · names are editable
Paste a table from a spreadsheet

Copy cells from Excel, Google Sheets or a CSV file and paste them here; the grid above follows.

ExampleP-value

4.81 × 10⁻⁸

The rows and columns look related. The biggest gap is 50 and over, Print or TV: 41 counted where 23.3 were expected. Significant at the 5% level (p < 0.05).

Type your own counts, or paste a table.

624827Phone213330Computer91941Print or …18 to 2930 to 4950 and overmore than expectedfewerif unrelated

Each column is as wide as its total and split by the rows. Tiles above or below a dashed line hold more or fewer than independence predicts.

The chi-square distribution with 4 df, what χ² looks like when nothing is going on; the shaded tail beyond yours is the p-value.

χ², df
39.7784, 4
Cramér’s V
0.262
Expected counts under 5
None
How this works: 9 sources,

How this works

Method

The chi-square test of independence asks whether two ways of sorting the same people are related: age group and where people read the news, treatment and outcome, region and preferred product. The table of counts goes in; the question is whether the rows split the same way in every column. In the example, 67% of 18 to 29 year olds read news mostly on a phone against 28% of those over 50. Full method

How it’s tested

2 worked examples for this page are checked by automated tests before every release: given the inputs, the tool must show the expected answer.

Privacy

On your device. Nothing you enter or open leaves this browser. About privacy labels

Changes

  • First published: live curves with draggable cut-offs, and tests on pasted data (t-tests, ANOVA, chi-square, Fisher’s exact, correlation, regression, A/B), checked against SciPy.

Every change on What’s new

How we make toolsReport a mistake

How the chi-square test of independence works

The chi-square test of independence asks whether two ways of sorting the same people are related: age group and where people read the news, treatment and outcome, region and preferred product. The table of counts goes in; the question is whether the rows split the same way in every column. In the example, 67% of 18 to 29 year olds read news mostly on a phone against 28% of those over 50.

If the two were unrelated, each cell would hold its row total times its column total divided by the grand total: the expected count shown under every cell. The statistic adds up (observed − expected)² ÷ expected over all cells and is compared with a chi-square distribution with (rows − 1) × (columns − 1) degrees of freedom. Here χ² is about 40 on 4 df, far beyond the 9.49 a 5% test needs.

The approximation needs enough data in each cell. The usual rule, from Cochran, is that no more than 20% of the expected counts should be under 5 and none under 1; the grid flags small ones. For a 2 × 2 table with small counts, Fisher’s exact test is the better choice. Cramér’s V gives the strength of the association on a 0 to 1 scale, since χ² grows with the sample size.

Eᵢⱼ = Rᵢ × Cⱼ ÷ N · χ² = Σ (Oᵢⱼ − Eᵢⱼ)² ÷ Eᵢⱼ, df = (r − 1)(c − 1)

Critical χ² values by table size

The chi-square statistic a test of independence must exceed for p < 0.05 and p < 0.01, by the shape of the table.

The chi-square statistic a test of independence must exceed for p < 0.05 and p < 0.01, by the shape of the table.
Tabledfχ² (5%)χ² (1%)
2 × 213.8416.635
2 × 325.9919.21
2 × 437.81511.345
3 × 349.48813.277
2 × 549.48813.277
3 × 4612.59216.812
4 × 4916.91921.666
3 × 5815.50720.09
4 × 51221.02626.217
5 × 51626.29632
Show all 12 rows
5 × 62031.4137.566
6 × 62537.65244.314

Common questions

Can I use percentages instead of counts?

No. The test needs the actual counts: 60% of 10 people and 60% of 1,000 people say very different things. Convert percentages back to counts with the number of people in each group.

Should I use Yates’ continuity correction?

For a 2 × 2 table, R’s chisq.test and SciPy apply it by default and it makes the test more cautious. Many statisticians now prefer no correction, or Fisher’s exact test when counts are small. This page shows both and lets you choose under More options.

The test is significant. Which cells cause it?

Look at the mosaic plot: tiles far above or below their dashed line, shaded darkest, are the cells furthest from independence. The worked example also lists each cell’s share of χ².