Chi-square and Fisher's exact test for a 2×2 table
Compare two groups on a yes/no outcome: chi-square with and without Yates' correction, and Fisher's exact test.
Your data does not go to our server. This tool runs in your browser; what you type or open never leaves your device.
This calculator needs JavaScript, because it calculates in your browser and sends nothing. Turn JavaScript on to use it. How it is calculated is explained below.
- Pearson chi-square
- Chi-square with Yates correction
- Fisher's exact test (two-sided)
- Smallest expected count
How it is calculated
The chi-square P value has one degree of freedom. Fisher's test adds up the exact probabilities of the tables that are as unlikely as yours or less likely, given the row and column totals.
All four margins must be above zero, otherwise the tests are undefined and no result is shown.
χ² = n × (a × d − b × c)² / [(a + b)(c + d)(a + c)(b + d)]Yates: χ² = n × (|a × d − b × c| − n/2)² / [(a + b)(c + d)(a + c)(b + d)]Fisher: sum of the probabilities of all tables with the same margins that are no more likely than the observed table
Worked example: Counts 3, 1, 1 and 3 (the lady tasting tea): Fisher's two-sided P = 0.486.
Sources
These calculators support research; they do not replace the advice of a statistician or a clinician.
Questions
When should I use Fisher's exact test?
When any expected count is below 5, chi-square becomes unreliable. The tool tells you when this is the case. Fisher's test is valid for any table.