Fisher's Exact Test Calculator
Enter your 2×2 contingency table to get Fisher's exact p-value, odds ratio, and confidence interval.
📖 What is Fisher's Exact Test?
Fisher's exact test is a statistical significance test used to determine whether there is a non-random association between two categorical variables in a 2×2 contingency table. Unlike the chi-square test, which uses an approximation to the chi-square distribution, Fisher's test computes the exact probability of the observed table (and all tables more extreme) using the hypergeometric distribution. This makes it valid for any sample size, including very small samples where the chi-square approximation breaks down.
The test was developed by Ronald Fisher in 1922 and is famous for the "Lady Tasting Tea" experiment, where Fisher devised the test to evaluate whether a woman could truly distinguish whether milk or tea was poured first into a cup. The lady was presented with 8 cups - 4 with milk first, 4 with tea first - and asked to identify each. Fisher's exact test computed the probability that she could have achieved her observed score purely by chance.
The p-value is computed by summing the hypergeometric probabilities for all 2×2 tables with the same margins (row and column totals) that are as or more extreme than the observed table. "More extreme" for the two-tailed test means tables with a probability equal to or less than the observed table's probability. The formula for each table's probability is P = (a+b)!(c+d)!(a+c)!(b+d)! / (a!b!c!d!n!). For numerical stability, this calculator uses log-factorials and exponentiation to avoid overflow.
Beyond the p-value, the odds ratio (OR = ad/bc) measures the strength of association - how many times more likely the outcome is in group 1 vs group 2. The relative risk (RR) is the ratio of probabilities. The Woolf 95% confidence interval for the OR is computed using the log-normal approximation, which is standard for odds ratio estimation in epidemiology and clinical research.
📐 Formulas
Two-tailed p-value: Sum P(table) for all tables with P(table) ≤ P(observed).
One-tailed p-value (left): Sum P(table) for all tables with a ≤ observed a.
One-tailed p-value (right): Sum P(table) for all tables with a ≥ observed a.
Odds Ratio: OR = (a × d) / (b × c)
Relative Risk: RR = (a / (a+b)) / (c / (c+d))
Woolf 95% CI for OR: exp(ln(OR) ± 1.96 × √(1/a + 1/b + 1/c + 1/d))
Table notation:
a = Group 1, Outcome Yes | b = Group 1, Outcome No | c = Group 2, Outcome Yes | d = Group 2, Outcome No | n = a+b+c+d