🧮
🧮 Math & statistics

Fisher's Exact Test Calculator (2×2 table, one- and two-sided p)

Results update as you type.

Your numbers

Understanding the Fisher's exact test calculator — concept and principle

This calculator runs Fisher's exact test on a 2 × 2 table, such as treatment versus control and success versus failure. It gives the two-sided and one-sided p-values, the probability of the observed table, the sample odds ratio and the proportions in each group. Use it when counts are small and the chi-square test is unreliable.

Fisher's exact test2 × 2 table, N = 22yesnoGroup 19375 %Group 22820 %This table0.01403Odds ratio12two-sided p = 0.02997
It adds the exact probabilities of all tables at least as extreme, with the margins fixed.

How it is calculated

With row totals R₁ = a + b, R₂ = c + d, column totals C₁ = a + c, C₂ = b + d and total N fixed:

P(table) = R₁! R₂! C₁! C₂! ÷ (N! a! b! c! d!) (hypergeometric probability)

The principle

If group and outcome are unrelated, then given the totals, which of the yes outcomes fall into group 1 is like drawing cards from a deck without replacement. The hypergeometric formula gives the exact chance of each possible split. The p-value adds up how likely the observed split, or a more extreme one, would be by chance alone. Because it uses exact probabilities instead of a large-sample approximation, it stays valid for small counts.

Worked example

Default inputs: group 1: 9 yes, 3 no; group 2: 2 yes, 8 no.

  1. Proportions yes: 9 ÷ 12 = 75 % and 2 ÷ 10 = 20 %; total N = 22.
  2. Probability of this exact table = 0.01403.
  3. One-sided p (a this large or larger) = 0.01499; one-sided p (a this small or smaller) = 0.999.
  4. Two-sided p = 0.02997: significant (p ≤ 0.05).
  5. Sample odds ratio = (9 × 8) ÷ (3 × 2) = 12.
How Two-sided p-value changes with Group 2 · outcome no (d)How Two-sided p-value changes with Group…00.20.40.62468101216Example: 0.02997Group 2 · outcome no (d)
Each point is the calculator re-run with only “Group 2 · outcome no (d)” changed; the gold point is the default example. Change the inputs above and this chart follows your numbers.
Group 2 · outcome no (d)Two-sided p-value
20.5467
40.1414
60.06478
80.02997
100.01228
120.004314
160.001221

How to read the result

A two-sided p of about 0.03 means that, if there were no real difference, a split at least this uneven would happen about 3 times in 100. The odds ratio of 12 shows the size of the difference: the odds of yes are 12 times higher in group 1. With such small groups the estimate is very uncertain, so report a confidence interval as well.

Common mistakes

Keep in mind: Statistical significance does not show cause and effect or practical importance. Study design matters more than the test.

Frequently asked questions

When should I use Fisher's exact test?

For 2 × 2 tables with small expected counts, typically below 5 in some cell.

What is the difference between one- and two-sided p?

One-sided tests a difference in a stated direction; two-sided counts extreme tables in either direction.

What does an odds ratio of 12 mean?

The odds of the outcome are 12 times higher in group 1 than in group 2.

Sources: A. Agresti (2013), Categorical Data Analysis, 3rd ed., Wiley (Fisher's exact test for 2 × 2 tables) · R. A. Fisher (1935), The Design of Experiments, Oliver & Boyd

Checked 9 Nov 2026. Weisstein, E. W., “Fisher’s Exact Test”, Wolfram MathWorld (table probability P = R₁!R₂!C₁!C₂! ÷ (N!·∏aᵢⱼ!); for 2×2 tables the p-value is the sum of the probabilities of all tables with P ≤ P of the observed table; worked example [[5, 0], [1, 4]] → p = 0.0476).

🧮 All math & statistics tools →🌍 Calculators by country →