Home / Tools / Fisher's Exact Test Calculator
Fisher's Exact Test Calculator
Fisher's exact test tells you whether the two categories in a 2x2 table are associated, using exact probabilities instead of a large-sample approximation. Type your four counts and read the exact one- and two-sided p-values, the odds ratio with an exact confidence interval, and an optional mid-p, with the matching R shown alongside. It is the test to reach for when an expected cell count is small.
I want to test whether the two groups differ (two-sided)
Rows are the two groups, columns are the two outcome categories. Click a label to rename it.
| Total | |||
| 10 | |||
| 10 | |||
| Total | 9 | 11 | 20 |
-
Odds ratio (conditional MLE) with its exact confidence interval, log scale. The dashed line at 1 is no effect.
How this p-value is computed
✓ No data leaves your browser
✓ Verified against R's fisher.test()
✓ Free, no sign-up
Fisher's exact test vs the chi-square test
Both test whether the rows and columns of a 2x2 table are independent, but they get the p-value in different ways. The right choice comes down to the size of the expected counts.
When the sample is small and any expected count is below 5. Fisher's test computes the probability exactly from the hypergeometric distribution, so it stays valid no matter how small the counts are, including tables with a zero cell.
When every expected count is 5 or more. The chi-square statistic then follows its large-sample distribution closely, the test is fast, and it generalizes beyond 2x2. With small counts the approximation breaks down and overstates significance.
As counts grow the two tests converge. For a large table Fisher's exact p and the chi-square p are almost identical, so the exact test is never wrong to use, only slower. This tool reports the smallest expected count so you can see which regime you are in.
What the calculator reports
| Quantity | What it means | How it is found (cells a b c d) |
|---|---|---|
| Two-sided p | Chance of a table this unequal in either direction if the groups were independent | Sum of hypergeometric probabilities no larger than the observed table's |
| One-sided p (greater) | Evidence that group 1 has higher odds of the column-1 outcome | P(X ≥ a) under the hypergeometric null |
| One-sided p (less) | Evidence that group 1 has lower odds of the column-1 outcome | P(X ≤ a) under the hypergeometric null |
| Odds ratio (cMLE) | The effect size R reports, fit to the fixed margins | Conditional maximum-likelihood estimate of the noncentral hypergeometric |
| Sample odds ratio | The plain point estimate of the odds ratio | (a×d) / (b×c) |
| Exact CI | Interval for the odds ratio that inverts the exact test | Root of the tail probability at the chosen level |
| Mid-p | A less conservative p-value | Exact p minus half the probability of the observed table |
The observed cell a is the top-left count. With the row and column totals held fixed, a follows a hypergeometric distribution when the groups are independent, and every p-value above is a sum of probabilities from that one distribution. That is why the calculator can draw it and shade the exact bars that add up to your result.
Frequently asked questions
When should I use Fisher's exact test instead of the chi-square test?
Use Fisher's exact test when the table is small, specifically when any expected cell count under independence falls below 5. The chi-square test relies on a large-sample approximation that becomes unreliable with small expected counts, whereas Fisher's test computes the probability exactly from the hypergeometric distribution and stays valid for any counts. When every expected count is 5 or more, the chi-square test and Fisher's test agree closely, and either is fine. This tool shows the smallest expected count and tells you which test it recommends.
What is the difference between the one-sided and two-sided p-value?
The two-sided p-value tests whether the two groups differ in either direction, and is the default. A one-sided p-value tests a directional hypothesis, either that group 1 has higher odds of the outcome (greater) or lower odds (less). The one-sided p equals the probability of a table as or more extreme in that single direction, so it is smaller than the two-sided p. Use a one-sided test only when the direction is specified in advance for a genuine scientific reason, and report which one you used.
Why does the odds ratio from fisher.test differ from (a×d)/(b×c)?
The sample odds ratio (a times d) divided by (b times c) is the plain point estimate. Fisher's test instead reports the conditional maximum-likelihood estimate, which is the odds ratio that best fits the noncentral hypergeometric distribution given the fixed margins. The two are close but not identical, and the conditional estimate is the one paired with the exact confidence interval, which is why R's fisher.test prints it. This calculator shows both so you can compare them.
What is the mid-p value and when is it useful?
Fisher's exact test is conservative, meaning its true error rate is usually below the nominal level because the discreteness of the counts leaves gaps. The mid-p value counts only half of the probability of the observed table instead of all of it, which removes some of that conservatism and gives a test with an average error rate closer to the nominal level. It is popular in epidemiology. The trade-off is that the mid-p value is no longer guaranteed to control the error rate exactly, so it is an option here rather than the default.
Does this Fisher's exact test calculator match R?
Yes. The one-sided and two-sided p-values, the conditional maximum-likelihood odds ratio and the exact confidence intervals reproduce R's fisher.test through the same noncentral hypergeometric distribution and the same root finder, and the chi-square comparison matches chisq.test. The results were checked against R across dozens of tables, including zero cells, tiny samples and large counts, at the 90, 95 and 99 percent levels.
Can I use Fisher's exact test on any 2x2 table?
Yes. Fisher's exact test works for any 2x2 table of non-negative whole-number counts, including tables with a zero cell. It is most valuable for small samples, where the chi-square approximation is poor. For large tables the exact calculation still works and agrees with the chi-square test, though it takes more computation; this tool handles both cases and marks the observed table on the null distribution either way.