Enter observed counts
Use non-negative integer frequencies from a contingency table. Percentages and continuous measurements are not valid inputs for this calculation.
Review expected frequencies
Low expected frequencies can make the usual chi-square approximation unreliable. Depending on table size and design, an exact method or a revised category structure may be more suitable.
When to use a chi-square test of independence
Use this test when you want to know whether two categorical variables are associated, for example study programme and preferred learning format, or treatment group and outcome category. Each participant or unit should be counted once, in exactly one cell of the table. If you have only one categorical variable and want to compare its observed counts with a set of expected proportions, use the chi-square goodness-of-fit calculator instead. If two raters classified the same cases and you want to measure their agreement, the Cohen’s kappa calculator answers that question better than a test of association.
Check the assumptions first
- Observations are independent: no person or unit appears in more than one cell, and repeated measurements of the same people are not pooled into one table.
- Both variables are categorical, with categories that are mutually exclusive and cover every case.
- Expected frequencies are large enough. A common guideline is that no expected count is below 1 and no more than about 20% of cells have expected counts below 5.
For a 2×2 table with small expected counts, Fisher’s exact test is the usual alternative. For larger tables, combining sparse categories can help, but only when the merged categories still make sense for your research question.
Reading the output
The chi-square statistic summarises how far the observed counts are from the counts you would expect if the two variables were unrelated. Degrees of freedom equal (rows − 1) × (columns − 1). The p-value tells you how compatible the data are with no association; it does not tell you how strong the association is. For strength, look at Cramér’s V, which ranges from 0 (no association) to 1 (perfect association). Benchmarks for small, medium and large values depend on the size of the table, so interpret V in the context of your field and design. Inspecting which cells differ most from their expected counts, for example through standardised residuals, helps explain where an association comes from.
How to report the result
A typical APA-style sentence reads: “A chi-square test of independence showed [a / no] significant association between [variable A] and [variable B], χ²([df], N = [sample size]) = [value], p = [value], Cramér’s V = [value].” Include the contingency table with observed counts and, where useful, row or column percentages. The demographic table builder and the descriptive statistics calculator can help you prepare those tables. Our guide on writing a strong data analysis chapter explains how to present tests like this one alongside your research questions.
Plan your sample before collecting data
Sparse tables are easier to prevent than to fix. Estimating the sample you need in advance, for example with the Cochran sample size calculator, reduces the risk of cells with very low expected counts. You can browse every calculator in our free research and statistical tools collection, or ask for statistical analysis support if you would like the test checked against your design.