Chi-square test calculator

Test whether two categorical variables are related, or whether counts match an expected distribution. Tables up to 6 × 6.

Test
C1C2
R1
R2
χ² = 6.72df = 1
p = .010. The variables are associated (reject independence).
your statistic
N
120
φ (phi)
0.237
Expected < 5
0% of cells
Expected counts (adjusted residuals)
35 (2.59)25 (-2.59)
35 (-2.59)25 (2.59)

χ²(1, N = 120) = 6.72, p = .010, φ = 0.24

Write up this chi-square test

An APA-style paragraph from the table and results above, including which cells drive the association.

Uses an AI model via Vercel AI Gateway. It only sees what you send here; check anything you publish.

How the chi-square statistic is built

For each cell, the calculator takes (observed − expected)² ÷ expected and adds them up. Large values mean the observed table is far from what independence predicts. Under H₀ the sum follows a χ² distribution with (rows − 1)(columns − 1) degrees of freedom (k − 1 for goodness of fit).

A significant result says the variables are associated, not where. The adjusted standardised residuals (Agresti, 2013) answer that: cells beyond ±1.96 contribute notably, highlighted in the table above.

Effect size

φ (2 × 2) and Cramér's V range from 0 to 1. Cohen's rough guides for df* = 1 are .10 small, .30 medium, .50 large; for larger tables the thresholds shrink. Use Cohen's w with the power analysis calculator to plan a chi-square study.

Frequently asked questions

When do I use a chi-square test of independence?

When both variables are categorical and you have counts of cases in each combination, for example treatment group × recovered (yes/no). It tests whether the distribution of one variable differs across levels of the other.

What are the expected counts?

The counts you would see if the variables were unrelated: row total × column total ÷ grand total. The test compares observed with expected counts.

What if some expected counts are below 5?

The chi-square approximation becomes unreliable when more than 20% of expected counts are below 5 or any is below 1 (Cochran, 1954). For a 2 × 2 table use Fisher’s exact test; for larger tables combine sparse categories.

How do I report it?

χ²(df, N = total) = value, p = value, with an effect size: φ for 2 × 2 tables or Cramér’s V otherwise. Example: χ²(1, N = 200) = 6.12, p = .013, φ = .17.