What this calculator does
Fisher exact test computes the probability of a 2x2 table directly rather than approximating it, which makes it the correct choice when counts are small. A table of 8, 2, 1, 9 gives a two-tailed p-value of 0.005477 and an odds ratio of 36.
Exact here means literally exact. The test enumerates every possible table with the same row and column totals, computes the probability of each, and sums those no more likely than the one observed. There is no approximation to break down, which is why it remains valid where a chi-square test does not.
The formula
The probability of any particular table with fixed margins follows the hypergeometric distribution. The two-tailed p-value sums the probabilities of all tables at least as extreme as the observed one, meaning all those whose individual probability is no greater. The margins are treated as fixed, which is the assumption that makes the enumeration possible.
| Term | Meaning |
|---|---|
| Exact test | One computing the probability directly rather than via an approximating distribution. |
| Odds ratio | ad/bc, the ratio of odds between the two rows. |
| Fixed margins | Row and column totals held constant, which defines the set of tables enumerated. |
| Hypergeometric | The distribution giving the probability of each table with those margins. |
The inputs explained
| Field | What to enter |
|---|---|
| Group 1, outcome A | Group 1, outcome A count. |
| Group 1, outcome B | Group 1, outcome B count. |
| Group 2, outcome A | Group 2, outcome A count. |
| Group 2, outcome B | Group 2, outcome B count. |
When to use it
Small sample 2x2 comparisons
Where any expected count falls below 5, chi-square is unreliable and Fisher is correct.
Rare outcome studies
A rare event produces small cells regardless of how large the overall sample is.
Laboratory comparisons
Experiments with few replicates per condition routinely produce tables too small for chi-square.
Worked examples
Every figure in the tables below is produced by this page’s own calculator at build time, so the numbers and the tool always agree. Select any row to load that scenario.
How does the table affect the p-value?
A range of group 1 splits against the same comparison group.
| Group 1, outcome A (b = 2) | Two-tailed p-value | Odds ratio (a·d)/(b·c) | Probability of observed table |
|---|---|---|---|
| a = 1 | 0.423077 | 4.500 | 0.384615 |
| a = 5 | 0.034502 | 22.500 | 0.016968 |
| a = 8 | 0.005477 | 36.000 | 0.002679 |
| a = 9 | 0.001905 | 40.500 | 0.001559 |
Questions
When should I use Fisher instead of chi-square?
When any expected cell count falls below about 5, which is the standard guideline. Fisher is valid at any sample size, so using it always is defensible, though for large tables it is computationally heavier and gives essentially the same answer.
Is Fisher’s test conservative?
Yes, somewhat, because it conditions on the observed margins which are not genuinely fixed in most study designs. This makes the actual error rate lower than the nominal level, so the test is less likely to detect a real effect than the stated alpha suggests.
What does the odds ratio tell me?
How many times higher the odds of the outcome are in one group than the other. An odds ratio of 36 means the odds are 36 times greater. It is not a risk ratio, and the two diverge substantially when the outcome is common.
Why is the two-tailed p-value not just double the one-tailed?
Because the hypergeometric distribution is asymmetric, so the two tails are not mirror images. The convention used here sums the probabilities of all tables no more likely than the observed one, which is the most common definition but not the only one in use.
For larger tables, see the chi-square goodness of fit calculator. For paired binary data, see the McNemar’s test calculator.