Chi-square calculator
Type a contingency table straight in — 2×2 up to 5×5 — or paste one from a spreadsheet. You get the p-value, the expected counts it was computed from, and Cramér’s V, because a chi-square statistic on its own tells you nothing about how strong the association is.
Fill in your table to begin
You get the p-value, the expected counts behind it, and Cramér’s V — because χ² grows with sample size and says nothing on its own about how strong the association is.
Results
P-value
Estimate
Effect size
Expected counts under independence
What each cell would hold if the two variables were unrelated. χ² measures how far your observed counts sit from these, and the approximation needs every one of them to be about 5 or more.
What this means
What it does not mean
Report it (APA)
What this test asks
A contingency table cross-tabulates two categorical variables — treatment against outcome, channel against conversion, region against preference. The chi-square test of independence asks a single question about it: are the two variables related, or would a table like this turn up anyway if they were not?
The machinery is simpler than it looks. Your row and column totals imply what each cell would hold if the variables were unrelated — that is the expected count, row total times column total divided by the grand total. Chi-square adds up the squared gap between observed and expected, scaled by expected, across every cell. A big total means your table does not look like the independent one.
Entering your table
Enter counts, never percentages or averages. This trips people up more than anything else here: a table of row percentages summing to 100 will produce a chi-square statistic, and it will be meaningless, because the test's entire notion of evidence is how many observations sit behind each proportion. If you have percentages, multiply them back out by the group sizes first.
The paste box takes a table copied straight out of Excel, Google Sheets, or a CSV. Tabs, commas and semicolons all work as separators, and the grid resizes itself to fit what you pasted. Ragged rows are rejected rather than padded with zeros — a missing cell silently filled with 0 would change every expected count in its row and column.
Each observation must fall in exactly one cell, and the cells must be independent of each other. Measuring the same people twice — before and after — breaks that assumption, and the right test there is McNemar's rather than this one.
2×2, 3×3, and larger
Table size changes two things: the degrees of freedom, (rows − 1) × (columns − 1), and what you can sensibly report as an effect.
| Table | df | Natural effect measure |
|---|---|---|
| 2 × 2 | 1 | Difference in proportions, odds ratio, phi |
| 2 × 3, 3 × 2 | 2 | Cramér's V |
| 3 × 3 | 4 | Cramér's V |
| 4 × 4 | 9 | Cramér's V |
| 5 × 5 | 16 | Cramér's V |
Only the 2 × 2 case has a single difference worth putting a confidence interval on, so that is the only case where this calculator shows one. For anything larger the estimate panel says so rather than inventing a number — a significant 4 × 4 table tells you the variables are related somewhere, and finding out where means looking at which cells contributed most to the total, not at one summary figure.
Read the expected table
The expected counts are printed with every result, and they are worth a moment of your attention rather than being scrolled past. They are the null hypothesis made concrete: the table you would have got if nothing were going on.
They also carry the test's one real assumption. The chi-square distribution approximates the true sampling distribution of the statistic well when expected counts are healthy and badly when they are not — the conventional floor is 5 in every cell. Any cell below it is highlighted. Note that this is about expected counts, not observed ones: a cell with zero observations is perfectly fine if its expected count is comfortable.
Significance is not strength
This is the failure mode specific to chi-square, and it is worth stating bluntly: χ² scales with sample size. Take a 55/45 versus 45/55 split. At n = 100 it gives χ²(1) = 1.02 and p = 0.31 — nothing to report. At n = 2,000 the identical split gives χ²(1) = 20.0 and p < 0.001 — overwhelming. Same pattern, same practical importance, opposite verdicts.
That is why Cramér's V sits next to the p-value here. V divides the sample size back out, so it stays put as n grows: both tables above give V = 0.10, a small association, which is the honest description of both. Read the p-value for whether the association is real and V for whether it is worth anything.
And look at the percentages. A 2 × 2 table of counts is hard to read directly; the same table expressed as row percentages usually makes the finding obvious in a way no summary statistic does.
Already have the statistic?
If your software has handed you a chi-square value and its degrees of freedom, you do not need to re-enter the table — the chi-square to p-value converter takes the statistic directly. That page also covers goodness-of-fit tests, likelihood-ratio tests, and McNemar's, which all produce a chi-square statistic but not a contingency table you would type in here.
Frequently asked questions
How do I get a p-value from a 2 by 2 table?
Enter the four counts above. The calculator computes the expected count for each cell under independence, sums the squared deviations to get the chi-square statistic, and reads the right-tail area of the chi-square distribution with 1 degree of freedom. That area is your p-value. It also reports the difference in proportions with a confidence interval, which is the number that tells you whether the association is large enough to matter.
What are the degrees of freedom for a contingency table?
df = (rows − 1) × (columns − 1). A 2 × 2 table has df = 1, a 3 × 3 has df = 4, and a 5 × 5 has df = 16. Sample size never enters the calculation — if you find yourself using n, you have the wrong formula. The calculator shows the df for your current table size next to the grid.
What if my expected counts are below 5?
The chi-square distribution is an approximation to the true sampling distribution of the statistic, and it degrades when expected counts get small. The usual rule is that every expected count should be at least 5. The calculator prints the full expected table and highlights any cell that falls short. For a 2 × 2 table, Fisher's exact test gives a trustworthy answer at any size; for larger tables, merging sparse categories is the usual fix when it makes substantive sense.
Should I apply Yates’s continuity correction?
This calculator does not, and most modern advice agrees. Yates’s correction was designed to make the chi-square approximation match Fisher’s exact test on a 2 × 2 table, but it overshoots — it is markedly conservative, producing p-values that are too large and costing real power. If your counts are small enough that the correction seems necessary, run Fisher’s exact test instead of approximating an approximation.
What is Cramér’s V and why is it shown?
It measures the strength of the association on a 0 to 1 scale, and it is shown because chi-square alone cannot. The chi-square statistic grows with sample size, so the same percentage split gives χ²(1) = 1.02 at n = 100 and χ²(1) = 20.0 at n = 2,000 — insignificant then overwhelming, for an identical pattern. V divides that out. Its benchmarks shift with the smaller dimension of the table, which the calculator accounts for.
Is this a test of independence or goodness of fit?
Independence. It asks whether the row variable and the column variable are related, using the row and column totals to derive what the table would look like if they were not. A goodness-of-fit test compares one row of observed counts against expected frequencies you supply yourself, and has df = categories − 1. If you already have the chi-square statistic from either test, the chi-square to p-value converter will finish the job.