Fisher's Exact Test Calculator
Compute the exact probability of a 2×2 contingency table using Fisher's exact test. Enter counts a, b, c, d and get the hypergeometric p-value with steps.
Enter the 2x2 contingency table cell counts:
Result
0.001346
The exact probability of this 2x2 table is 0.001346
Quick Answer
Fisher's exact test calculator computes p = (a+b)!(c+d)!(a+c)!(b+d)! / (n! × a! × b! × c! × d!) for a 2×2 table with cell counts a, b, c, d and total n = a+b+c+d. For a table with cells 6, 2, 2, 10 (n = 20), the factorial products give p ≈ 0.0147, the exact probability of that specific table under the null hypothesis of independence.
What Fisher's Exact Test Calculates and When to Use It
Fisher's exact test calculates the exact probability of observing a specific 2×2 contingency table under the null hypothesis that the two categorical variables are independent, using the hypergeometric distribution rather than a chi-squared approximation. This makes it exact for any sample size, including the small or sparse tables where the chi-squared test becomes unreliable. This calculator computes the probability of the single table you enter; building a full one-tailed or two-tailed p-value requires summing this table's probability with every other table that is as extreme or more extreme, which this tool does not automate.
Fisher's Exact Test Formula: Factorial Calculation
p = (a+b)! × (c+d)! × (a+c)! × (b+d)! ÷ (n! × a! × b! × c! × d!) where n = a + b + c + d
- p = (a+b)! × (c+d)! × (a+c)! × (b+d)! ÷ (n! × a! × b! × c! × d!)
- Total count n = a + b + c + d
- Hypergeometric distribution framework
How To Use the Fisher's Exact Test Calculator
Inputs
- a, b, c, d: the four cell counts in the 2×2 contingency table
- Row totals (a+b, c+d) and column totals (a+c, b+d) computed automatically
Steps
- Set up the 2×2 table with your two groups (rows) and two outcomes (columns).
- Count the observations in each cell and enter them as a, b, c, d.
- Read the exact probability of the observed table.
- If you need a full p-value, sum this probability with every table as extreme or more extreme in the direction(s) you care about, then compare that sum to your significance level (commonly 0.05).
- Note whether you need a one-tailed or two-tailed p-value before deciding which tables to include in the sum.
Fisher's Exact Test Worked Example: Drug vs Placebo
A trial with Drug group (8 recovered, 2 not) and Placebo group (3 recovered, 7 not). Total n = 20.
- Row/column totals: a+b = 10, c+d = 10, a+c = 11, b+d = 9, n = 20.
- Numerator factorials: 10! × 10! × 11! × 9!.
- Denominator factorials: 20! × 8! × 2! × 3! × 7!.
- Exact probability of this specific table: p ≈ 0.0322.
p ≈ 0.0322 is the exact probability of this one table, not a complete p-value. A full one-tailed p-value would add the probabilities of every table as extreme or more extreme in the same direction (a=9, a=10 with the same margins), which pushes the true one-tailed p-value above 0.0322.
When Fisher's Exact Test Is the Appropriate Statistical Method
Use Fisher's exact test for 2×2 tables when any expected cell count is below 5, when n is small (under 30), or when you need an exact p-value rather than a chi-squared approximation.
Assumptions
- The marginal totals (row and column sums) are fixed by the study design.
- Observations are independent of each other.
- Each observation falls into exactly one cell.
- Cell counts are non-negative integers.
Limitations
- Reports the hypergeometric probability for the observed table.
- Does not calculate odds ratios, relative risk, or confidence intervals.
- Does not handle tables larger than 2×2.
In Practice
This calculator reports the exact probability of your one observed table, not a full one-tailed or two-tailed p-value. A complete significance test sums this value with the probabilities of every table as extreme or more extreme in the direction(s) of interest; treat this single-table result as one term in that sum, and add the more extreme tables by hand (or with dedicated statistics software) before comparing against a significance threshold like 0.05.
Related Calculators
Related Guides
- How To Average Percentages Without Common Mistakes
Learn when to average percentages directly, when to use a weighted average, and why mixed group sizes can make a simple average misleading result.
- How To Find Backwards Percentages From Final Values
Learn the backwards percentage method for finding an original value before an increase or decrease, with formulas, checks, and worked examples.
- Calculator Evolution From Abacus to Online Tools Today
Follow calculator evolution from abacus and slide rules to mechanical calculators, handheld electronics, software, and modern online tools today.
- How To Find A Percentage On A Calculator, Step By Step
Find a percentage on a calculator using the percent button or the decimal method, with worked examples for percentage of a number, increase and decrease.
- How To Calculate Architectural Scale
Learn how to calculate architectural scale with this simple step-by-step math guide. We cover how to read plans, find ratios, and measure real paper lines.
- How To Calculate Attendance Percentage For Sessions
Calculate attendance percentage from attended and total sessions. See the formula, a worked example, and common checks for class or staff records.
Frequently Asked Questions: Fisher's Exact Test Calculator
When should I use Fisher's exact test instead of the chi-squared test?
Use Fisher's exact test when any expected cell count is below 5, when n is small (typically below 20–30), or when exact p-values are required. The chi-squared test is an approximation that becomes unreliable with sparse cells.
What is the null hypothesis in Fisher's exact test?
The null hypothesis is that the two categorical variables are statistically independent: knowing which group an observation belongs to gives no information about which outcome it falls into.
What is the difference between one-tailed and two-tailed p-values?
A full one-tailed p-value sums the probability of the observed table plus every table that is as extreme or more extreme in one direction; a two-tailed p-value sums extreme tables in both directions. This calculator reports the exact probability of your specific table only, which is the building block for either sum but is not itself the summed p-value.
Can cell counts be zero?
Yes. Fisher's exact test handles zero-count cells correctly. If a = 0, then 0! = 1, and the formula still computes a valid probability.
How do I interpret the result?
This calculator reports the exact hypergeometric probability of your specific 2x2 table, assuming fixed row and column totals under the null hypothesis of independence. A full significance test sums this value with every table as extreme or more extreme, so treat this single-table probability as an input to that sum, not as a ready-made p-value to compare against 0.05.
Sources
Last updated: . Reviewed for accuracy against the formula shown above.