Chi-Square Calculator

The chi-square test compares observed counts with the counts you would expect. Use the independence test for a table, such as gender against preference, and goodness of fit for one row against expected ratios, such as a dice or Mendel’s 9 : 3 : 3 : 1.

Test
Separate rows with semicolons: 20, 30; 30, 20
Results update as you type.

Chi-square (χ²)

4

Significant at α = 0.05: p < 0.05

p-value
0.0455003
Degrees of freedom
1
Critical χ² at α = 0.05
3.84146

Expected counts (row total × column total ÷ grand total)

Expected counts (row total × column total ÷ grand total)
RowColumn 1Column 2
12525
22525

About this calculator

Rows are separated by semicolons: 20, 30; 30, 20 is a 2 × 2 table.

How to use it

  1. Choose the test.
  2. Enter the counts.
  3. Read χ², the p-value and the expected counts.

The formula

χ² = Σ (O − E)² ÷ E; table: E = row total × column total ÷ grand total
O
observed count
E
expected count
df
(rows − 1)(columns − 1), or categories − 1

Worked example

A 2 × 2 table 20, 30; 30, 20

  1. Every expected count is 25, so χ² = 4 × 25 ÷ 25 = 4.
  2. df = 1, p = 0.0455: significant at 5%.

What the result means

A significant result means the observed pattern is unlikely to be chance alone; it says nothing about the size or cause of the link.

Assumptions

  • Counts, not percentages; independent observations; expected counts mostly 5 or more.

Limitations

  • No Yates correction is applied to 2 × 2 tables.

Frequently asked questions

Can I enter percentages?

No. The test needs the actual counts.

What does p < 0.05 mean?

If there were no real link, a result this extreme would happen less than 5% of the time.

What if expected counts are below 5?

Combine categories, or for a 2 × 2 table use Fisher’s exact test.

Last reviewed on 6 October 2026. Found a mistake? Tell us.