Chi-Square Test Calculator
Test whether two categorical variables are related — the chi-square test of independence on a 2×2 table, with the expected counts and effect size.
Under independence, the expected count in each cell is (row total × column total) ÷ grand total.
How the chi-square test calculator works
Under independence, the expected count in each cell is (row total × column total) ÷ grand total. Chi-square sums (observed − expected)² ÷ expected across the cells; a large value means the observed pattern is hard to explain by chance.
The test needs expected counts of at least 5 in every cell. Below that, use Fisher's exact test instead — the chi-square approximation stops being trustworthy.
Formula: χ² = Σ (O − E)² / E, df = (rows − 1)(cols − 1)
Worked examples
| Inputs | Chi-square statistic | Note |
|---|---|---|
| 45/55 against 30/70 | 4.8 | χ² = 4.76, p = 0.029 |
| Identical proportions | 0 | χ² = 0 |
| A small table | 1.607143 | expected counts too small — the gate warns |
FAQFrequently asked questions
What does the chi-square test tell me?
Whether the pattern in a contingency table is further from independence than chance would comfortably explain.
When is it not valid?
When any expected count falls below about 5. Then the approximation breaks down and Fisher's exact test is the right tool.
Should I use Yates' correction?
It is conservative and now generally discouraged for 2×2 tables — most statisticians prefer Fisher's exact test when the counts are small enough to worry about.
What is phi?
The effect size for a 2×2 table — √(χ²/n), which behaves like a correlation between two binary variables.
Does a significant chi-square show causation?
No. It shows association. The direction and the cause are questions the test cannot answer.
Where these figures come from
- NIST Digital Library of Mathematical Functions — reference definitions for elementary and special functions
- Wolfram MathWorld — definitions and formulas for every topic on this page
- NIST/SEMATECH e-Handbook of Statistical Methods — the statistical formulas (mean, variance, z, confidence intervals, sample size)
- Australian Curriculum (ACARA) — Mathematics — the terms and methods taught in Australian schools
Last checked: September 2026. Formulas are fixed by mathematics and do not change with tax years or regulations.