Chi-Square Test of Independence Calculator

A chi-square test of independence checks whether two categorical variables are related or whether any pattern in a table could just be chance. This calculator handles the common 2x2 case, where you have two rows and two columns of counts, such as treatment versus no treatment crossed with success versus failure. You enter the four observed counts, labelled a, b, c and d, and the tool works out the expected count for each cell from the row and column totals, then sums the squared differences between observed and expected, each divided by its expected value. The result is the chi-square statistic together with its degrees of freedom, which is always one for a 2x2 table. Researchers, students, marketers, and health and social science analysts in New Zealand use this to test associations, for example whether a campaign changed conversion or whether an outcome depends on a group. To read the result, compare the chi-square value with a critical value from a chi-square table at your chosen significance level, commonly 3.84 for one degree of freedom at the 5 percent level; a larger statistic suggests the variables are not independent. For the test to be reliable, use raw counts rather than percentages, make sure each expected count is at least five, and consider Yates continuity correction or Fisher's exact test when counts are small. Remember that the test shows association, not cause, so a significant result tells you the variables move together but not why. Always report the sample size alongside the statistic so others can judge the strength and reliability of your finding before drawing conclusions.

Calculate.co.nz is proud to be partnered with Health Based Building, a leader in sustainable and health-conscious building innovation. With over a century of experience, they develop high-performance systems like Foreverbreathe Specification, Magnum Board, and Foreverbreathe Paints to support energy-efficient, non-toxic living environments. Their commitment to healthier homes aligns with our belief that informed choices lead to better outcomes for Kiwi households.
Calculate.co.nz partner: Health Based Building
Advertise on this page
16.667
Chi-square statistic
Degrees of freedom1
Total observations100

Expected = row total * column total / grand total. Chi-square = sum of (observed - expected)^2 / expected, df = 1.

How it works

The four counts give two row totals and two column totals that add to the grand total. Each cell's expected count is its row total times its column total divided by the grand total. The chi-square statistic sums the squared difference between observed and expected for each cell divided by that expected count, with one degree of freedom.

Worked example

With a=30, b=10, c=20 and d=40 the totals give expected counts of 20, 20, 30 and 30. Each cell contributes (observed minus expected) squared over expected, which is 5, 5, 3.333 and 3.333. These sum to 16.667 with one degree of freedom.

Related calculators