Fisher's Exact Test Calculator
Enter a 2x2 table. Fisher's exact test gives a p-value without the large-sample approximation behind chi-square, so it works even when counts are tiny.
Checked on November 21, 2026. Results computed by our statistics engine, version 1.0.0.
On this page
How the exact test works
Fix the row and column totals of your table. Every table with those totals has a probability given by the hypergeometric distribution if rows and columns are unrelated. The one-sided p-value adds the probabilities of your table and every table more extreme in one direction. The two-sided p-value, as R and SciPy compute it, adds the probabilities of every table no more likely than yours (SciPy fisher_exact).
Because nothing is approximated, the test is valid however small the counts. The price is that it is conservative when the totals were not fixed by the design: its true error rate is usually below the nominal 5%.
Worked example: Fisher's tea-tasting lady
In The Design of Experiments (1935) Fisher described a lady who claimed she could tell whether milk or tea was poured first. She was given 8 cups, half of each kind, and identified 3 of the 4 milk-first cups correctly. R uses this as its fisher.test example (R reference output), and it is pre-filled above.
| Guessed milk | Guessed tea | |
|---|---|---|
| Milk first | 3 | 1 |
| Tea first | 1 | 3 |
The question is one-sided: can she do better than guessing? The p-value for "greater" is 0.2429, so 3 out of 4 correct is not convincing; pure guessing does at least that well about one time in 4. The two-sided p is 0.4857.
The sample odds ratio is 9.0. R prints a different number, 6.4083, the conditional maximum likelihood estimate, with a one-sided 95% interval from 0.3136 to infinity. R finds these with a numerical root finder at a loose tolerance, so its printed values can differ from ours in the fourth or fifth significant figure; our values are solved to full precision.
A significant example: twins and convictions
R's second example is Fisher's 1962 data on convictions among the same-sex twins of convicted criminals: 2 of the 17 dizygotic twins were also convicted, against 10 of the 13 monozygotic twins. The first row of the table holds the convicted twins and the second row the others. The two-sided p is 5.367 × 10−4 and the conditional odds ratio is 0.0469, with a 95% confidence interval from 0.0033 to 0.3632. Strong evidence of an association.
SciPy's documentation uses a third table, 8 and 2 over 1 and 5, with sample odds ratio 20.0 and two-sided p = 0.0350. Enter it above to compare.
Which odds ratio to report
- Sample odds ratio, ad / bc: what SciPy's
fisher_exactreturns and what most people compute by hand. Not defined when b or c is zero. - Conditional maximum likelihood estimate: what R's
fisher.testprints, with an exact confidence interval that matches the test. It is pulled toward 1 compared with the sample odds ratio, most visibly in small tables. - Label which one you report. Both appear in the result above.
Fisher or chi-square?
For a 2x2 table with an expected count below 1, use Fisher's test. With expected counts of at least 1 but some below 5, Campbell (2007) recommends the N−1 chi-square instead, because Fisher's test is conservative. The 2x2 calculator shows every option and the expected counts guide explains the rules. Tables larger than 2x2 need the Freeman-Halton extension, which this page does not compute; the test of independence calculator flags small expected counts in larger tables.
Common questions
Is Fisher's test only for small samples?
No. It is valid for any size, but chi-square gives almost the same answer once expected counts are large, and is faster to compute by hand.
Why does doubling the one-sided p not give your two-sided p?
Some textbooks define the two-sided p that way. R and SciPy add the probabilities of all tables no more likely than the observed one, which differs when the margins are uneven. We follow R and SciPy.
Why does R show a different odds ratio?
R reports the conditional maximum likelihood estimate; ad/bc is the sample odds ratio. Both are shown above.
Sources
- SciPy documentation: scipy.stats.fisher_exact checked November 21, 2026
- R reference example output, stats-Ex.Rout.save checked November 21, 2026