Chi-Square Test Calculator
Test a table of counts for independence, or counts against expected proportions.
Try before you buy.
- Free preview: watermarked charts of the test and the names of each table’s first rows (up to 3), with χ², the p-value, the verdict, the working and every figure hidden.
- Locked until you unlock it: download and copy.
- Unlock: Pro pass, ₹179 for 30 days, a one-time payment that never renews.
Ways to unlock shows how to get the full result.
Printing this result is locked in the free preview.
Result
This is the last result worked out. Fix the input above to update it.
Locked in the free preview. Opens the ways to unlock this result.
Locked in the free preview. Batch runs unlock with a pass.
Locked in the free preview. Query results unlock with a pass.
About the Chi-Square Test Calculator
Type or paste a table of counts — people by group and answer, items by machine and defect type — and test whether the rows and columns are independent (or, equivalently, whether the groups have the same distribution: the test of homogeneity). Or switch to goodness of fit to test observed counts against expected proportions, ratios such as 9 : 3 : 3 : 1, or equal shares.
The calculator gives χ², its degrees of freedom and the p-value, the expected count of every cell, each cell’s contribution to χ², the adjusted residuals that show which cells drive an association, the likelihood-ratio G², and Cramér’s V for the strength of the association. A 2 × 2 table also gets Yates’s continuity correction, Fisher’s exact test, φ and the odds ratio with its confidence interval, and the page warns when expected counts are too small for the chi-square approximation.
How to use it
- Choose Independence for a two-way table, or Goodness of fit for one row of counts against expected proportions.
- Set the number of rows and columns and type the counts — or paste cells copied from a spreadsheet into any cell, or the whole table into the paste box. Name the rows and columns if you like.
- For goodness of fit, type each category’s observed count and its expected proportion, percentage, ratio or count, or choose equal expected counts.
- Read χ², the p-value and the decision, then the expected counts, contributions and adjusted residuals; check the warnings about small expected counts.
- Copy the result, or download a Word report, a CSV file or the chart — with a Pro pass or after unlocking this result; without one you see the free preview.
Examples
Shift 1: 15, 21, 45, 13 · Shift 2: 26, 31, 34, 5 · Shift 3: 33, 17, 49, 20 (types A to D)
χ²(6) = 19.178, p = 0.003873; Cramér’s V = 0.176
The e-Handbook rounds the expected counts and reports χ² = 19.18 and p = 0.00387. The largest adjusted residual is Shift 2 × type B (+2.82).
Group I: 2 no, 5 yes · Group II: 3 no, 2 yes
Fisher’s exact p = 0.5581 (two-sided); χ²(1) = 1.185 without and 0.245 with Yates’s correction
Every expected count is below 5, so Fisher’s exact test is the one to report.
Observed 315, 108, 101, 32 against the ratio 9 : 3 : 3 : 1
χ²(3) = 0.4700, p = 0.9254: an excellent fit
60 rolls: 8, 9, 19, 5, 8, 11, equal expected counts
χ²(5) = 11.6, p = 0.0407: significant at the 5 % level
Common uses
- Testing whether answers to a survey question differ between groups — age bands, regions, customer types.
- Checking whether defects, complaints or failures depend on the shift, the machine or the supplier.
- Comparing conversion counts of two or more versions of a page or an email.
- Testing genetic ratios, a die, a random number generator or a claimed market share against expected proportions.
How the test works
If rows and columns were independent, the expected count of a cell would be E = (row total × column total) ÷ n. Pearson’s statistic adds up how far the observed counts O are from them: χ² = Σ (O − E)²/E over all cells. Under independence it follows approximately a chi-square distribution with (r − 1)(c − 1) degrees of freedom, and the p-value is the area to the right of your χ². A goodness-of-fit test uses E = n × the expected proportion of each category, with k − 1 degrees of freedom, minus one for each parameter estimated from the same data (NIST/SEMATECH e-Handbook).
The test of independence and the test of homogeneity — whether several groups share one distribution — use the same arithmetic; only the sampling design differs (e-Handbook).
Which cells drive the association
A significant χ² says only that the table departs from independence somewhere. The adjusted residual of a cell, (O − E)/√(E(1 − rowᵢ/n)(1 − colⱼ/n)), is approximately standard normal under independence, so cells beyond about ±2 stand out: positive means more observations than independence predicts, negative fewer (Agresti, Categorical Data Analysis). The contribution table shows the same in χ² units. Cramér’s V = √(χ²/(n(min(r, c) − 1))) measures the strength of the association from 0 to 1, whatever the sample size.
2 × 2 tables: Yates, Fisher and the odds ratio
- Yates’s continuity correction subtracts ½ from each |O − E| before squaring, which makes the chi-square approximation conservative for small tables.
- Fisher’s exact test keeps the row and column totals fixed and adds up the hypergeometric probabilities of every table that is no more likely than yours — no approximation at all (e-Handbook). Use it whenever expected counts are small. That two-sided p is the one R’s fisher.test reports; the e-Handbook doubles the one-sided p instead, which gives 0.6212 rather than 0.5581 for the small 2 × 2 example above.
- φ is the correlation of the two yes/no variables, and the odds ratio ad/(bc) compares the odds in the two rows, with Woolf’s 95 % interval exp(ln OR ± 1.96·√(1/a + 1/b + 1/c + 1/d)) — half is added to every cell when one is 0.
When the chi-square approximation can be trusted
The p-value comes from an approximation that needs enough expected counts. The usual rule, from Cochran, is that no expected count should be below 1 and no more than 20 % of them below 5. The calculator counts them for you; when the rule fails, combine sparse rows or columns that belong together, collect more data, or — for a 2 × 2 table — use Fisher’s exact test. The test also needs independent observations: each person or item counted once.
Limitations
- Tables can have up to 30 rows and 30 columns of whole-number counts; goodness of fit up to 100 categories.
- Fisher’s exact test is offered for 2 × 2 tables; larger tables use the chi-square and G² approximations.
- The test needs counts of independent observations — not percentages, averages or repeated measurements of the same subjects (for paired yes/no data, McNemar’s test is the right one).
- A significant result shows an association, not its cause; with very large samples even trivial associations become significant, so look at Cramér’s V and the residuals.
Privacy
Everything happens in your browser. What you enter or open here is not uploaded or stored by MySmartCoPilot.
Frequently asked questions
What do I get without a pass?
Without a pass, Chi-Square Test Calculator shows watermarked charts of the test and the names of each table’s first rows (up to 3), with χ², the p-value, the verdict, the working and every figure hidden. Until you unlock it, the result can’t be downloaded or copied. A Pro, Premium or Ultimate pass, a one-time payment that never renews, unlocks the full result. The pricing page lists the passes and their prices.
How do I calculate the expected counts?
For each cell multiply its row total by its column total and divide by the grand total. In the NIST table, Shift 1 has 94 items and type A 74 of the 309, so the expected count of Shift 1 × A is 94 × 74 ÷ 309 = 22.51; 15 were observed.
How many degrees of freedom does a chi-square test have?
(rows − 1) × (columns − 1) for a test of independence — 6 for a 3 × 4 table, 1 for a 2 × 2 table — and categories − 1 for goodness of fit, minus one for every parameter of the expected distribution you estimated from the same data.
Should I use Yates’s correction or Fisher’s exact test?
For a 2 × 2 table with small expected counts, report Fisher’s exact test: it needs no approximation. With larger counts the uncorrected χ² is accurate and Yates’s correction is usually unnecessary, since it tends to be conservative. The calculator shows all three so you can see whether the choice matters.
What does Cramér’s V tell me?
How strong the association is, on a scale from 0 (none) to 1. Following Cohen’s guide for a table whose smaller side has two categories, about 0.1 is small, 0.3 medium and 0.5 large; the thresholds shrink for bigger tables, which the calculator takes into account.
How do I report a chi-square test in APA style?
Give χ² with its degrees of freedom and the sample size, the p-value and the effect size, for example: χ²(6, N = 309) = 19.18, p = .004, V = .18. The calculator writes the sentence for you; italicize the symbols when you paste it into your report.