Hypothesis Testing Exact Tests Categorical Data 32 min read August 4, 2026
BY: Statistics Fundamentals Team
Reviewed By: Minsa A (Senior Statistics Editor)

Fisher's Exact Test: Real-Life Examples

A clinical trial tests a new antibiotic in 12 patients but only 4 respond. A geneticist checks whether a rare mutation appears more often in affected individuals. A quality inspector compares defect rates between two small production batches. In each case, a chi-square test would be unreliable — the expected cell counts are too small. Fisher's Exact Test was designed for exactly these situations.

This page covers the full theory, step-by-step manual calculation, and eight complete worked examples — drug treatment, vaccine effectiveness, smoking and disease, genetics, A/B testing, product defects, customer behavior, and educational outcomes — each with a 2×2 contingency table, exact p-value derivation, odds ratio, and a plain-English conclusion. The interactive calculator at the bottom lets you run your own test instantly.

What You'll Learn
  • ✓ What Fisher's Exact Test is and when to use it instead of chi-square
  • ✓ The exact probability formula based on the hypergeometric distribution
  • ✓ How to build a 2×2 contingency table from raw data
  • ✓ Eight fully worked real-life examples with complete arithmetic
  • ✓ How to calculate and interpret the odds ratio
  • ✓ Fisher's Exact Test vs chi-square vs McNemar's test — when to choose each
  • ✓ Common mistakes and how to avoid them
  • ✓ An interactive calculator for 2×2 tables

What Is Fisher's Exact Test?

Definition — Fisher's Exact Test
Fisher's Exact Test is a statistical hypothesis test used to determine whether there is a significant association between two categorical variables arranged in a 2×2 contingency table. It calculates an exact p-value directly from the hypergeometric distribution, without relying on large-sample approximations. This makes it the preferred method when sample sizes are small or expected cell counts fall below 5.
H₀: The two categorical variables are independent (no association)

The test was introduced by Ronald A. Fisher in 1922 and gained its name from the famous Lady Tasting Tea experiment, in which a woman claimed she could taste whether milk or tea was poured first into a cup. Fisher devised the test to determine whether her correct guesses could plausibly be explained by chance alone — an early demonstration of the exact probability approach to small-sample inference.

The key word is exact. The chi-square test of independence uses an approximation that only holds well when expected cell counts are large (conventionally ≥ 5). Fisher's test computes the true probability of observing your data — and all configurations at least as extreme — given fixed marginal totals. No approximation is involved. That precision comes at minimal cost when sample sizes are small, and modern software computes Fisher's test instantly regardless of sample size.

2×2
Contingency Table Required
< 5
Expected Count Threshold
100%
Exact — No Approximation
1922
Year Fisher Introduced It
Reference: Fisher, R.A. (1922). "On the interpretation of χ² from contingency tables, and the calculation of P." Journal of the Royal Statistical Society, 85(1), 87–94. Available via JSTOR.

When to Use Fisher's Exact Test

The rule of thumb used in most biostatistics textbooks is straightforward: if any expected cell count in a 2×2 contingency table is less than 5, use Fisher's Exact Test instead of the chi-square test. The formula for the expected count in any cell is: E = (row total × column total) / grand total. You compute this for all four cells before choosing your test.

Decision Guide: Fisher's Exact Test or Chi-Square?

Are both variables categorical with exactly 2 categories each?
Yes — proceed to check expected counts
Is any expected cell count < 5?
Yes → Use Fisher's Exact Test
Are all expected counts ≥ 5 and n > 20?
Yes → Chi-Square Test is acceptable
Are the two observations paired (before/after, matched subjects)?
Yes → Use McNemar's Test instead

A common misconception is that Fisher's test is only for very tiny datasets. In fact, it is valid at any sample size — the chi-square approximation just becomes reliable at large n, so the two tests agree there. Many researchers use Fisher's test by default for all 2×2 tables, and guidelines from medical journals such as those published by the National Institutes of Health support this approach for small sample research.

⚡ Use Fisher's Exact Test When:
  • Any expected cell count < 5 — the most common reason
  • Total sample size n < 20 — chi-square approximation is unreliable
  • Cells contain zeros — Fisher's test handles this; chi-square does not
  • You need an exact p-value — not an approximation
  • Clinical or genetic studies with small groups — rare diseases, pilot trials
  • 2×2 design with fixed marginals — both row and column totals are known in advance

Assumptions of Fisher's Exact Test

Fisher's Exact Test has fewer assumptions than many statistical tests, which contributes to its usefulness in small-sample research. The four assumptions are:

1

Categorical Variables

Both variables must be categorical (nominal or ordinal), with each variable having exactly two categories. The test determines whether the distribution of one variable differs across the categories of the other.

2

Independent Observations

Each subject or unit contributes to exactly one cell. Observations must not be paired, matched, or measured twice on the same individual. Paired data requires McNemar's Test.

3

Fixed Marginal Totals

The marginal totals (row totals and column totals) are treated as fixed. This is the conditioning argument Fisher used: you evaluate the probability of the observed table given that the margins are what they are. In practice, most researchers apply the test even when only the total n is fixed.

4

Mutually Exclusive Categories

Each observation falls into one and only one cell. A person cannot be in both the "treated" and "untreated" group simultaneously, and cannot have both "improved" and "not improved" as their outcome.

ℹ️
No Minimum Sample Size

Fisher's Exact Test has no minimum sample size requirement. It works correctly with n = 4 or n = 4,000. The test does not assume normally distributed data, does not require large expected counts, and makes no distributional assumptions beyond independence of observations.

The Formula: Hypergeometric Distribution

Fisher's Exact Test is built on the hypergeometric distribution, which describes the probability of drawing a specific number of "successes" from a finite population without replacement. For a 2×2 contingency table with cells a, b, c, d — where a and d are concordant cells (both groups agreeing) and b and c are discordant — the exact probability of observing that specific table is:

Fisher's Exact Test — Exact Probability Formula
P = [(a+b)! × (c+d)! × (a+c)! × (b+d)!] / [n! × a! × b! × c! × d!]
a, b, c, d = the four cell counts (a+b), (c+d) = row totals (a+c), (b+d) = column totals n = a+b+c+d (grand total) ! = factorial

This formula gives the probability of the specific table you observed. The two-tailed p-value is the sum of probabilities for all possible 2×2 tables with the same marginal totals that have a probability equal to or less than the observed table's probability. That sum includes your observed table and all more extreme arrangements.

Standard 2×2 Contingency Table Layout

Group Outcome: Yes Outcome: No Row Total
Group 1 (Treatment) a b a + b
Group 2 (Control) c d c + d
Column Total a + c b + d n

Odds Ratio Formula

Odds Ratio (OR)
OR = (a × d) / (b × c)
OR = 1 → no association OR > 1 → outcome more likely in Group 1 OR < 1 → outcome less likely in Group 1

How to Perform Fisher's Exact Test: Step-by-Step

📋
The 5-Step Procedure (Featured Snippet)

Step 1: State H₀ (independence) and H₁ (association). Step 2: Build the 2×2 contingency table. Step 3: Calculate the exact probability of your observed table using the hypergeometric formula. Step 4: Sum probabilities of all tables equally or more extreme to get the p-value. Step 5: If p < α, reject H₀ and report the odds ratio and its 95% CI.

1

State the Hypotheses

H₀: The two categorical variables are independent — knowing the group tells you nothing about the outcome. H₁: The two variables are associated — the distribution of the outcome differs between groups. Set your significance level α before collecting data (usually α = 0.05 in most research fields, α = 0.01 in more conservative clinical settings).

2

Build the 2×2 Contingency Table

Arrange raw counts into four cells: a (Group 1, Outcome Yes), b (Group 1, Outcome No), c (Group 2, Outcome Yes), d (Group 2, Outcome No). Compute all four marginal totals and the grand total n = a + b + c + d. Double-check that row totals add to n and column totals add to n.

3

Calculate the Exact Probability

Apply the hypergeometric formula: P = [(a+b)! × (c+d)! × (a+c)! × (b+d)!] / [n! × a! × b! × c! × d!]. This gives the probability of the exact table you observed, assuming H₀ is true and given the fixed marginal totals. With small cell values, factorials are manageable by hand. For larger values, software or the calculator below handles this instantly.

4

Sum Probabilities for All Extreme Tables

The two-tailed p-value is the sum of P for all possible tables with the same marginals that are as extreme or more extreme than your observed table. "More extreme" means having a probability equal to or smaller than the probability of your table. List every possible value of cell a (from 0 to its maximum given the marginals), compute P for each, and sum those with P ≤ P(observed).

5

Make a Decision and Report the Result

If p < α: reject H₀. Report: "Fisher's Exact Test showed a significant association between [Variable 1] and [Variable 2] (p = [value], OR = [value], 95% CI [lower, upper])." Also report the odds ratio and its 95% confidence interval. If p ≥ α: fail to reject H₀ — there is insufficient evidence of an association at the chosen significance level.

Fisher's Exact Test Examples — 8 Fully Solved

Each example below follows the 5-step procedure. The contingency table, exact probability, odds ratio, and a plain-English conclusion are shown for every case. The factorial calculations are shown in full for the first two examples to illustrate the method; later examples give the key results directly, as a statistician would report them.

Example 1 — Drug Treatment vs Placebo (Clinical Trial)

Worked Example 1 — Drug Treatment (Medical Research)

Problem: A small pilot trial tests a new antibiotic. 7 patients receive the drug and 5 receive a placebo. Among drug-treated patients, 6 recover. Among placebo patients, 2 recover. Is the drug significantly more effective at α = 0.05?

Group Recovered (Yes) Not Recovered (No) Row Total
Drug (Treatment) a = 6 b = 1 7
Placebo (Control) c = 2 d = 3 5
Column Total 8 4 n = 12
1

Hypotheses: H₀: Recovery rate is independent of treatment. H₁: Recovery rate differs between drug and placebo groups. α = 0.05 (one-tailed, since the drug is expected to improve outcomes).

2

Check assumption for Fisher's: Expected count in cell d = (5 × 4) / 12 = 1.67 < 5. Fisher's Exact Test is required.

3

Calculate P for observed table (a = 6):
P = [7! × 5! × 8! × 4!] / [12! × 6! × 1! × 2! × 3!]
= [5040 × 120 × 40320 × 24] / [479001600 × 720 × 1 × 2 × 6]
= 585,252,864,000 / 4,151,347,200 = 0.1410

4

More extreme table (a = 7, the only more extreme option):
P(a=7) = [7! × 5! × 8! × 4!] / [12! × 7! × 0! × 1! × 4!] = 0.0035
One-tailed p-value = P(a=6) + P(a=7) = 0.1410 + 0.0035 = 0.1445

5

Odds Ratio: OR = (a × d) / (b × c) = (6 × 3) / (1 × 2) = 18/2 = 9.0

Result: p = 0.145 > α = 0.05 → Fail to reject H₀. Despite an odds ratio of 9.0 — suggesting drug-treated patients are 9 times more likely to recover — the small sample (n = 12) means the result does not reach statistical significance. The study is underpowered; a larger trial is warranted.

Note: This example illustrates the fundamental tension between effect size and sample size. The NIH guidance on small clinical trials recommends reporting confidence intervals alongside p-values in pilot studies.

Example 2 — Lady Tasting Tea (The Original Fisher's Test)

Worked Example 2 — Lady Tasting Tea (Historical)

Problem: A woman claims she can detect whether milk or tea was poured first. She is given 8 cups — 4 with milk first, 4 with tea first — and correctly identifies all 4 milk-first cups. What is the exact probability of this result by chance?

Poured First She Said: Milk First She Said: Tea First Row Total
Milk First (Actual) a = 4 b = 0 4
Tea First (Actual) c = 0 d = 4 4
Column Total 4 4 n = 8
1

Hypotheses: H₀: The woman's guesses are random — she cannot detect the difference. H₁: Her guesses are better than chance (one-tailed). α = 0.05.

2

Why Fisher's Test: Cell b and c are both 0. No chi-square approximation is valid here. This is the exact scenario Fisher's test was created for.

3

P(observed table, a = 4):
P = [4! × 4! × 4! × 4!] / [8! × 4! × 0! × 0! × 4!]
= [24 × 24 × 24 × 24] / [40320 × 24 × 1 × 1 × 24]
= 331,776 / 23,224,320 = 0.0143

4

One-tailed p-value: The only more extreme result is a=4 (already observed — this is the maximum). So one-tailed p = 0.0143. (The two-tailed version sums all tables with probability ≤ 0.0143, also giving p = 0.0143 here.)

Result: p = 0.014 < α = 0.05 → Reject H₀. The probability of correctly classifying all 8 cups by pure chance is 1.43% — small enough to conclude the woman does appear to discriminate. This is the result Fisher published in 1935, launching the exact test that bears his name.

Example 3 — Vaccine Effectiveness (Epidemiology)

Worked Example 3 — Vaccine Effectiveness (Public Health)

Problem: In a rural community outbreak, 15 residents received a flu vaccine and 12 did not. Among vaccinated residents, 2 contracted flu. Among unvaccinated residents, 8 contracted flu. Does the vaccine significantly reduce flu risk at α = 0.05?

Group Got Flu (Yes) Did Not Get Flu Row Total
Vaccinated a = 2 b = 13 15
Unvaccinated c = 8 d = 4 12
Column Total 10 17 n = 27
1

Hypotheses: H₀: Flu incidence is independent of vaccination status. H₁: Vaccination reduces flu incidence (one-tailed). α = 0.05.

2

Check for Fisher's: Expected count in cell a = (15 × 10) / 27 = 5.56. Cell d expected = (12 × 17) / 27 = 7.56. All expected counts > 5, so chi-square would technically be acceptable. However, because this is a public health study with directional hypothesis, Fisher's exact one-tailed test is preferred for precision.

3

Result (via Fisher's formula): One-tailed p = 0.012

4

Odds Ratio: OR = (2 × 4) / (13 × 8) = 8 / 104 = 0.077. The 95% CI is approximately [0.011, 0.53], which excludes 1 — confirming significance.

Result: p = 0.012 < α = 0.05 → Reject H₀. Vaccinated residents were significantly less likely to contract flu (OR = 0.077, 95% CI [0.011, 0.53]). The vaccine was associated with a 92.3% reduction in odds of flu infection in this community sample.

Example 4 — Smoking and Lung Disease (Case-Control)

Worked Example 4 — Smoking and Disease (Epidemiology)

Problem: A case-control study recruits 10 lung disease patients and 10 healthy controls. Among cases, 9 are smokers. Among controls, 4 are smokers. At α = 0.05, does smoking status differ significantly between cases and controls?

Group Smoker (Yes) Non-Smoker (No) Row Total
Cases (Lung Disease) a = 9 b = 1 10
Controls (Healthy) c = 4 d = 6 10
Column Total 13 7 n = 20
1

Hypotheses: H₀: Smoking status is independent of lung disease. H₁: Smokers are more likely to have lung disease. α = 0.05 (one-tailed).

2

Check expected counts: Expected for cell b = (10 × 7) / 20 = 3.5. Expected for cell d = (10 × 7) / 20 = 3.5. Both expected "no" cells are below 5 — Fisher's Exact Test is required.

3

Fisher's Exact Test result: One-tailed p = 0.035

4

Odds Ratio: OR = (9 × 6) / (1 × 4) = 54 / 4 = 13.5. Among lung disease cases, the odds of being a smoker are 13.5 times the odds in healthy controls.

Result: p = 0.035 < α = 0.05 → Reject H₀. Smoking status differs significantly between cases and controls. The odds of being a smoker are 13.5 times higher among lung disease patients than among healthy controls in this sample.

Example 5 — Genetic Mutation and Disease (Genetics Research)

Worked Example 5 — Genetics (Rare Variant Study)

Problem: A genetics study examines whether a rare mutation is more prevalent in patients with a rare autoimmune condition. Among 8 patients, 5 carry the mutation. Among 10 healthy controls, 1 carries the mutation. Is the mutation significantly associated with disease at α = 0.05?

Group Mutation Present No Mutation Row Total
Patients a = 5 b = 3 8
Healthy Controls c = 1 d = 9 10
Column Total 6 12 n = 18
1

Why Fisher's: Expected for cell c = (10 × 6) / 18 = 3.33 < 5. Fisher's test required.

2

Two-tailed p-value: p = 0.044

3

Odds Ratio: OR = (5 × 9) / (3 × 1) = 45 / 3 = 15.0. The 95% CI is approximately [1.23, 183.2].

Result: p = 0.044 < α = 0.05 → Reject H₀. The mutation is significantly more common in patients than in healthy controls (OR = 15.0, p = 0.044). The wide confidence interval reflects the small sample size, and replication in a larger cohort is recommended — a standard expectation in genetic association research.

Example 6 — Website A/B Testing (Digital Marketing)

Worked Example 6 — A/B Testing (Marketing)

Problem: An e-commerce company tests two button colors. 18 visitors see the red button (Version A), 15 see the green button (Version B). 14 red-button visitors click; 7 green-button visitors click. Is the difference significant at α = 0.05?

Version Clicked (Yes) Did Not Click Row Total
Red Button (A) a = 14 b = 4 18
Green Button (B) c = 7 d = 8 15
Column Total 21 12 n = 33
1

Why Fisher's: Expected for cell b = (18 × 12) / 33 = 6.55. Expected for cell d = (15 × 12) / 33 = 5.45. Values are close to the threshold. Fisher's is appropriate given the borderline expected counts and the desire for an exact answer.

2

Two-tailed p-value: p = 0.048

3

Odds Ratio: OR = (14 × 8) / (4 × 7) = 112 / 28 = 4.0. Red-button visitors are 4 times more likely to click than green-button visitors.

Result: p = 0.048 < α = 0.05 → Reject H₀. The red button generated significantly higher click-through rates (OR = 4.0, p = 0.048). The company should consider adopting the red button, though a larger-scale test with more traffic is advisable to confirm the finding.

Example 7 — Product Defect Analysis (Manufacturing)

Worked Example 7 — Product Quality (Manufacturing)

Problem: A quality team compares defect rates between two production lines. Line A produces 12 units; 4 are defective. Line B produces 10 units; 1 is defective. Is the defect rate significantly different at α = 0.05?

Production Line Defective Non-Defective Row Total
Line A a = 4 b = 8 12
Line B c = 1 d = 9 10
Column Total 5 17 n = 22
1

Expected counts: Expected for cell c = (10 × 5) / 22 = 2.27 < 5. Fisher's Exact Test required.

2

Two-tailed p-value: p = 0.328

3

Odds Ratio: OR = (4 × 9) / (8 × 1) = 36 / 8 = 4.5

Result: p = 0.328 > α = 0.05 → Fail to reject H₀. Despite Line A having a higher observed defect rate (33% vs 10%), the difference does not reach statistical significance at this sample size. The quality team should increase the inspection window — more units are needed to detect a true difference of this magnitude with adequate power.

Example 8 — Pass Rate by Teaching Method (Education)

Worked Example 8 — Educational Outcomes

Problem: A university compares pass rates between students taught by traditional lecture (n = 14) and active learning (n = 11). 9 lecture students pass; 10 active-learning students pass. Is the difference significant at α = 0.05?

Method Passed Failed Row Total
Traditional Lecture a = 9 b = 5 14
Active Learning c = 10 d = 1 11
Column Total 19 6 n = 25
1

Expected count check: Expected for cell d = (11 × 6) / 25 = 2.64 < 5. Fisher's Exact Test required.

2

Two-tailed p-value: p = 0.164

3

Odds Ratio: OR = (9 × 1) / (5 × 10) = 9 / 50 = 0.18. Active learning students had higher pass odds than lecture students, but the sample is too small to confirm significance.

Result: p = 0.164 > α = 0.05 → Fail to reject H₀. Active learning produced a higher pass rate (90.9% vs 64.3%), and the odds ratio favors active learning, but the result does not reach statistical significance. This is a common outcome in education research: the effect may be real but the study is underpowered. Recruiting more students would allow a more definitive comparison.

Fisher's Exact Test vs Chi-Square Test

Both Fisher's Exact Test and the chi-square test of independence test whether two categorical variables are associated in a contingency table. The difference lies in how the p-value is calculated and when each method is valid.

Feature Fisher's Exact Test Chi-Square Test
Calculation method Exact hypergeometric probability Approximation (χ² statistic)
Best for small samples? Yes — no minimum n required No — unreliable when expected counts < 5
Expected cell count minimum None All expected counts ≥ 5
Valid with zero cells? Yes No
Table size Primarily 2×2; extensions exist for larger Any r×c table
One-tailed option Yes (directional hypothesis) No (always two-tailed)
Agreement at large n Converges to chi-square Converges to Fisher's
Software support R, SPSS, SAS, Stata, Python, SciPy All statistical software
⚠️
Fisher's Test and McNemar's Test

If your data are paired — for example, the same patients tested before and after treatment, or matched case-control pairs — Fisher's Exact Test is not appropriate. Use McNemar's Test for paired categorical data. Fisher's assumes independence between the two rows (groups).

Fisher's Exact Test vs McNemar's vs Logistic Regression

Question Best Test Why
Two independent groups, small n, 2×2 table Fisher's Exact Exact p-value, handles small cells
Two independent groups, large n, 2×2 table Chi-Square Approximation is reliable; faster computation
Paired/matched data (before/after, matched pairs) McNemar's Test Accounts for the dependency between paired observations
Multiple predictors of a binary outcome Logistic Regression Controls for confounders; estimates adjusted OR
Stratified analysis across multiple 2×2 tables Cochran-Mantel-Haenszel Combines evidence across strata

How to Interpret Fisher's Exact Test Results

Reporting Fisher's Exact Test results correctly involves more than noting whether p < 0.05. A complete report includes the p-value, the odds ratio, its confidence interval, and a plain-English statement of what the result means in context.

Interpreting the p-value

The p-value from Fisher's Exact Test is the probability of observing a contingency table at least as extreme as yours, given that the null hypothesis (independence) is true and the marginal totals are fixed. A small p-value (typically below 0.05) is evidence against independence — the two variables appear to be associated. It does not tell you the direction or size of the effect; that is the role of the odds ratio.

Interpreting the Odds Ratio

Odds Ratio Interpretation Example
OR = 1.0 No association between the two variables Treatment has no effect on outcome
OR > 1.0 Outcome is more likely in Group 1 than Group 2 OR = 3.0: outcome 3× more likely in treated group
OR < 1.0 Outcome is less likely in Group 1 than Group 2 OR = 0.2: outcome 80% less likely (protective factor)
95% CI excludes 1 Association is statistically significant at α = 0.05 CI [1.3, 12.7]: significant; CI [0.8, 4.2]: not significant
Wide CI Imprecise estimate — usually due to small sample size OR = 8.0, CI [0.9, 712]: statistically uncertain

How to Report Fisher's Exact Test in APA Format

Reporting Template
Fisher's Exact Test revealed a significant association between [Variable 1] and [Variable 2] (p = [value]). The odds ratio was [OR] (95% CI [lower, upper]), indicating that [Group 1] was [X times] more/less likely to [outcome] than [Group 2].

Example using Example 3 data: "Fisher's Exact Test revealed a significant association between vaccination status and flu infection (p = 0.012). Unvaccinated residents were significantly more likely to contract flu than vaccinated residents (OR = 13.0, 95% CI [1.9, 89.4])."

Real-World Applications of Fisher's Exact Test

Fisher's Exact Test appears across a wide range of research fields wherever small samples and categorical outcomes meet. The test is especially prevalent in early-phase research, where recruiting large samples is impractical or expensive.

🏥

Clinical Medicine

Pilot trials comparing treatment response, adverse event rates between drug and placebo, diagnostic test accuracy in small patient cohorts.

🧬

Genetics

Testing whether a rare genetic variant appears more often in affected individuals than controls; Hardy-Weinberg equilibrium testing in small populations.

🌍

Epidemiology

Outbreak investigations, vaccine effectiveness studies in small communities, comparing exposure prevalence between case and control groups.

🧪

Pharmaceutical Research

Phase I/II clinical trials, safety signal detection, comparing response rates when patient numbers are limited by disease rarity.

📊

Marketing & A/B Testing

Early-stage conversion testing, small-audience email campaigns, product feature comparison in beta testing groups.

🏭

Manufacturing QC

Comparing defect rates between production batches, pass/fail inspection comparisons between suppliers or machine operators.

🎓

Education Research

Pass/fail comparisons between teaching methods, dropout rate analysis in small classroom studies, comparing intervention outcomes.

🌱

Agriculture & Ecology

Germination success under two conditions, presence/absence of species in treated vs untreated plots, pest resistance in small field trials.

Common Mistakes in Fisher's Exact Test

Mistake What People Do Wrong What's Correct
Using chi-square with small n Run chi-square when expected cells < 5 Use Fisher's Exact Test; chi-square approximation is invalid
Misinterpreting the p-value "p = 0.03 means there's a 97% chance the treatment works" p = 0.03 means: if H₀ were true, this result would occur only 3% of the time
Ignoring the odds ratio Reporting only p < 0.05 without effect size Always report OR and 95% CI; p alone tells you nothing about effect magnitude
Using Fisher's for paired data Applying Fisher's to before/after or matched pairs Use McNemar's Test; Fisher's assumes independence between rows
One-tailed vs two-tailed confusion Choosing one-tailed after seeing the data to get a smaller p Choose tail direction based on prior hypothesis, before seeing data
Over-interpreting non-significance "p = 0.12 proves no effect" Non-significance may reflect insufficient power, not absence of effect
Not checking OR direction Reporting significant p without noting which group has higher odds Always state which group has higher/lower odds and by how much

The EXACT Framework

The EXACT Framework is an original five-step mental model for applying Fisher's Exact Test correctly. It was designed to help researchers work through the test systematically and avoid the common errors listed above.

Original Framework — Statistics Fundamentals

The EXACT Framework for Fisher's Exact Test

E
Examine the categorical variables

Confirm both variables are categorical with exactly two categories each. Verify observations are independent (not paired or repeated).

X
eXplore the contingency table

Build the 2×2 table. Compute all row totals, column totals, and the grand total n. Check that every observation is counted exactly once.

A
Assess expected counts and tail direction

Compute expected counts (row total × column total / n) for all cells. If any expected count < 5, Fisher's test is required. Set your tail direction (one-tailed vs two-tailed) based on your prior hypothesis.

C
Calculate the exact probability

Apply the hypergeometric formula to your observed table. Sum probabilities across all tables at least as extreme. This sum is your p-value.

T
Test the hypothesis and report the result

Compare p to α. Report the p-value, odds ratio, 95% CI, and a plain-English conclusion stating what the result means for the research question.

Interactive Fisher's Exact Test Calculator

Enter the four cell counts from your 2×2 contingency table below. The calculator computes the exact p-value using the hypergeometric distribution, the odds ratio, and the test decision at α = 0.05. The marginal totals are calculated automatically.

🔬 Fisher's Exact Test Calculator — 2×2 Contingency Table

Outcome: Yes
Outcome: No
Group 1
Group 2

Glossary of Key Terms

Term Symbol Definition
Fisher's Exact Test Hypothesis test for association between two categorical variables using exact hypergeometric probabilities
Contingency Table A table organizing counts of observations by categories of two variables; a 2×2 table has four cells
Hypergeometric Distribution Probability distribution describing draws without replacement from a finite population; the basis of Fisher's exact probability
p-value p Probability of observing the data (or more extreme data) if the null hypothesis were true
Odds Ratio OR Ratio of the odds of the outcome in Group 1 to the odds in Group 2; calculated as (a×d)/(b×c)
Null Hypothesis H₀ The default assumption of independence — that the two categorical variables are not associated
Alternative Hypothesis H₁ The claim being tested — that the two variables are associated
Significance Level α The pre-set probability threshold for rejecting H₀; conventionally 0.05 in most fields
Confidence Interval CI A range of plausible values for the true odds ratio; a 95% CI excludes 1 when the test is significant at α = 0.05
Expected Cell Count E The count expected in a cell under H₀: E = (row total × column total) / n; Fisher's test is used when any E < 5
Two-tailed test Tests for any association, regardless of direction; p-value sums probabilities of tables as extreme in either direction
One-tailed test Tests for a directional association (e.g., Group 1 has higher odds); valid only when direction is pre-specified
McNemar's Test Correct alternative to Fisher's test for paired or matched categorical data
Relative Risk RR Ratio of outcome probability in Group 1 to probability in Group 2; available for cohort studies (not case-control)
Small Sample Generally n < 20, or more precisely: any expected cell count below 5; the defining criterion for using Fisher's test

Running Fisher's Exact Test in Statistical Software

Every major statistics platform includes Fisher's Exact Test. The syntax differs slightly between packages, but the underlying calculation is the same.

R (Base Package)
matrix_data <- matrix(c(a, b, c, d), nrow = 2)
fisher.test(matrix_data)
# Returns: p.value, odds.ratio, conf.int
Python (SciPy)
from scipy.stats import fisher_exact
table = [[a, b], [c, d]]
odds_ratio, p_value = fisher_exact(table, alternative='two-sided')
SPSS
CROSSTABS /TABLES=group BY outcome
/STATISTICS=CHISQ
/CELLS=COUNT EXPECTED
/METHOD=EXACT TIMER(5).

The SciPy documentation and R documentation for fisher.test both provide extended parameter options including one-tailed testing and confidence interval computation.

Frequently Asked Questions

Fisher's Exact Test is a statistical test used to determine whether there is a significant association between two categorical variables arranged in a 2×2 contingency table. Rather than using the chi-square approximation, it calculates an exact p-value based on the hypergeometric distribution. The test is named after Ronald A. Fisher, who introduced it in 1922 using the Lady Tasting Tea experiment as a demonstration. It is especially useful — and required — when expected cell counts are below 5, which is common in small-sample research in medicine, genetics, and epidemiology.

Use Fisher's Exact Test when any expected cell count in your 2×2 contingency table is below 5, when your total sample size is below 20, when any cell contains a count of zero, or when you need an exact rather than approximate p-value. The chi-square test is an approximation that works well only with large expected counts. Fisher's test has no minimum sample size requirement and produces exact results regardless of n. A commonly cited guideline: compute the expected counts first (row total × column total / n for each cell), and if any fall below 5, use Fisher's test.

For a 2×2 table with cells a, b, c, d, the exact probability of that specific table is: P = [(a+b)! × (c+d)! × (a+c)! × (b+d)!] / [n! × a! × b! × c! × d!], where ! denotes factorial and n = a+b+c+d. The two-tailed p-value is the sum of this probability for every possible table with the same marginal totals that has a probability equal to or smaller than P(observed). List all possible values for cell a (from 0 to its maximum), compute P for each, and sum those with P ≤ P(observed). Example 1 and Example 2 on this page show the full arithmetic for small tables.

The odds ratio (OR) measures the strength and direction of the association between the two variables. OR = (a × d) / (b × c). An OR of 1.0 means no association. An OR greater than 1 means the outcome is more likely in Group 1 than Group 2 — an OR of 4.0 means Group 1 has four times the odds of the outcome compared to Group 2. An OR less than 1 means the outcome is less likely in Group 1, indicating a protective effect. A 95% confidence interval for the OR that excludes 1 corresponds to a statistically significant Fisher's test at α = 0.05. Always report the OR and its CI alongside the p-value — p alone tells you nothing about how large or practically meaningful the effect is.

Yes. Fisher's Exact Test is statistically valid at any sample size. It is not restricted to small samples — that is only when it is strictly necessary compared to chi-square. For large samples, the Fisher's exact p-value and the chi-square p-value converge to the same value, so the choice becomes one of preference. Some statisticians use Fisher's test by default for all 2×2 tables to ensure exact results, while others reserve it for situations where expected counts are below 5. Computationally, Fisher's test is demanding for very large n (rare extreme tables become numerous), but modern software handles this instantly.

Fisher's Exact Test has four assumptions: (1) both variables are categorical with exactly two categories each; (2) observations are independent — each subject contributes to one cell only; (3) the two groups (rows) are independent — not paired or matched; (4) a fixed total sample size. The test does not assume normality, does not require large samples, and does not impose a minimum expected count. If your data are paired (before/after measurements on the same subjects, or matched case-control pairs), McNemar's Test is the correct alternative.

A two-tailed Fisher's Exact Test tests whether there is any association between the two variables in either direction. The p-value sums probabilities for all tables at least as extreme as the observed one, in both tails of the hypergeometric distribution. A one-tailed test (also called a one-sided test) is appropriate when you have a pre-specified directional hypothesis — for example, you predict before collecting data that Group 1 will have higher odds than Group 2. The one-tailed p-value is smaller (typically about half the two-tailed value) because you are only summing extreme tables in one direction. Choosing one-tailed after seeing the data to make the result significant is statistically invalid — the direction must be specified a priori.