What is a Fisher’s Exact Test Calculator?
A Fisher’s exact test calculator gives the exact p-value for association in a 2×2 table of counts. With the row and column totals held fixed, it assigns every possible table a hypergeometric probability and adds up the tables no more likely than the one observed. Example: 8 of 10 patients recover on a new treatment versus 3 of 12 on the standard one, giving a two-sided p = 0.0300 and an odds ratio of 12, so recovery is associated with treatment at α = 0.05.
What the Fisher’s Exact Test Calculator does
Enter the four counts of a 2×2 table and choose a two-sided or one-sided alternative. The calculator returns the exact p-value, the sample odds ratio, the probability of the observed table and all three p-values (two-sided, less, greater). It lists every possible table with the same margins, with its probability and whether it counts toward the p-value, draws the null distribution and writes out each step with the binomial coefficients.
Use Fisher’s test instead of the chi-square test when a 2×2 table has small expected counts (any below 5), as in pilot studies, rare side effects, small clinical samples or A/B tests with few conversions. For large samples the two tests agree closely, so Fisher’s test is never wrong to use; it is just more computation.
Fisher’s exact test, the Fisher exact test, the Fisher–Irwin test and the “Fisher test” are the same 2×2 calculation, so this works as a Fisher exact calculator for any of those names. It is not the F-test: the Fisher–Snedecor F distribution compares two variances, which the F-Test Calculator handles.
How to use the Fisher’s Exact Test Calculator
- Enter the counts in the 2×2 table of counts: rows are the two groups, columns are the “yes” and “no” outcomes. Use counts of subjects, not percentages.
- Pick the alternative hypothesis (H₁). Two-sided tests any association; “less” and “greater” test whether group 1’s odds of “yes” are lower or higher than group 2’s.
- Set the significance level (α), usually 0.05.
- Read the p-value, the decision and the odds ratio, then open the step-by-step solution and the table of every possible table to see exactly which tables were summed.
How to calculate Fisher’s exact test by hand
The calculator follows the same five steps you would use on paper:
- Write the table as a, b (group 1) and c, d (group 2), and find the row totals r₁ = a + b, r₂ = c + d, the first column total c₁ = a + c and N.
- With the margins fixed, the top-left cell decides the whole table. List every possible value of a, from max(0, c₁ − r₂) to min(r₁, c₁).
- Give each possible table its hypergeometric probability, P(a) = C(r₁, a) · C(r₂, c₁ − a) / C(N, c₁). The probabilities add up to 1.
- For the two-sided p-value, add the probabilities of every table whose probability is less than or equal to that of the observed table. For a one-sided test, add the observed table and the tables beyond it in the chosen direction.
- Reject H₀ (no association) if p ≤ α, and report the odds ratio (a · d) / (b · c) to show the direction and size of the effect.
Fisher’s exact test formula
For a 2×2 table with cells a, b, c, d, the probability of the observed table with its margins fixed is the hypergeometric probability below. Written with factorials it is P = (a + b)! (c + d)! (a + c)! (b + d)! / (a! b! c! d! N!).
| Symbol | Meaning |
|---|---|
| a, b, c, d | cell counts: top-left, top-right, bottom-left, bottom-right |
| N | total count a + b + c + d |
| C(n, k) | binomial coefficient, “n choose k” |
| x | possible values of the top-left cell given the margins |
The two-sided p-value here sums every table no more probable than the observed one, the same rule used by R’s fisher.test and SciPy’s fisher_exact. Some older texts instead double the smaller one-sided p-value, which can give a different answer for unbalanced tables.
R’s fisher.test reports the conditional maximum-likelihood odds ratio, which is usually closer to 1 than the sample odds ratio shown here (10.40 versus 12 for the example below). SciPy’s fisher_exact reports the sample odds ratio.
Worked example
A small treatment trial (the default table)
Problem. Of 10 patients on a new treatment, 8 recovered and 2 did not; of 12 on the standard treatment, 3 recovered and 9 did not. Is recovery associated with treatment (two-sided, α = 0.05)?
- 01Margins: r₁ = 10, r₂ = 12, c₁ = 11, N = 22, so a can range from 0 to 10.
- 02P(a = 8) = C(10, 8) × C(12, 3) / C(22, 11) = 45 × 220 / 705,432 = 0.0140.
- 03Tables no more likely than this one are a = 0, 1, 2, 8, 9 and 10, with probabilities 0.000017, 0.000936, 0.0140, 0.0140, 0.000936 and 0.000017.
- 04Two-sided p = their sum ≈ 0.0300.
- 05Sample odds ratio = (8 × 9) / (2 × 3) = 12.
Answer. p ≈ 0.030 < 0.05, so reject H₀: recovery is associated with treatment, and the odds of recovery are about 12 times higher on the new treatment. The one-sided p for OR > 1 is about 0.0150.
How to interpret the p-value and odds ratio
The p-value is the probability, if the outcome had nothing to do with the group, of getting a table at least as unlikely as yours with the same row and column totals. A small p (at or below α) means the split you saw is hard to explain by chance alone. A large p does not prove there is no association; with small samples the test simply has little power.
The odds ratio gives direction and size. OR = 1 means the same odds of “yes” in both groups, OR > 1 means group 1 has higher odds and OR < 1 lower odds. For the default table, OR = 12: the odds of recovery are 8/2 = 4 on the new treatment and 3/9 ≈ 0.333 on the standard one, and 4 / 0.333 = 12. With samples this small the odds ratio is imprecise, so treat 12 as “much higher odds”, not as an exact multiplier.
Fisher’s exact test vs the chi-square test
The chi-square test approximates the p-value with a continuous distribution, while Fisher’s test adds up exact table probabilities. On the default table, where the expected counts are 5, 5, 6 and 6, the methods give noticeably different answers:
| Method | Statistic | Two-sided p | What it assumes |
|---|---|---|---|
| Fisher’s exact test | P(observed) = 0.0140 | 0.0300 | Both margins fixed; exact at any n |
| Chi-square, no correction | χ² = 6.600 | 0.0102 | Large expected counts (all ≥ 5) |
| Chi-square with Yates correction | χ² = 4.583 | 0.0323 | Large expected counts; closer to Fisher |
| Barnard’s exact test | Wald z, pooled | 0.0169 | Only the group sizes fixed; less conservative |
Fisher’s exact test for 2×3, 2×4 and larger tables
This calculator handles 2×2 tables. The same idea extends to an r × c table as the Freeman–Halton test: it sums the probabilities of every table with the same margins that is no more likely than the observed one. The number of possible tables grows very fast, so it is usually run in software, such as fisher.test() in R, which accepts any r × c table.
For a 2×3 or 2×4 table you have three practical options. If every expected count is at least 5, use the Chi-Square Test of Independence Calculator, which accepts tables up to 10 × 10. If the question is really about one pair of categories, collapse the table to 2×2 and run Fisher’s test here. Otherwise run the Freeman–Halton test in R or another statistics package.
Where the test comes from: the lady tasting tea
R. A. Fisher set out the test in the 1930s (J. O. Irwin and F. Yates published closely related work at the same time, hence the name Fisher–Irwin test). His best-known illustration, in The Design of Experiments (1935), is a colleague who claimed she could tell whether milk or tea had been poured into the cup first. She is given 8 cups, 4 of each kind, and told to pick the 4 milk-first cups.
Both margins are fixed by the design, which is exactly the condition Fisher’s test assumes. Picking all 4 correctly by chance has probability 1 / C(8, 4) = 1/70 = 0.0143. Getting 3 of 4 right, the table 3, 1 / 1, 3, has a one-sided p-value of 17/70 = 0.2429, far too likely to rule out guessing. Enter 3, 1, 1, 3 and choose “Greater” to check it.
Sources and software conventions
The p-values on this page follow the same two-sided rule as R’s fisher.test and SciPy’s scipy.stats.fisher_exact, and every number in the worked example and the comparison table was checked against SciPy. For background, see R. A. Fisher, The Design of Experiments (1935), and A. Agresti, Categorical Data Analysis, which covers exact tests for 2×2 and r × c tables and the conservativeness of conditional tests.
Common use cases
- Small clinical or pilot studies with a binary outcome in two groups.
- Rare events, such as side effects or defects, where some cells have counts of 0 to 5.
- Checking a 2×2 chi-square result when expected counts are below 5.
- Lab experiments with few subjects, such as treated versus untreated samples showing a response.
- A/B or email tests with only a handful of conversions in each version.
Assumptions and limitations
- 2×2 only here. Larger tables need the Freeman–Halton extension (see the section on 2×3 and 2×4 tables above); for big tables with adequate counts, the Chi-Square Test of Independence Calculator is the standard choice.
- Independent observations: each subject counts once, and the groups are separate. Paired yes/no data need McNemar’s test.
- Because it conditions on both margins, Fisher’s test is somewhat conservative (its actual false-positive rate is at or below α). Mid-p or unconditional tests such as Barnard’s are less conservative alternatives.
- The odds ratio is not the same as a ratio of proportions (relative risk). For large samples, the Two Proportion Z-Test Calculator compares the proportions directly.
Frequently asked questions
When should I use Fisher’s exact test instead of chi-square?
How is the two-sided p-value of Fisher’s exact test calculated?
What does the odds ratio mean in Fisher’s exact test?
Can Fisher’s exact test be used with large samples?
Can I use Fisher’s exact test for a 2×3 or 2×4 table?
How do I report Fisher’s exact test results?
What if one cell of my table is zero?
Cite this page
Statculator. (2026, November 14). Fisher’s Exact Test Calculator. Retrieved November 14, 2026, from https://statculator.com/hypothesis-tests/fishers-exact-test-calculator/