Fisher's Exact Test Calculator

StatisticsLast updated: August 22, 2026

Fisher's exact test asks whether the two variables of a 2×2 contingency table are independent, without falling back on an approximate distribution: it works straight from probabilities. With the row and column totals held fixed, the hypergeometric probability of every table the data could have produced is computed one by one, and the probabilities of the tables at least as extreme as the observed one are added up.

The chi-square test is an APPROXIMATION based on the χ² distribution and it breaks down as expected frequencies get small; Fisher's test is valid at any sample size. Alongside the exact p-value, this calculator reports the probability of the observed table, the one-tailed p-values, the odds ratio with a confidence interval, and the chi-square results (Pearson and Yates) for the same table side by side, showing in numbers why a small sample calls for Fisher.

The number of subjects in the first group in whom the outcome of interest occurred.
The number of subjects in the first group in whom the outcome did not occur.
The number of subjects in the second group in whom the outcome of interest occurred.
The number of subjects in the second group in whom the outcome did not occur.
The probability that the interval covers the true parameter.
Sets the false positive risk. In the social sciences 5% is the common choice.

Fisher's Exact Test Formulas

Table:           [a  b; c  d],  N = a + b + c + d
Hypergeometric:  P(A = i) = C(a+b, i) · C(c+d, a+c−i) / C(N, a+c)
Support:         max(0, (a+c) − (c+d)) ≤ i ≤ min(a+b, a+c)
Two-tailed:      p = Σ P(A = i) over every i with P(A = i) ≤ P(observed)
Left tail:       p = P(A ≤ a)      Right tail: p = P(A ≥ a)
Odds ratio:      OR = (a·d) / (b·c)
SE(ln OR):       √(1/a + 1/b + 1/c + 1/d)
OR interval:     exp(ln OR ± z · SE)

The two-tailed p is computed with the "every table no more likely than the observed one" rule (the minimum-likelihood / Irwin method), which matches R's fisher.test implementation. Doubling a one-tailed p gives a wrong answer whenever the table is not symmetric.

How to Calculate

  1. Enter the four cells of your 2×2 table: a and b are the outcome yes/no counts of the first group, c and d those of the second.
  2. Choose the confidence level for the odds ratio and the significance level for the decision.
  3. Read the two-tailed exact p-value; if your directional hypothesis was set in advance, use the matching one-tailed value.
  4. Look at the chi-square comparison rows: if the smallest expected frequency is below 5, the Pearson χ² p-value is unreliable and the exact p should be used instead.
  5. Report the odds ratio together with its confidence interval; if the interval contains 1, the effect is not statistically significant.
  6. In the hypergeometric chart, the highlighted bars are the tables that enter the two-tailed p, which shows visually how the p-value is built up.

Worked Examples

A clear difference in a small sample

Two groups of 10 subjects each; the outcome occurred in 1 subject in the first group and in 8 in the second. With a two-tailed exact p = 0.005 the difference is significant; the left-tail p is 0.003 and the probability of the observed table is 0.00268. The odds ratio is 0.028 (95% CI: 0.002 – 0.367). Because the smallest expected frequency is 4.50, the chi-square condition fails: on the same data Pearson χ² gives p = 0.002.

Exact p-value (two-tailed): p = 0.005 · Decision: Significant · Left-tail p — P(a ≤ observed): p = 0.003

In a large table, Fisher and chi-square agree

In a table of 100 people every expected frequency is 25.00. Fisher's exact p = 0.071, the Pearson χ² p = 0.046, and the Yates-corrected p = 0.072; since the expected frequency condition is met, all three methods stay close to one another. The odds ratio is 2.250 (95% CI: 1.011 – 5.008).

Exact p-value (two-tailed): p = 0.071 · Decision: Not significant · Left-tail p — P(a ≤ observed): p = 0.986

A table with a zero cell

No event was observed in the first group. The exact p = 0.014, so the difference is significant; a zero cell does not break the exact test. The odds ratio would be undefined, so with the Haldane-Anscombe correction it comes out as 0.040 (95% CI: 0.002 – 0.827).

Exact p-value (two-tailed): p = 0.014 · Decision: Significant · Left-tail p — P(a ≤ observed): p = 0.007

Frequently Asked Questions

When should I use Fisher's exact test instead of chi-square?
The classic rule is to switch to Fisher's test whenever any cell has an expected frequency below 5. Many sources now go further and recommend the exact test for every 2×2 table regardless of sample size, since the computational cost no longer matters. In large samples the two methods give practically the same p-value anyway, so nothing is lost by using the exact test.
Why is the two-tailed p not exactly twice the one-tailed p?
The hypergeometric distribution is usually not symmetric. The two-tailed p is obtained by summing the probabilities of every table that is no more likely than the observed one, which can be smaller or larger than twice the one-tailed value. Doubling the one-tailed p is a common but incorrect shortcut.
Can Fisher's test be applied to tables larger than 2×2?
Yes, the generalized Fisher-Freeman-Halton exact test works for r×c tables; but the number of possible tables grows quickly, so the computation gets heavy and a Monte Carlo approximation is usually preferred. This calculator handles only 2×2 tables; for larger tables see the chi-square test in the contingency table tool and heed its expected frequency warning.
How should I report the result in a paper?
State the name of the test, the number of tails, and the exact p-value: "Fisher's exact test, two-tailed p = 0.006". Because the sample is small, add an effect size as well; reporting the odds ratio with its confidence interval is standard. Degrees of freedom are not reported for Fisher's test, since the test does not rest on a distributional approximation.
Does the Yates continuity correction replace Fisher's test?
No. The Yates correction was developed to bring the chi-square statistic closer to the exact test, but in most situations it is overly conservative and hides real significance. When the exact p can be computed directly, there is no reason to use a corrected approximation; this calculator shows the Yates value for comparison only.
Is Fisher's test used for paired data?
No. Like chi-square, Fisher's test requires independent observations. For before-after measurements on the same subjects or a matched case-control design, use McNemar's test (its exact binomial version in a small sample).
Will I get the same result as R and SPSS?
The two-tailed p-value matches R's fisher.test and Python's scipy.stats.fisher_exact; the "Exact Sig. (2-sided)" row of SPSS Crosstabs gives the same value too. You may see a small difference in the odds ratio: R reports the conditional maximum likelihood estimate, while this calculator and SPSS report the sample odds ratio (a·d)/(b·c).