Statistical Test

Chi-Square Calculator

Test whether two categorical variables are independent. Open your data file and calculate the chi-square statistic, p-value, and effect size without writing formulas.

Calculate online — no file needed

Type or paste your observed counts. Results update live, and the link in your address bar always reproduces this exact table.

Table sizeTip: paste a block of counts straight from a spreadsheet.
Total
50
50
Total5050100

Chi-square (χ²)

4.00

df = 1 · p = .046 · Cramér's V = 0.20

χ²(1, N = 100) = 4.00, p = .046, V = .20

All statistics
Pearson chi-squareχ² = 4.000, df = 1, p = .046
G-test (likelihood ratio)G = 4.027, df = 1, p = .045
Chi-square with Yates' correctionχ² = 3.240, p = .072
Fisher's exact test (two-sided)p = .071
Odds ratio0.444 (95% CI 0.200 – 0.989)
Cramér's V0.200 (small)
Phi coefficient (φ)-0.200
Contingency coefficient (C)0.196
Lambda (symmetric / row|col / col|row)0.200 / 0.200 / 0.200
Goodman–Kruskal gamma (γ)-0.385
Kendall's tau-b / tau-c-0.200 / -0.200
Somers' d (symmetric / row|col / col|row)-0.200 / -0.200 / -0.200
Theil's U (symmetric / row|col / col|row)0.029 / 0.029 / 0.029

Have a data file? Skip the typing

CSV or XLSX. Files are parsed locally before you enter the workspace.

Drop your spreadsheet here

CSV, XLSX, or SPSS .sav · up to 50 MB

Reviewed by the crosstabs.com methods team · Last updated

What is the chi-square test?

The chi-square (χ²) test of independence determines whether there is a statistically significant association between two categorical variables. It compares the frequencies you actually observe in your data against the frequencies you would expect if the two variables were completely unrelated.

Developed by Karl Pearson in 1900, it remains one of the most widely used tests in social science, market research, and epidemiology. If you've ever asked “does product preference vary by age group?” or “is smoking status related to disease outcome?” you need a chi-square test.

The test produces a p-value: if p < 0.05 (the conventional threshold), you reject the null hypothesis and conclude the variables are not independent. But statistical significance alone doesn't tell you how strong the relationship is — that's what Cramér's V is for.

When to use it

  • Both variables are categorical (nominal or ordinal).
  • You have a sufficiently large sample — at least 5 expected observations in each cell. If not, use Fisher's exact test instead.
  • Observations are independent (each participant contributes to only one cell).
  • You want to test association, not direction or strength.

For small samples or sparse tables, consider the Fisher's exact test instead.

Formula

Pearson chi-square statistic

χ² = ∑ (O − E)² / E

O = observed cell frequency

E = expected cell frequency = (row total × column total) / grand total

df = (rows − 1) × (columns − 1)

Worked example

Worked example

Take the 2×2 table [[20, 30], [30, 20]] with a grand total of n = 100. Every row and column total is 50, so each expected count is (50 × 50) / 100 = 25.

Plug the four cells into χ² = ∑ (O − E)² / E:
(20 − 25)² / 25 = 25 / 25 = 1
(30 − 25)² / 25 = 25 / 25 = 1
(30 − 25)² / 25 = 25 / 25 = 1
(20 − 25)² / 25 = 25 / 25 = 1

Summing the four terms gives χ² = 4 × (25 / 25) = 4.00, with df = (2 − 1) × (2 − 1) = 1. That yields p = 0.0455 — just significant at the 0.05 threshold.

The effect size Cramér's V = √(χ² / n) = √(4 / 100) = 0.20, a small association.

Interpreting the results

p > 0.05

Not significant

Insufficient evidence to conclude an association exists. The pattern may be due to chance.

p ≤ 0.05

Significant

The association is unlikely to be due to chance. Report the effect size to convey its magnitude.

p ≤ 0.001

Highly significant

Very strong evidence of an association. Still check effect size — it may be trivially small with a large dataset.

Always pair the chi-square p-value with an effect size such as Cramér's V. A large dataset can produce a significant p-value even for a negligibly small association.

Frequently asked questions

How do you interpret the chi-square test of independence?
If the p-value is below 0.05 you reject independence and conclude the two categorical variables are associated. The test only tells you whether an association exists, not how strong it is — report an effect size such as Cramér's V for that.
What does the chi-square p-value mean?
It is the probability of seeing an association at least as strong as yours if the two variables were truly independent. A small p-value (typically < 0.05) means the observed pattern is unlikely under independence.
What is the difference between chi-square and Cramér's V?
The chi-square test gives a yes/no answer about whether an association is statistically significant; Cramér's V rescales the same chi-square into an effect size from 0 to 1 that measures how strong the association is.

References & further reading

Related calculators