Statistics & probability

Contingency table chi-square test

Compare two categorical variables using an observed count table.

Contingency table chi-square test
Esc to restore

Your inputs

Use the example headings. UTF-8 CSV/TSV files stay on this device; maximum 25 MB.

Up to 25 MB per file, 50,000 data rows, 200 columns and 2 million data cells. Fully blank rows and columns are ignored before row, column and cell limits are checked. Individual tools may have smaller result or chart limits.

Results update as you type. Larger files run when you press Update result.

Your result

LOCAL & PRIVATE

Your result will appear here.

Your inputs stay in this browser. Nothing is uploaded or saved.

A clear answer. Here’s how.

First column supplies unique row labels; remaining column headers name categories. Counts must be whole and non-negative, with positive row/column totals. Computes expected counts from marginal totals, Pearson chi-square, df=(rows−1)(columns−1) and Cramér’s V. Uses an asymptotic p-value without Yates correction or an exact test; flags expected counts below 5. Assumes independent observations.

See a worked example

Worked example

A fixed demonstration, separate from the values you enter above.

CSV count table: first column contains row labels
Group,Yes,No
A,30,20
B,20,30

Example result

Example result
RowColumnObservedExpectedContribution
AYes30251
ANo20251
BYes20251
BNo30251

df 1; asymptotic p-value 0.0455002638964; Cramér’s V 0.2. No expected count below 5. No Yates correction.