Chi-Square Test Calculator

Free chi-square test of independence calculator: paste a contingency table and get the chi-square statistic, degrees of freedom, p-value and expected counts. Matches R’s chisq.test.

Paste a contingency table (rows of counts, one row per line) to test whether two categorical variables are associated. You get the chi-square statistic, degrees of freedom, p-value and the expected counts — matching R’s chisq.test().

How to use it

What it tests

The chi-square test of independence compares the observed counts in your table to the counts you’d expect if the two variables were unrelated. A large chi-square (small p) means the variables are associated.

  • Degrees of freedom = (rows − 1) × (columns − 1).
  • The test needs reasonably large expected counts. A common rule: if any expected count is below 5, the approximation gets shaky — switch to Fisher’s exact test. This calculator warns you when that happens.
  • A significant result says an association exists, not how strong it is. For strength, report an effect size such as Cramér’s V.

Do it in R

tab <- matrix(c(90, 60, 30, 120), nrow = 2, byrow = TRUE)
chisq.test(tab)             # chi-square test
chisq.test(tab)$expected    # expected counts
fisher.test(tab)            # exact alternative for small counts

See the full walkthrough: Chi-square test of independence in R.

FAQ

Frequently asked questions

When should I use Fisher’s exact test instead?

When any expected cell count is small (a common threshold is below 5). Fisher’s exact test doesn’t rely on the large-sample approximation, so it’s the safer choice for small tables.

Does R apply a continuity correction?

For 2×2 tables, chisq.test() applies Yates’ continuity correction by default (correct = TRUE). This calculator reports the uncorrected statistic; use correct = FALSE in R to match it exactly.


A single table is rarely the whole story. When you need modelling and a written report, that’s our work.