What a chi-square test tells you
A chi-square (χ²) test answers one question about counts: is the pattern in this table real, or could it easily be chance? It's the standard test whenever your data is categories rather than measurements: which plan people chose, whether they clicked, which region they're from, whether they renewed.
This calculator runs both common versions:
- Test of independence: are two categorical variables related? For example, does the share of customers who renew differ between people who joined through ads and people who joined through referrals?
- Goodness of fit: do observed counts match what you expected? For example, are support tickets spread evenly across weekdays, or do some days get more than their share?
The formula
Expected count for each cell = (row total × column total) ÷ grand total
χ² = Σ (observed − expected)² ÷ expected
Degrees of freedom = (rows − 1) × (columns − 1) [goodness of fit: categories − 1]
p-value = chance of a χ² at least this large if there were no real relationship
Cramér's V = √( χ² ÷ (total × (smaller of rows, columns − 1)) )
The test compares what you saw with what you'd expect if the two variables had nothing to do with each other. The bigger the gaps, relative to the expected counts, the larger χ² and the smaller the p-value.
Worked example
The example table compares 160 customers: 80 who joined through ads and 80 through referrals. Of the ad customers, 48 renewed and 32 didn't. Of the referral customers, 27 renewed and 53 didn't. (Rows are channels; columns are renewed, didn't renew.)
If channel made no difference, we'd expect each channel to renew at the overall rate of 75 ÷ 160 = 46.9%, so 37.5 renewals each. The observed counts are 48 and 27, far from 37.5. The test gives χ² ≈ 11.1 with 1 degree of freedom and a p-value under 0.001: the difference between channels is very unlikely to be chance. Cramér's V of about 0.26 suggests a small-to-moderate association.
Interesting twist: in this made-up example, ad customers renew more. Real data often shows the opposite. Whatever your numbers say, the test only tells you the gap is real, not why it exists.
Reading the result
- p-value below 0.05: conventionally significant. The variables appear related, or the counts differ from what you expected.
- p-value 0.05 or above: not enough evidence of a relationship. That's not proof there's no relationship; you may simply need more data.
- Cramér's V measures how strong the relationship is, from 0 (none) to 1 (perfect). With large samples, tiny relationships can be significant, so always check the effect size too.
- The expected counts table shows which cells drive the result: look for the biggest gaps between observed and expected.
Assumptions to check
- Counts, not percentages. Enter the actual number of people or events in each cell. Percentages or averages give wrong answers.
- Each observation counted once. One person shouldn't appear in two cells.
- Expected counts of at least 5. With smaller expected counts, the p-value becomes unreliable. The calculator warns you. For small 2×2 tables, Fisher's exact test is the safer choice.
- Independent observations. Before-and-after measurements on the same people need a different test (McNemar's).
Chi-square vs other tests
If you're comparing two conversion rates from an A/B test, the A/B test calculator gives the same answer as a 2×2 chi-square, plus the size of the lift and a confidence interval, which is usually more useful. If you're comparing averages (like revenue per customer) rather than counts, use the t-test calculator. And if you want to know how two numeric variables move together, use the correlation and regression calculator.
Common mistakes
- Treating significance as importance. A significant result with a Cramér's V of 0.03 is real but probably too small to matter.
- Concluding cause. A relationship between channel and renewal doesn't prove the channel causes renewal; the customers each channel attracts may simply differ.
- Testing dozens of tables and reporting the significant ones. With enough tests, some will be significant by chance.
- Hiding the mix. A relationship in the total can reverse inside subgroups. Split by obvious factors like region or customer size before concluding. My guide to mean vs median covers a related habit: always look at the shape of your data first.
Questions
How do I calculate a chi-square test by hand?
For each cell, compute the expected count (row total × column total ÷ grand total), then (observed − expected)² ÷ expected. Add these up to get χ², and compare it with a chi-square table at your degrees of freedom. The calculator does all of this and shows the expected counts.
What does a chi-square value of 3.84 mean?
With 1 degree of freedom (a 2×2 table), 3.84 is the cut-off for p = 0.05. Values above it are significant at the 95% level.
Can I use chi-square for more than two groups?
Yes. The test of independence works for any table size, for example three channels by three plan types.
Is my data private?
Yes. Everything is calculated in your browser; nothing is uploaded.
Last reviewed 2026-11-26