Statistical Test
Chi-square calculator
How results are checked
Named statistical review pending. Selected automated reference cases are published on the validation page.Result on the example table
4.00χ²
χ²(1, N = 100) = 4.00, p = .046
Cramér’s V = 0.20
ObservedExpected if independent
| Cell | Observed | Expected |
|---|---|---|
| Group A · Yes | 20 | 25 |
| Group A · No | 30 | 25 |
| Group B · Yes | 30 | 25 |
| Group B · No | 20 | 25 |
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.
| Total | |||
|---|---|---|---|
| 50 | |||
| 50 | |||
| Total | 50 | 50 | 100 |
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 ratio | 0.444 (95% CI 0.200–0.989) |
| Cramér's V | 0.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 | -0.200 / -0.200 / -0.200 |
| Theil's U | 0.029 / 0.029 / 0.029 |
Working from a data file? Run every SPSS CROSSTABS statistic (chi-square, Fisher, kappa, McNemar and more) with the SPSS crosstabs statistics guide.
Have a data file? Skip the typing
CSV, Excel, SPSS, Stata, SAS, R, Parquet, JSON, OpenDocument, Arrow/Feather or SQLite. Files are parsed locally before you enter the workspace.
Supported files and requirements
- CSV .csv .tsv .txt
- Excel .xlsx .xlsm .xls .xlsb
- SPSS .sav .zsav .por
- Stata .dta
- SAS .sas7bdat .xpt
- R .rds .rdata .rda
- Parquet .parquet
- JSON .json .jsonl .ndjson
- OpenDocument .ods .fods
- Arrow/Feather .arrow .feather .ipc
- SQLite .sqlite .sqlite3 .db
Optional: a matching Qualtrics .qsf file adds question wording.
Use one row per respondent's answers.
Or try a realistic sample
The test
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
Use it when
- Use: Both variables are categorical (nominal or ordinal).
- Use: You have a sufficiently large sample — at least 5 expected observations in each cell. If not, use Fisher's exact test instead.
- Use: Observations are independent (each participant contributes to only one cell).
- Use: You want to test association, not direction or strength.
Not the right tool when
- Avoid: For small samples or sparse tables, consider the Fisher's exact test instead.
The method
Formula
χ² = ∑ (O − E)² / E
where
- O
- observed cell frequency
- E
- expected cell frequency = (row total × column total) / grand total
- df
- (rows − 1) × (columns − 1)
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.
Using it well
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.
Questions
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.
Sources and next steps
References & further reading
- [1]Pearson, K. (1900). On the criterion that a given system of deviations…
- [2]Chi-squared test — Wikipediaen.wikipedia.org