Enter the four counts of a 2 × 2 table. Rows are the groups, columns the outcomes.

What Fisher’s exact test does

Fisher’s exact test checks whether two categorical variables are associated in a 2 × 2 table, for example treatment versus placebo and improved versus not improved. Instead of relying on the chi-square approximation, it computes the exact probability of every table with the same row and column totals, so it is valid for small samples where the chi-square test is not.

When to use it

Worked example: why small samples need the exact test

The example table has 9 of 10 patients improving on treatment versus 4 of 10 on placebo (90% vs 40%). An uncorrected chi-square test on these counts gives χ² = 5.49, p = .019, which looks significant. But the expected counts in the “not improved” column are only 3.5, below the usual minimum of 5, so that p-value cannot be trusted. Fisher’s exact test gives p = .057: the difference is large but, with only 20 patients, not statistically significant at the 5% level. The confidence interval for the odds ratio (about 0.95 to 690) is very wide for the same reason. A larger trial is needed.

Which odds ratio is reported?

The sample odds ratio is (a × d) / (b × c), here 13.5. The conditional maximum-likelihood estimate (11.64 here) is the odds ratio that matches Fisher’s test and its exact confidence interval; R’s fisher.test reports this version. The calculator shows both. For relative risk and number needed to treat, use the odds ratio and relative risk calculator.

One-sided or two-sided?

Use a two-sided test unless you specified the direction before collecting the data. The two-sided p-value here sums the probabilities of all tables as or less likely than the observed one, the same method as SciPy and R.

Frequently asked questions

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

When any expected cell count in a 2 x 2 table is below 5, or the total sample is small. Fisher's test computes the exact p-value, while chi-square relies on an approximation that breaks down with small counts.

Can Fisher's exact test be used for large samples?

Yes. It is valid for any sample size, and for large samples its p-value is very close to the chi-square test's.

Why are there two odds ratios?

The sample odds ratio is ad/bc. The conditional maximum-likelihood estimate is the version consistent with Fisher's test and its exact confidence interval, and it is what R's fisher.test reports.

What if a cell is zero?

The test still works. The sample odds ratio becomes 0 or infinite, and the confidence interval has an open end, which the calculator shows.