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?
| Observed | Design A | Design B | Design C | Total |
|---|---|---|---|---|
| Under 30 | 30 | 45 | 25 | 100 |
| 30 and over | 50 | 30 | 20 | 100 |
| Total | 80 | 75 | 45 | 200 |
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.
| Expected | Design A | Design B | Design C |
|---|---|---|---|
| Under 30 | 40 | 37.5 | 22.5 |
| 30 and over | 40 | 37.5 | 22.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)² / E | Design A | Design B | Design C |
|---|---|---|---|
| Under 30 | 2.500 | 1.500 | 0.278 |
| 30 and over | 2.500 | 1.500 | 0.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
- Using percentages instead of counts.
- Counting cells instead of (rows − 1)(columns − 1) for df.
- Counting a person twice. Each person must appear in exactly one cell.
- Stopping at “significant”. Say how the groups differ.
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.