Home » Statistics & Probability Calculators » Chi-Square Test of Independence Calculator

Chi-Square Test of Independence Calculator

Home › Statistics & Probability Calculators › Chi-Square Test of Independence Calculator

Chi-Square Test of Independence Calculator

The chi-square test of independence asks whether two categorical variables are related, using a contingency table of counts: gender by preferred subject, treatment by outcome, region by vote. Type the table with one row per line and the counts separated by commas; tables of any size from 2 × 2 upward are accepted.

The calculator shows the row and column totals, the expected count for every cell (row total × column total ÷ N), each cell’s contribution (O − E)²/E, the χ² statistic with (rows − 1)(columns − 1) degrees of freedom, the p-value and the decision. For 2 × 2 tables Yates’ continuity correction is applied by default, matching R and SciPy; switch it off to match textbooks that omit it. Cramér’s V is reported as an effect size.

As with the goodness-of-fit test, expected counts below 5 make the approximation rough, and the tool flags them. For very small 2 × 2 tables, Fisher’s exact test is the alternative. For a single list of category counts against an expected pattern use the goodness-of-fit calculator.

At least 2 rows and 2 columns of counts.

Result and step-by-step solution

χ²(2) = 11.4286
p = 0.0033
Reject H₀ at α = 0.05. The two variables are associated: the row variable and the column variable are not independent.
  1. State the hypotheses
    H₀: the row and column variables are independent. H₁: they are associated.
  2. Observed counts with totals
    Col 1Col 2Col 3Row total
    Row 130102060
    Row 215252060
    Column total453540120
  3. Expected counts: E = (row total × column total) ÷ N
    Col 1Col 2Col 3
    Row 122.517.520
    Row 222.517.520
  4. (O − E)² ÷ E for each cell
    Col 1Col 2Col 3
    Row 12.53.21430
    Row 22.53.21430
  5. Sum the terms
    χ² = 11.4286, df = (rows − 1)(columns − 1) = (2 − 1)(3 − 1) = 2
  6. p-value
    P(χ²2 ≥ 11.4286) = 0.0033
  7. Decision
    p = 0.0033 < α = 0.05. Critical value = 5.9915.
Cramér’s V (effect size)0.309

Frequently asked questions

How do I enter the contingency table?
One row per line, counts separated by commas or spaces. Enter only the counts, not the row or column totals; the calculator adds those.
What is Yates' continuity correction?
For 2 × 2 tables it subtracts 0.5 from each |O − E| before squaring, making the test more conservative. R and SciPy apply it by default; many introductory textbooks do not.
How do I interpret a significant result?
The two variables are associated: the distribution of one differs across the levels of the other. The test does not say which cells drive the association; compare observed and expected counts to see that.
What is Cramér's V?
An effect size from 0 (no association) to 1 (perfect association) computed from χ², N and the table size. Around 0.1 is small, 0.3 medium and 0.5 large for a 2 × 2 table.

Last reviewed: September 25, 2026. Calculations run in your browser and were validated against SciPy.

Scroll to Top