How to use
- Choose Contingency table or Goodness of fit.
- For a table, paste one row of counts per line; for goodness of fit, enter observed counts and optional expected proportions.
- Read χ², degrees of freedom and the p-value, and note any small-count warning.
Options explained
- Independence test
- Expected = row total × column total ÷ grand total; χ² = Σ(observed − expected)² ÷ expected; df = (rows − 1)(columns − 1).
- Fisher's exact test
- For 2 × 2 tables, sums exact hypergeometric probabilities — more reliable than χ² with small samples.
Worked example
Suppose 100 people answered a yes/no question and the observed counts are:
| Group | Yes | No |
|---|---|---|
| Group A | 30 | 20 |
| Group B | 20 | 30 |
Every row and column total is 50 and the grand total is 100, so each expected count is 50 × 50 ÷ 100 = 25. Then χ² = 4 × (5² ÷ 25) = 4.00, with (2 − 1)(2 − 1) = 1 degree of freedom. The p-value is about 0.0455, below the usual 0.05 level.
Critical values of χ² at the 0.05 level:
| Degrees of freedom | 1 | 2 | 3 | 4 | 5 |
|---|---|---|---|---|---|
| Critical value | 3.841 | 5.991 | 7.815 | 9.488 | 11.070 |
If your χ² is larger than the critical value for your degrees of freedom, the p-value is below 0.05.
Frequently asked questions
Should I use the Yates correction?
It is sometimes used for small 2 × 2 tables, and R applies it by default, but Fisher's exact test is now generally preferred.
Must the inputs be counts?
Yes — frequencies (people, occurrences), not percentages or means.
Is my data uploaded?
No. Calculations run in your browser.
Privacy
This tool runs entirely in your browser. Your files and text are processed on your device and are never uploaded to our servers.