Chi-Square Calculator
Whether counts differ from what you expected, or whether two categories are related, with the p value and the strength of the link.
Results
What this tool does
Chi-square is the test for counted things rather than measured ones: how many people chose each option, how many items failed in each batch, how the answers split across age groups. It compares what you counted against what you would have counted if the categories had nothing to do with each other, and turns the gap into a single number. Paste a table of counts, one row per line, and this page returns that number, what it means, and — just as importantly — whether your counts are large enough for the test to be trustworthy at all.
Formula
χ² = Σ (observed − expected)² ÷ expected · in a table, expected = row total × column total ÷ grand total
Variables
| Symbol | Meaning | Unit |
|---|---|---|
mode | What you are testing | — |
table | The table, one row per line | — |
observed | What you counted | — |
expected | What you expected, or leave empty for all equal | — |
alpha | Significance level | % |
OUT | Chi-square | — |
PV | p value | — |
VD | What that means | — |
DF | Degrees of freedom | — |
CR | The value it had to beat | — |
CV | Strength of the link (Cramér's V) | — |
CE | Cells | — |
LE | Cells expecting fewer than five | — |
AS | The test's assumption holds | — |
TT | Count | — |
Worked example
- What you are testingtable
- The table, one row per lineUnder 30 = 60, 40 30 to 50 = 45, 55 Over 50 = 25, 75
- What you counted30, 14, 34, 45, 57, 20
- What you expected, or leave empty for all equal
- Significance level5 %
- Chi-square25.1131
- p value0.000004
- What that meansThe difference is bigger than chance would give
- Degrees of freedom2
- The value it had to beat5.9915
- Strength of the link (Cramér's V)0.2893
- Cells6
- Cells expecting fewer than five0
- The test's assumption holdsYes
- Count300
Limitations
- The calculation runs entirely in your browser. The values you type are never sent to a server.
- For work that must comply with a standard or be signed off, check the result against the applicable code and have it reviewed by a qualified engineer.
Frequently asked questions
How do I write the table?
One row per line: a name, an equals sign, then the counts in that row separated by commas. Every row needs the same number of counts. The columns are whatever you decide they are — the page never sees their names, only the numbers. A two-by-two table has two rows of two counts, and gets one degree of freedom; a three-by-two has two, and so on.
What is the warning about counts under five?
The chi-square test works by approximating a discrete count with a smooth curve, and that approximation falls apart when the expected counts are small. The usual rule is that every expected count should be at least five; when some are not, the p value below is optimistic and the test can call a difference significant that is not. With a two-by-two table and small counts, Fisher's exact test is the right tool instead — it computes the probability directly rather than approximating it.