Crosstab Calculator

StatisticsLast updated: August 22, 2026

A crosstab, or contingency table, is the basic summary table that lays the joint distribution of two categorical variables out across rows and columns. Questions such as "preference by gender" in survey data or "outcome by group" in clinical data are read off this table first; it is the job done by SPSS Crosstabs, R's table(), and an Excel pivot table.

This tool does more than stack up frequencies: for every cell it computes the expected frequency, the row percentage, the column percentage, and the total percentage. It then runs the chi-square test of independence and reports χ², the degrees of freedom, the p-value, the critical value, Cramer's V as an effect size, and the adjusted residuals that show which cell produced the difference. A warning appears whenever a cell's expected frequency drops below 5.

Write the cell frequencies of one row category on each line. Add "Label:" at the start of a line to name that category. Frequencies must be non-negative whole numbers.
Separate them with commas. If left empty, "Column 1, Column 2, …" is used.
The row percentage is the most common choice for comparing how the distribution differs across the row categories.
Sets the false-positive risk. In the social sciences the usual choice is 5%.

Crosstab and Chi-Square Formulas

Expected frequency:  Eᵢⱼ = (nᵢ. × n.ⱼ) / N
Row percentage:      %row = nᵢⱼ / nᵢ. × 100
Column percentage:   %col = nᵢⱼ / n.ⱼ × 100
Total percentage:    %total = nᵢⱼ / N × 100
Chi-square:          χ² = Σᵢ Σⱼ (nᵢⱼ − Eᵢⱼ)² / Eᵢⱼ
Degrees of freedom:  df = (r − 1)(c − 1)
Adjusted residual:   zᵢⱼ = (nᵢⱼ − Eᵢⱼ) / √[Eᵢⱼ(1 − nᵢ./N)(1 − n.ⱼ/N)]
Cramer's V:          V = √[χ² / (N · min(r − 1, c − 1))]

Do not confuse the standardized residual (nᵢⱼ − Eᵢⱼ)/√Eᵢⱼ with the adjusted residual: only the adjusted residual is approximately standard normal and can be read against the ±1.96 threshold. It is the "Adjusted Residual" row in the SPSS Crosstabs output.

How to Calculate

  1. Write each row of your crosstab on its own line, separating the cell frequencies with commas or spaces.
  2. To name a row category, start the line with a label such as "Women:"; enter the column names, comma separated, in the second box.
  3. Choose the percentage you want to see in the table: row percentages for comparison, column percentages to show composition.
  4. Compare the observed and expected frequency of each cell in the results table, and read which cell produced the difference from the adjusted residual row.
  5. Report χ², df, p, and Cramer's V together; even with a significant p-value, a small effect size can make the association practically unimportant.
  6. If the expected-frequency warning appears, merge categories, enlarge the sample, or switch to Fisher's exact test in a 2×2 table.

Worked Examples

Gender × product preference (2×2)

In a 100-person sample every expected frequency is 25.00. The result is χ²(1) = 4.00, p = 0.046, and Cramer's V = 0.200 (a weak association); with a critical value of 3.841 the result is significant at α = 0.05. 60.0% of the first row category chose product A and 60.0% of the second chose product B, and every cell has an adjusted residual of ±2.00.

Table size: 2 × 2 · Total observations (N): 100 · Chi-square statistic (χ²): 4.000

Education level × smoking (3×2)

There are 50 people at each of the three education levels, for N = 150 observations. The result is χ²(2) = 9.375, p = 0.009, and Cramer's V = 0.250; with a critical value of 5.991 the association is significant. The strongest departure is in the university-by-smoker cell (adjusted residual 2.89): more people in that group smoke than expected.

Table size: 3 × 2 · Total observations (N): 150 · Chi-square statistic (χ²): 9.375

Expected-frequency warning in a small sample (3×3)

With N = 67 observations, χ²(4) = 2.381, p = 0.666, and Cramer's V = 0.133; the critical value is 9.488, so the association is not significant. Because the smallest expected frequency is 2.51 and 2 of the 9 cells (22%) fall below an expected frequency of 5, the tool issues a warning: the p-value for this table is only approximate.

Table size: 3 × 3 · Total observations (N): 67 · Chi-square statistic (χ²): 2.381

Frequently Asked Questions

Should I use row percentages or column percentages in a crosstab?
The rule is that percentages are taken in the direction that defines the groups you want to compare. If you are studying how preference differs by gender, gender should be the rows and row percentages should be used, so that each gender's own distribution adds up to 100%. A percentage taken in the wrong direction tells a completely different and usually misleading story.
What is an adjusted residual and how is it read?
The adjusted residual shows how many standard errors a cell's observed frequency lies from its expected frequency, and it is approximately standard normal. Cells whose absolute value exceeds 1.96 differ from expectation at the 5% level; a positive value means more observations than expected, a negative one fewer. It is the most practical way to locate the source of a significant chi-square result.
What should I do if an expected frequency drops below 5?
The traditional rule is that cells with an expected frequency below 5 should not exceed 20% of all cells and that none should fall below 1. If that condition fails, merge similar categories, enlarge the sample, or use Fisher's exact test in 2×2 tables. For larger tables, generating the p-value by Monte Carlo simulation is another option.
What is the difference between Cramer's V and the phi coefficient?
The phi coefficient is defined only for 2×2 tables and is computed as φ = √(χ²/N). Cramer's V generalizes it: V = √(χ²/(N·min(r−1, c−1))) applies to a table of any size and returns the same value as phi in a 2×2 table. The common thresholds are 0.10 weak, 0.30 moderate, and 0.50 strong, although they shift with the degrees of freedom.
Do the results match the SPSS Crosstabs output?
Yes. The observed frequencies, expected frequencies, row, column, and total percentages, Pearson chi-square, degrees of freedom, asymptotic p-value, adjusted residuals, and Cramer's V are produced with the same formulas. The only difference is that SPSS additionally reports Yates's continuity correction for 2×2 tables; this tool gives the uncorrected Pearson χ², because the Yates correction is now widely considered too conservative.
Can I use this table for pre-post measurements on the same people?
You can build the table descriptively, but you cannot apply the chi-square test. The chi-square test of independence requires every observation to be counted in exactly one cell, and paired measurements violate that assumption. Use McNemar's test in a 2×2 design and the Stuart-Maxwell or Bowker test for larger tables.
The chi-square is significant but Cramer's V is tiny; how do I report that?
This is common in large samples: as N grows, χ² grows with it and even very small differences become statistically significant. The correct report gives the effect size and the actual difference in row percentages alongside the p-value. You can say the association is statistically significant but practically unimportant.