Fisher’s Exact Test Calculator

Fisher’s exact test analyses a 2×2 table without relying on large-sample approximations. That makes it the right choice when counts are small, for example when any expected count is below 5. Enter the four cell counts to get the two-sided p-value, both one-sided p-values and the odds ratio.

How the test works

With the row and column totals held fixed, the count in the top-left cell follows a hypergeometric distribution. The test adds up the probability of the observed table and of every other table with the same totals that is equally or less likely. That sum is the two-sided p-value. Nothing is approximated, so the result is valid at any sample size.

P(table) = [ C(a + b, a) × C(c + d, c) ] ÷ C(N, a + c)

Laying out your table

Outcome: yesOutcome: no
Group 1 (e.g. treatment)ab
Group 2 (e.g. control)cd

The odds ratio (a × d) ÷ (b × c) compares the odds of the outcome in group 1 with group 2. A value of 1 means no association.

Frequently asked questions

Fisher’s exact test or chi-square?

For a 2×2 table, Fisher’s test is always valid. Chi-square is a large-sample approximation that agrees closely when all expected counts are 5 or more. Our chi-square calculator shows both for 2×2 tables.

Why do different programs give slightly different two-sided p-values?

There are several conventions for defining “as extreme” in two-sided exact tests. This calculator uses the most common one, summing all tables no more likely than the one observed. R, SciPy and SPSS use the same rule.