Fisher's exact test calculator

Enter the four counts of a 2×2 table to test whether the two variables are associated. The p-value is exact, so the test works for small samples where a chi-square test is unreliable.

Between 0 and 1, usually 0.05. The result line uses the two-sided p-value.
p-value, two-sided0.03497
Result at α
p < α: significant association
p-value, one-sided (a this small or smaller)
0.9991
p-value, one-sided (a this large or larger)
0.02448
Probability of this exact table
0.0236
Sample odds ratio (ad/bc)
20
Proportion yes in group 1
0.8
Proportion yes in group 2
0.166667
Total count
16

Runs in your browser: nothing you enter is sent anywhere.

How to use it

  1. Arrange your data as a 2×2 table: rows are the two groups, columns are the two outcomes.
  2. Enter the four counts a, b (first row) and c, d (second row).
  3. Read the two-sided p-value, or a one-sided one if you chose a direction in advance.
Outcome yes Outcome no
Group 1 a b
Group 2 c d

How the test works

With the row and column totals fixed, the count a follows the hypergeometric distribution:

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

where C(n, k) is the number of ways to choose k items from n. The calculator lists every table with the same totals:

  • Two-sided p = sum of P over all tables no more likely than the observed one (with a relative tolerance of 10⁻⁷ for rounding).
  • One-sided p = sum of P over tables with a as small or smaller, or as large or larger.

Worked example

Group 1: 8 yes, 2 no. Group 2: 1 yes, 5 no. Row totals 10 and 6, column totals 9 and 7, n = 16, and C(16, 9) = 11 440 tables in all.

Possible values of a run from 3 to 9, with counts C(10, a) × C(6, 9 − a) of 120, 1260, 3780, 4200, 1800, 270 and 10. The observed a = 8 has 270, so P = 270/11 440 = 0.024. Tables no more likely: a = 3 (120), 8 (270) and 9 (10), so the two-sided p = 400/11 440 = 0.035: significant at 0.05. The one-sided p for larger a is (270 + 10)/11 440 = 0.024.

Tips and common mistakes

  • Enter counts of people or items, not percentages.
  • Each subject must appear in exactly one cell. For paired yes/no data on the same subjects, use McNemar’s test.
  • Decide on one-sided or two-sided before looking at the data.

Frequently asked questions

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

When the sample is small, and especially when any expected count is below 5. The chi-square test relies on an approximation that breaks down there, while Fisher's test computes the probability exactly. It works for large tables too, it just takes longer.

How is the two-sided p-value defined?

It adds the probabilities of every table with the same row and column totals that is no more likely than the one you observed. This is the usual definition, used by R and most statistics packages.

Why is the odds ratio different from R's fisher.test?

The calculator shows the simple sample odds ratio ad/bc. R reports a conditional maximum-likelihood estimate, which is usually a little closer to 1. Use the odds ratio calculator for a confidence interval.

Can I use it for a 2×3 or larger table?

No, this calculator handles 2×2 tables. For larger tables use the chi-square calculator, keeping its assumptions in mind.

More in Math

All tools in this category: Math ·Updated November 4, 2026

Privacy choices

Google Analytics shows us which tools are used and whether they work. It may set cookies. Your choice is kept in this browser.