Skip to content
Omnikalc

Fisher's exact test: compare two proportions with small samples

Enter a 2 × 2 table to get the exact p-value (two-sided or one-sided), the odds ratio and both proportions, with the chi-square p-value for comparison.

Updated on
Your inputs

Value out of range

Value out of range

Value out of range

Value out of range

Results

Exact p-value

0.06978

Not significant: p is at or above α, so the data do not reject the null hypothesis
Proportion with the outcome, group 1
80.0%
Proportion with the outcome, group 2
30.0%
Odds ratio (a × d) ÷ (b × c)
9.333
Risk ratio
2.667
Chi-square p-value without correction, for comparison
0.02462
Probability of this exact table
0.03215

What Fisher’s exact test does

Fisher’s exact test compares two proportions in a 2 × 2 table, such as the success rate of a treatment against a control, without relying on the large-sample approximation behind the chi-square test. It computes the exact probability of every table with the same row and column totals as yours, using the hypergeometric distribution, and adds up those that are at least as extreme. It is the test of choice when some expected counts are below 5.

How the p-value is computed

With the table

Outcome No outcome
Group 1 a b
Group 2 c d

and all margins fixed, the probability of a given value of a is

P(a) = C(a + b, a) × C(c + d, c) ÷ C(n, a + c)

  • Two-sided p-value: sum of the probabilities of all tables that are no more likely than the observed one.
  • One-sided p-value: sum over the tables at least as extreme in the chosen direction.

The calculator enumerates every possible table exactly, which is fast even for totals in the thousands.

Example

8 of 10 patients improve with a new treatment, against 3 of 10 with the standard one:

  • proportions: 80% and 30%;
  • odds ratio: (8 × 7) ÷ (2 × 3) ≈ 9.3; risk ratio ≈ 2.67;
  • exact two-sided p ≈ 0.070: not significant at α = 0.05;
  • the uncorrected chi-square test would give p ≈ 0.025 and suggest significance. With expected counts of 5.5 and 4.5, that approximation is unreliable here.

The example shows why Fisher’s test matters: with small samples, the chi-square approximation can overstate the evidence.

When to use it

  • Small samples, or any expected cell count below 5.
  • Rare outcomes, such as adverse events in a trial.
  • Whenever an exact answer is preferred; modern software makes it practical for large tables too.

Points to keep in mind

  • Fisher’s test is conservative: because the margins are fixed, its actual false-positive rate is often below α. Some statisticians prefer Barnard’s or Boschloo’s tests, which are more powerful.
  • The two-sided p-value is not simply twice the one-sided one; this calculator uses the standard method of summing tables with probability no greater than the observed one.
  • The sample odds ratio shown is the simple (a × d) ÷ (b × c). It is infinite when b or c is zero; software then reports a conditional maximum likelihood estimate instead.
  • For tables larger than 2 × 2, the Fisher–Freeman–Halton extension applies the same idea.

Frequently asked questions

When should I use Fisher's exact test instead of chi-square?

When any expected cell count is below 5, or the sample is small. It gives an exact p-value instead of an approximation.

Is Fisher's exact test one-tailed or two-tailed?

Either. The two-sided version adds all tables no more likely than the observed one; the one-sided version adds tables in one direction.

Can Fisher's test be used for large samples?

Yes. It remains valid, and modern software computes it quickly; the result is then close to the chi-square test.

Why is Fisher's exact test called conservative?

Because it fixes both margins, its actual false-positive rate is usually below the nominal α.

Was this calculator helpful?

Thanks for your feedback!

Results are estimates provided for information purposes. They do not replace professional advice.