Fisher’s exact test calculator

This Fisher’s exact test calculator compares two proportions from a 2 × 2 table when the counts are too small for a chi-square test. Enter the four counts and get the exact two-sided p value, both one-sided p values and the odds ratio.

The numbers are calculated in your browser. Nothing you enter is sent or stored.

Fisher’s exact test calculatorOr describe it in Studio →
Outcome: yesOutcome: no
Group 1
Group 2

Enter whole-number counts. Each subject is counted in exactly one cell.

Two-sided p value

0.4857

No significant difference between the two groups.

Group 1 with outcome
3/4 (75%)
Group 2 with outcome
1/4 (25%)
Odds ratio
9
One-sided p (group 1 higher)
0.2429
One-sided p (group 1 lower)
0.9857

To report

Fisher’s exact test, p = .486 (two-sided), OR = 9, N = 8

Check your result: the two one-sided p values always add up to more than 1, by exactly the probability of the observed table: 17/70 + 69/70 = 1 + 16/70. The two-sided p is never larger than 1, and the odds ratio is (a × d) ÷ (b × c).
two-sided p in the worked example
0.4857
two-sided p in the worked example
odds ratio in the example
9
odds ratio in the example
largest total count
100,000
largest total count
p values: two-sided and both one-sided
3
p values: two-sided and both one-sided
  • Exact p, no approximation
  • Two-sided and one-sided
  • Odds ratio
  • Works with zeros and small counts
  • Runs in your browser, free

01

How to use the calculator

  1. Put your two groups in the rows (for example treatment and control) and the two outcomes in the columns (for example recovered and not recovered).
  2. Enter the number of subjects in each of the four cells.
  3. Read the two-sided p value, unless you predicted the direction before collecting the data.
abcdoutcome: yesoutcome: nogroup 1group 2risk in group 1 = a ÷ (a + b)
The four cells of a 2 × 2 table. Rows are the two groups you compare; columns are the two outcomes. Every measure on this page is a way of combining a, b, c and d. Check which way round your table is before reading the result: swapping rows or columns inverts ratios.

02

When to use Fisher’s exact test

Use it for a 2 × 2 table of counts when any expected count is below 5, which is where the chi-square approximation becomes unreliable. It is valid for any sample size, so it is also a safe choice when you are unsure. The chi-square calculator shows the expected counts and warns when they are too small.

As with chi-square, each subject must be counted once. Paired before-and-after data need McNemar’s test.

03

How the exact p value is calculated

With the row and column totals fixed, the probability of a table with cells a, b, c, d and total n follows the hypergeometric distribution:

p(table) = (a+b)! (c+d)! (a+c)! (b+d)! ÷ (n! a! b! c! d!)

The two-sided p value adds up the probabilities of every possible table that is as probable as the observed one or less. A one-sided p value adds up the tables at least as extreme in one direction.

04

Worked example

The calculator opens with this table:

Outcome: yesOutcome: no
Group 131
Group 213

With all margins equal to 4, the first cell can be 0, 1, 2, 3 or 4, with probabilities 1/70, 16/70, 36/70, 16/70 and 1/70. The observed table (3) has probability 16/70. Tables that probable or less are those with 0, 1, 3 or 4:

p = (1 + 16 + 16 + 1) ÷ 70 = 0.4857

The one-sided p value (3 or more) is 17/70 = 0.2429, and the odds ratio is (3 × 3) ÷ (1 × 1) = 9. Eight subjects are far too few to show a difference, even with 75% against 25%.

05

The odds ratio

odds ratio = (a × d) ÷ (b × c)

An odds ratio of 1 means the outcome is equally likely in both groups; above 1, more likely in group 1. When b or c is zero the sample odds ratio is infinite, and the calculator shows ∞.

06

Common mistakes with Fisher’s exact test

  • Using chi-square on small counts. For the worked example, where every expected count is 2, Pearson’s chi-square gives p = 0.157, three times smaller than the exact 0.486.
  • Choosing the one-sided p after seeing the data. It halves the p value: 0.243 instead of 0.486 for the worked example.
  • Doubling the one-sided p and calling it two-sided. For the table 6, 1 / 2, 6 the two-sided p is 0.041, but twice the one-sided p is 0.063; say which you report.
  • Reading a large p as “no difference”. The worked example’s 75% against 25% gives p = 0.49 with 8 subjects; the same split with 80 subjects (30, 10 / 10, 30) gives p = 0.000015.

Trust

How this page is checked

  • The calculation runs on code with automated tests against worked reference values. Every number in the examples on this page was produced by that same code, not typed by hand.
  • The formulas and conventions used are stated on the page, so you can reproduce the result yourself or compare it with your own software.
  • Last reviewed by the Sciloom team, Zebra Nine Studio Inc. It is a tool for research and teaching, not a substitute for a statistician, a validated lab method or medical advice.

Cite this page

Sciloom. (2026). Fisher’s exact test calculator. Zebra Nine Studio Inc. https://sciloom.si/fishers-exact-test-calculator

Read the full methodology · Who makes Sciloom

Frequently asked questions

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

When the table is 2 × 2 and any expected count is below 5. Fisher’s test computes the p value exactly instead of relying on an approximation that fails for small counts.

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

It can be either. The calculator reports the two-sided p value as the main result and both one-sided values below it.

Can I use Fisher’s exact test with large samples?

Yes. It is valid for any sample size and gives nearly the same answer as chi-square when counts are large.

Does it work for tables larger than 2 × 2?

This calculator handles 2 × 2 tables. For larger tables use the chi-square calculator, merging small categories if expected counts are low.

Larger table or large counts? The chi-square calculator handles up to 6 × 6.
Free to start, no sign-up.
Back to the tool ↑

More research tools