Chi-square test calculator

Enter your table of observed counts, rows separated by semicolons or new lines. You get the chi-square statistic, degrees of freedom, p-value, the expected counts, Cramér's V and, for a 2×2 table, an optional Yates continuity correction.

Rows separated by semicolons or new lines, cells by commas or spaces. For example 10, 20; 30, 40. Up to 10 rows and 10 columns.
Chi-square (χ²)0.79365079
Degrees of freedom
1
p-value
0.37299848
Total count
100
Cramér's V
0.089087081
Expected counts
12, 18; 28, 42

Runs in your browser: nothing you enter is sent anywhere.

How to use it

  1. Type the observed counts. Separate rows with semicolons or new lines.
  2. For a 2×2 table you can switch on the Yates correction.
  3. Read χ², degrees of freedom and p. Check the expected counts.

How it works

χ² = Σ (O − E)² / E over all cells, where E is row total × column total / grand total. The p-value is the upper tail of the chi-square distribution, computed with the regularized incomplete gamma function. Cramér’s V = √(χ² / (n × min(rows − 1, columns − 1))).

Worked example

Table 10, 20; 30, 40 (n = 100):

  • Expected: 12, 18; 28, 42
  • χ² = 4/12 + 4/18 + 4/28 + 4/42 ≈ 0.794, df = 1
  • p ≈ 0.373, so no evidence of association
  • With Yates: 2.25 × (1/12 + 1/18 + 1/28 + 1/42) ≈ 0.446

Tips

  • Use counts, not percentages.
  • Each observation should fall in exactly one cell.
  • A rule of thumb asks for expected counts of at least 5 in most cells.

Frequently asked questions

What does the chi-square test of independence check?

Whether two categorical variables are related. It compares your observed counts with the counts expected if the variables were independent.

How are expected counts calculated?

Expected = row total × column total / grand total. For the table 10, 20; 30, 40 the expected counts are 12, 18; 28, 42.

What are the degrees of freedom?

(rows − 1) × (columns − 1). A 2×2 table has 1 and a 3×4 table has 6.

When should I use the Yates correction?

It subtracts 0.5 from each absolute difference in a 2×2 table to make small-sample results less optimistic. Many analysts use Fisher's exact test instead when counts are small.

What does a small p-value mean?

If the variables were truly independent, a statistic this large would be unlikely. A common but arbitrary cut-off is 0.05. It does not measure the size of the effect, so use Cramér's V for that.

More in Math

All tools in this category: Math ·Updated November 3, 2026

Privacy choices

Google Analytics shows us which tools are used and whether they work. It may set cookies. Your choice is kept in this browser.