Skip to content

Fisher’s Exact Test Calculator

Type the four counts of a 2 × 2 table to get the exact p-value from every table…

Type the four counts of a 2 × 2 table to get the exact p-value from every table with the same totals, the right test when counts are small.

Paste a table from a spreadsheet

Copy cells from Excel, Google Sheets or a CSV file and paste them here; the grid above follows.

More optionsTwo-sided
Alternative

ExampleP-value, two-sided

0.0286

Of every table with these row and column totals, the ones at least as extreme as yours add up to 0.0286. Significant at the 5% level (p < 0.05).

Type your own counts, or paste a table.

Each bar is one possible top-left count, with every total kept as it is, and its chance if rows and columns were unrelated (the hypergeometric distribution). The lit bars make up the p-value.

Odds ratio (ad ÷ bc)
∞
One-sided p (less · greater)
1 − 2.00 × 10⁻¹⁵ · 0.0143
Possible tables
5
How this works: 9 sources,

How this works

Method

Fisher’s exact test is for a 2 × 2 table when the counts are small: a few patients per treatment, a handful of defects, a tasting trial. It gives an exact p-value instead of the chi-square approximation, which breaks down when expected counts fall under 5. Full method

How it’s tested

2 worked examples for this page are checked by automated tests before every release: given the inputs, the tool must show the expected answer.

Privacy

On your device. Nothing you enter or open leaves this browser. About privacy labels

Changes

  • First published: live curves with draggable cut-offs, and tests on pasted data (t-tests, ANOVA, chi-square, Fisher’s exact, correlation, regression, A/B), checked against SciPy.

Every change on What’s new

How we make toolsReport a mistake

How Fisher’s exact test works

Fisher’s exact test is for a 2 × 2 table when the counts are small: a few patients per treatment, a handful of defects, a tasting trial. It gives an exact p-value instead of the chi-square approximation, which breaks down when expected counts fall under 5.

The example is Fisher’s own. A colleague, Muriel Bristol, said she could tell whether the milk or the tea had gone into the cup first. Fisher proposed eight cups, four of each, served in random order; she must pick the four milk-first cups. If she were guessing, every set of four is equally likely: there are 70 of them, and only one gets all four right. So a perfect score has a one-sided p-value of 1/70 = 0.014, and the two-sided test, which also counts getting all four wrong, gives 2/70 = 0.029.

In general the test fixes the row and column totals and lists every table that has them. Its top-left count decides the rest, and each possible count has a hypergeometric probability. The two-sided p-value adds the probabilities of every table no more likely than yours; one-sided p-values add one tail. The odds ratio ad ÷ bc says how much the odds differ between the rows.

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

The tea-tasting test: every possible score

Eight cups, four with milk first. For each number of milk-first cups picked correctly: the number of ways, its probability under guessing, and the one-sided p-value for doing at least that well.

Eight cups, four with milk first. For each number of milk-first cups picked correctly: the number of ways, its probability under guessing, and the one-sided p-value for doing at least that well.
Correct of 4WaysProbabilityP(at least this many)
011/70 = 0.01431
11616/70 = 0.22860.9857
23636/70 = 0.51430.7571
31616/70 = 0.22860.2429
411/70 = 0.01430.0143

Common questions

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

When the table is 2 × 2 and any expected count is under 5, or the total is small. With large counts the two agree closely and either is fine.

Why are there two one-sided p-values?

“Less” asks whether the top-left count is smaller than chance would give (odds ratio below 1), “greater” whether it is larger. Pick the direction before seeing the data; otherwise use the two-sided p-value.

Why does the odds ratio show ∞?

When b or c is zero, ad ÷ bc divides by zero. It means one row never had one of the outcomes; the p-value is still valid.