Chi-Square Test Calculator (2×2)

Quick answer

The chi-square calculator tests whether two categorical variables are independent using a 2×2 contingency table. It gives the chi-square statistic, p-value and the phi coefficient.

Total
—
Chi-square (χ²)
—
p-value
—
Phi coefficient
—

A chi-square test answers questions like “is recovery related to treatment group?”.

How to use the Chi-Square Test Calculator

  1. Group 1, outcome yes (a)
  2. Group 1, outcome no (b)
  3. Group 2, outcome yes (c)
  4. Group 2, outcome no (d)

Results update as you type, and every field accepts the units shown in its menu.

How it works

The shortcut formula for 2×2 tables compares observed counts with those expected under independence; df = 1.

Inputs explained

Field What to enter
Group 1, outcome yes (a) A number
Group 1, outcome no (b) A number
Group 2, outcome yes (c) A number
Group 2, outcome no (d) A number

What each result means

  • Total = [Group 1, outcome yes (a)] + [Group 1, outcome no (b)] + [Group 2, outcome yes (c)] + [Group 2, outcome no (d)]
  • Chi-square (χ²) = [Total]×([Group 1, outcome yes (a)]×[Group 2, outcome no (d)] – [Group 1, outcome no (b)]×[Group 2, outcome yes (c)])^2÷(([Group 1, outcome yes (a)] + [Group 1, outcome no (b)])×([Group 2, outcome yes (c)] + [Group 2, outcome no (d)])×([Group 1, outcome yes (a)] + [Group 2, outcome yes (c)])×([Group 1, outcome no (b)] + [Group 2, outcome no (d)]))
  • p-value = 1 – chicdf([Chi-square (χ²)], 1)
  • Phi coefficient = ([Group 1, outcome yes (a)]×[Group 2, outcome no (d)] – [Group 1, outcome no (b)]×[Group 2, outcome yes (c)])÷sqrt(([Group 1, outcome yes (a)] + [Group 1, outcome no (b)])×([Group 2, outcome yes (c)] + [Group 2, outcome no (d)])×([Group 1, outcome yes (a)] + [Group 2, outcome yes (c)])×([Group 1, outcome no (b)] + [Group 2, outcome no (d)]))

Example values

How the main result changes when Group 1, outcome yes changes and everything else stays at the example values above:

Group 1, outcome yes (a) p-value
15 7.4740e-5
22.5 0.0027
30 0.0285
37.5 0.1368
45 0.3842
60 0.8617

Formula

χ² = n(ad − bc)² ÷ ((a + b)(c + d)(a + c)(b + d))

Worked example

Inputs — Group 1, outcome yes (a): 30; Group 1, outcome no (b): 70; Group 2, outcome yes (c): 45; Group 2, outcome no (d): 55.
Results — Total = 200; Chi-square (χ²) = 4.8; p-value = 0.02846; Phi coefficient = -0.1549.

Frequently asked questions

When should I use Fisher’s exact test instead?

When any expected count is below 5.

Does chi-square show direction?

No; check the proportions or the sign of phi.

What formula does the Chi-Square Test Calculator use?

χ² = n(ad − bc)² ÷ ((a + b)(c + d)(a + c)(b + d)).

Sources

  1. NIST/SEMATECH e-Handbook of Statistical Methods

Cite this calculator

Speedy Calculator. (2026). Chi-Square Test Calculator (2×2). Speedy Calculator. https://speedycalculator.com/calculators/statistics/chi-square/