Chi-Square Test Calculator

Chi-square test of independence for any r × c contingency table with expected counts, Cramér's V and Fisher's exact test for 2 × 2, plus chi-square goodness of fit.

The Chi-Square Calculator tests whether two categorical variables are independent (χ² = Σ(O − E)²/E over a contingency table, df = (r − 1)(c − 1)) or whether observed counts fit expected proportions (goodness of fit, df = k − 1). For 2 × 2 tables it also gives Yates' correction and the exact Fisher p-value.

Free, runs in your browser. Nothing you enter is uploaded.

How to use it

  1. Choose independence or goodness of fit.
  2. Set the table size and enter counts.
  3. Read χ², p and expected counts.
  4. For small counts use the Fisher p-value.

What you enter

What you get

Formula

χ² = Σ (O − E)² / E,   E = (row total × column total) / N

Under independence each cell's expected count is proportional to its row and column totals; large discrepancies inflate χ². The p-value comes from the χ² distribution with (r − 1)(c − 1) degrees of freedom.

Worked example

Input: [[30, 10], [15, 25]]

Result: χ² = 11.43, df = 1, p = 0.0007, Cramér's V = 0.38, Fisher p = 0.0015

Row and column categories are associated; the effect is moderate.

Questions

When should I use Fisher's exact test instead?

For 2 × 2 tables whenever any expected count is below 5, or the total sample is small (under ~40). The calculator shows both so you can compare.

Should I apply Yates' correction?

It makes the 2 × 2 test more conservative. Many statisticians now prefer the uncorrected test or Fisher's exact test; report which you used.

Limitations

References

Related reading

More Statistics

All free tools · By Dr. Zubair Khalid, DVM, MS, PhD.