Chi-square calculator

Test association of two categorical variables. 2×2 or up to 5×5 — χ² and p-value

Chi-square test — tests association between two categorical variables. Enter contingency table — get χ² statistic and p-value.

FAQ about chi-square

Enter survey data

E.g. 2×2: first row "50 30", second "20 40". Or paste from Excel.

Assumptions and limitations

  • Expected frequency in each cell at least 5 (for 2×2 better at least 10). Otherwise the result may be inaccurate.
  • Input: non-negative integers. Rows and columns from 2 to 5.
χ² and p-value
Enter table

In SurveyNinja, NPS, CSAT and more are calculated automatically. Create a survey in 5 minutes and get real-time analytics.

Start free

Data is not stored — calculation runs in your browser.

Chi-square and association

What we test

Null hypothesis: variables are independent. If p-value < 0.05, we reject H₀ and consider the association statistically significant.

Formula

χ² = Σ (O − E)² / E, where O = observed frequency, E = expected under independence: E = (row sum × column sum) / N.

Degrees of freedom

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

When to use

Cross-tabulations in surveys: gender × brand choice, age × response type. Not suitable for ordinal variables with many levels — use other methods.

Chi-square calculation examples

1 Association present (gender × purchase)

2×2 table. Row 1 (male): 50 30; row 2 (female): 20 40. Enter two rows: 50 30 and 20 40.
Result: χ² ≈ 13.3, p < 0.001 — association between gender and purchase is significant. Reject independence hypothesis.

2 No association

2×2 table with equal distribution. Row 1: 25 25; row 2: 25 25. Observed match expected under independence.
Result: χ² = 0, p = 1 — no association. Null hypothesis not rejected.

3 3×2 table (age × yes/no)

Row 1 (18–30): 40 60; row 2 (31–45): 50 50; row 3 (46+): 30 70. Set 3 rows, 2 columns.
Result: χ² and p show whether age is associated with response. df = (3−1)×(2−1) = 2.

4 Weak signal

2×2 table: row 1 45 55; row 2 48 52. Distributions almost the same.
Result: χ² will be small, p likely > 0.05 — no association. For significance you need stronger differences or larger sample.

5 Strong association (brand × region)

Region A: 80 20 (brand 1 / brand 2); region B: 25 75. Opposite preferences.
Result: χ² large, p < 0.001 — region and brand choice are associated. Can segment by region.

6 2×3 table (channel × outcome)

Three channels, two outcomes. Row 1: 30 20; row 2: 25 35; row 3: 15 25. Set 3 rows, 2 columns.
Result: df = 2. χ² and p show whether outcome depends on channel.

Interpreting p-value

p-value
Conclusion
p < 0.05
Association significant — reject independence
p ≥ 0.05
Association not significant — no reason to reject independence

If in 2×2 table expected frequency in a cell < 5, χ² may be inaccurate; consider Fisher's exact test.

Frequently asked questions about chi-square

Automate your metrics

In SurveyNinja, NPS, CSAT and more are calculated automatically. Create a survey in 5 minutes and get real-time analytics.

Start free