Is 9 of 12 against 4 of 15 a real difference? Type the four counts of a 2x2 table and get the exact p-value, the odds ratio with its interval, the risk ratio and the smallest expected count.
Fisher's Exact Test Calculator - 2x2 P-Value and Odds Ratio
Is 9 of 12 against 4 of 15 a real difference? Type the four counts of a 2x2 table and get the exact p-value, the odds ratio with its interval, the risk ratio and the smallest expected count.
Parameters
Enter data for calculations
💡 Fill in all required fields to unlock the calculate button
Fisher's exact test for a 2×2 table, with the odds ratio and its interval
Two groups, one yes-or-no outcome, and counts too small to trust a chi-square approximation: that is the job this calculator does. Type the four cells of the table, choose a two-sided or one-sided hypothesis and a significance level, and it returns the exact p-value, the odds ratio with an exact confidence interval, the risk ratio and the difference in rates. For 9 of 12 in one group against 4 of 15 in the other, the two-sided p is 0.0213 and the odds ratio is 7.52, with a 95% interval from 1.14 to 68.03.
It also shows the smallest expected count, which is the number that tells you whether you needed an exact test in the first place, and for small tables it lists every table that shares your row and column totals, so you can see exactly which ones went into the p-value.
Problem: the chi-square test calls it significant, and the counts do not back it up
The gap is not rare. With 0 of 12 against 4 of 12, chi-square says p = 0.0285 and the exact test says 0.0932. With 7 of 8 against 2 of 10, chi-square gives 0.0044 and the exact test 0.0152, still significant but three times weaker. Yates' continuity correction pulls chi-square back toward the exact answer, and sometimes past it, which is why it is a patch rather than a fix.
Which test fits your table
The deciding facts are the design and the expected counts, not the total sample size on its own. The calculator prints the smallest expected count under the table, so you can read your row straight off this chart.
| Your situation | Use | Why |
|---|---|---|
| Any expected count below 5 | Fisher's exact test | the chi-square curve misfits, the exact sum does not |
| All expected counts 5 or more, two independent groups | Either; chi-square is the usual default | the two p-values land close together |
| The same people measured twice (before and after) | McNemar's test | the rows are not independent groups |
| More than two groups or outcomes | Chi-square test of independence, or Fisher-Freeman-Halton | this tool handles 2×2 only |
| The outcome is a measurement, not yes or no | t-test or a rank test such as Wilcoxon | counting yes and no throws the numbers away |
What the calculator does instead of approximating
The four cells and two choices, in order
- Group 1, with the outcome - how many in the first group had the event: clicked, passed, recovered, failed. Whole counts only, never a percentage.
- Group 1, without the outcome - the rest of that group. The two cells together must equal the group size.
- Group 2, with the outcome - the same count for the comparison group: control, placebo, version A. Zero is allowed.
- Group 2, without the outcome - the rest of the comparison group.
- Alternative hypothesis - two-sided unless you wrote down the expected direction before collecting data. When the data lean the predicted way, one-sided p is smaller than two-sided, often close to half of it, though not exactly (see the questions below).
- Significance level - 0.05 for most work, 0.01 when you run many comparisons or a false alarm is expensive, 0.10 for early exploratory looks. It also sets the width of the odds ratio interval.
- Names (optional) - labels for the two groups and the outcome. They only change the result table.
- Read the result - the p-value and verdict on top, then the odds ratio and its interval, the difference in rates and the smallest expected count.
Seven tables run through the calculator
Each row is a real input and the exact output, two-sided unless marked. Notice how often a double-digit gap in rates still misses 0.05 when the groups are small.
| Situation | Group 1 | Group 2 | p | Odds ratio (95% CI) |
|---|---|---|---|---|
| Pass rate after a tutoring program | 9 of 12 | 4 of 15 | 0.0213 | 7.52 (1.14 to 68.03) |
| Lab mice responding to a compound | 7 of 8 | 2 of 10 | 0.0152 | 21.40 (1.53 to 1,413) |
| Complications, new protocol vs old | 1 of 20 | 6 of 20 | 0.0915 | 0.13 (0.0025 to 1.25) |
| Same, one-sided "fewer on the new protocol" | 1 of 20 | 6 of 20 | 0.0457 | only if the direction was set in advance |
| Defects on two production lines, one with zero | 0 of 12 | 4 of 12 | 0.0932 | 0 (0 to 1.34) |
| Email A/B test on a small list, sign-ups | 14 of 100 | 5 of 100 | 0.0513 | 3.08 (0.99 to 11.38) |
| Fisher's tea-tasting table | 3 of 4 | 1 of 4 | 0.4857 | 6.41 (0.21 to 626.24) |
The A/B row is worth a second look: 14% against 5% is almost three times the sign-up rate, and p still lands at 0.0513 with an interval that starts just under 1. The one-sided p for the same table is 0.0257, which is exactly why the direction has to be fixed before the test, not after the numbers come in.
How small a group can still reach p below 0.05
Take two equal groups and the most lopsided result possible: everyone in group 1 has the outcome, nobody in group 2 does. These are the smallest p-values each group size can ever produce. Below 4 per group, no result at all can reach 0.05 two-sided.
| Per group | Best possible split | Two-sided p | One-sided p |
|---|---|---|---|
| 3 | 3 of 3 vs 0 of 3 | 0.1000 | 0.0500 |
| 4 | 4 of 4 vs 0 of 4 | 0.0286 | 0.0143 |
| 5 | 5 of 5 vs 0 of 5 | 0.0079 | 0.0040 |
| 6 | 6 of 6 vs 0 of 6 | 0.0022 | 0.0011 |
| 8 | 8 of 8 vs 0 of 8 | 0.0002 | below 0.0001 |
Flip it around: with 10 per group and all 10 successes in group 1, group 2 can have at most 5 for the difference to count at 0.05. With 20 per group and 20 of 20 in group 1, group 2 can reach 15. A pilot of four or five per arm can only ever detect an all-or-nothing effect.
What people ask before trusting the p-value
Related tools
Wilcoxon Test Calculator
When the outcome is a measurement: signed-rank for pairs, Mann-Whitney U for two groups - See calculator
Interquartile Range Calculator
Quartiles, outlier fences and a box plot for any list of numbers - See calculator
Probability Calculator
Single, combined and conditional probabilities of events - See calculator
Combinations & Permutations Calculator
The counting behind every table probability the test adds up - See calculator
Percentage Calculator
Rates, percentage points and percent change between two groups - See calculator
Standard Deviation Calculator
Spread of a measured variable, when the outcome is a number rather than yes or no - See calculator
Scientific Notation Calculator
Reading very small p-values written as powers of ten - See calculator