# Chi-Square Test Calculator (2×2)

URL: https://speedycalculator.com/calculators/statistics/chi-square/
Last updated: 2026-10-25

> 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.

## Inputs

- Group 1, outcome yes (a)
- Group 1, outcome no (b)
- Group 2, outcome yes (c)
- Group 2, outcome no (d)

## Results

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

## Formula

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

## Explanation

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

### How to use the Chi-Square Test Calculator

- **Group 1, outcome yes (a)**
- **Group 1, outcome no (b)**
- **Group 2, outcome yes (c)**
- **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

FieldWhat to enterGroup 1, outcome yes (a)A numberGroup 1, outcome no (b)A numberGroup 2, outcome yes (c)A numberGroup 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-value157.4740e-522.50.0027300.028537.50.1368450.3842600.8617

## 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.

## FAQ

**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

- [NIST/SEMATECH e-Handbook of Statistical Methods](https://www.itl.nist.gov/div898/handbook/)
