Written by Dackohn; last reviewed November 2026.

To run a chi-square test by hand: compute each expected count as row total × column total / grand total, then sum (observed − expected)² / expected across all cells, and compare with the critical value for df = (rows − 1)(columns − 1). The example below gives χ²(2) = 8.56, p = .014.

The data

Two hundred people, 100 in each of two age groups, choose between three product designs. Does preference depend on age group?

ObservedDesign ADesign BDesign CTotal
Under 30304525100
30 and over503020100
Total807545200

Step 1: State the hypotheses

H₀: preference and age group are independent. H₁: they are associated.

Step 2: Compute the expected counts

If the variables are independent, each expected count is row total × column total / grand total. For Under 30 and Design A: 100 × 80 / 200 = 40.

ExpectedDesign ADesign BDesign C
Under 304037.522.5
30 and over4037.522.5

All are above 5, so the chi-square approximation is reasonable. If some were smaller, in a 2 × 2 table you would use Fisher’s exact test.

Step 3: Compute the statistic

For each cell, compute (O − E)² / E. For the first cell: (30 − 40)² / 40 = 2.5.

(O − E)² / EDesign ADesign BDesign C
Under 302.5001.5000.278
30 and over2.5001.5000.278

The sum is χ² = 8.56.

Step 4: Degrees of freedom

df = (rows − 1) × (columns − 1) = 1 × 2 = 2.

Step 5: Decide

The chi-square table gives a critical value of 5.991 for df = 2 at α = .05. Since 8.56 > 5.991, reject H₀. The exact p-value is .014.

Step 6: Report the size and direction

Cramér’s V = √(χ² / (N × (k − 1))), where k is the smaller of the number of rows and columns: √(8.56 / 200) = .21. To see the direction, look at the cells contributing most: under-30s chose Design B more often than expected, and over-30s chose Design A more often.

In APA style: χ²(2, N = 200) = 8.56, p = .014, Cramér’s V = .21.

Common mistakes

Try it yourself

Chi-Square Calculator →Get the statistic, p-value and Cramér’s V from your table. Fisher’s Exact Test →For small 2 × 2 tables.

Frequently asked questions

How do you calculate expected values in a chi-square test?

Multiply the row total by the column total and divide by the grand total, for every cell.

What is the minimum expected count for a chi-square test?

A common rule is at least 5 in at least 80% of cells and none below 1. For small 2 x 2 tables, use Fisher's exact test.

Does a chi-square test show which groups differ?

Not directly. Look at which cells contribute most to the statistic, or at the standardised residuals.

Related reading: Chi-square table · APA results generator · Choosing a statistical test


Sources & further reading: NIST/SEMATECH e-Handbook of Statistical Methods · OpenStax Introductory Statistics. How we compute & validate: methodology. Written & reviewed by Dackohn; last reviewed August 2026.