Fisher's Exact Test Calculator - 2x2 Contingency Table

Calculate one-tailed and two-tailed p-values plus the odds ratio for a 2×2 contingency table using Fisher's Exact Test — ideal for small sample sizes.

Enter the four cell counts of your 2×2 table (group × outcome), then click Calculate to get exact p-values and the odds ratio.

Fisher's Exact Test
Analyse a 2×2 contingency table for statistical significance
Outcome 1Outcome 2
Group 1
Group 2

About Fisher's Exact Test

Fisher's Exact Test is a statistical significance test for analysing 2×2 contingency tables. Developed by Sir Ronald A. Fisher in 1922, the test determines whether there is a non-random association between two categorical variables — for instance, between a treatment group and a patient outcome. Unlike the chi-squared test, which is an approximation that becomes inaccurate with small expected cell counts, Fisher's Exact Test computes the exact probability of the observed data (and all more extreme configurations) using the hypergeometric distribution. The test arranges data into a 2×2 table with fixed marginal totals (row sums and column sums). Given these margins, the test calculates the probability of the observed arrangement under the null hypothesis of no association. The probability of a specific table with cells [a, b; c, d] is given by the hypergeometric formula: P = C(a+b, a) × C(c+d, c) / C(n, a+c), where n = a+b+c+d. The p-value is obtained by summing the probabilities of all tables that are at least as extreme as the observed table. For a one-tailed p-value, 'extreme' means tables where the association is in the same direction as observed. For a two-tailed p-value — appropriate for most research questions — 'extreme' means tables with an equal or smaller probability than the observed table, summing across both tails. The two-tailed p-value is therefore more conservative and more widely used in published research. The odds ratio quantifies the strength of the association: OR = (a × d) / (b × c). An odds ratio of 1 means no association; a value greater than 1 indicates that Outcome 1 is more likely in Group 1 than in Group 2; a value less than 1 indicates the reverse. The odds ratio is a key measure in case-control studies, clinical trials, and genetic association studies. Fisher's Exact Test is appropriate whenever the expected count in any cell of the 2×2 table falls below 5, which is the threshold where the chi-squared approximation becomes unreliable. Common applications include clinical trials comparing treatment success rates between two groups, genetic epidemiology testing whether an allele is associated with a disease, educational research comparing pass/fail rates between two teaching methods, and marketing analytics comparing conversion rates between two advertisement variants. The test is exact regardless of sample size, making it the gold standard for small samples in these domains.

Fisher's Exact Test — Examples

Three real-world scenarios showing how to set up a 2×2 contingency table and interpret the exact p-values.

Table [a, b; c, d]Two-Tailed pContext
a=9, b=1, c=2, d=8 (n=20)p = 0.0350 (significant)New drug trial: 9/10 treated patients improved vs 2/10 placebo. The association between treatment and improvement is statistically significant.
a=7, b=3, c=1, d=12 (n=23)p = 0.0189 (significant)Genetics: 7 of 10 gene-variant carriers have disease vs 1 of 13 without variant. The gene is significantly associated with disease.
a=10, b=2, c=5, d=8 (n=25)p = 0.0840 (not significant at 0.05)Teaching methods: 10/12 passed with Method A vs 5/13 with Method B. The difference is not significant at the 5% level.
a=4, b=100, c=0, d=110 (n=214)p = 0.0563 (marginal)Ad campaign A/B test: 4 conversions from Ad A vs 0 from Ad B out of ~110 views each. The result is borderline and warrants larger-sample follow-up.

How to use the Fisher's Exact Test Calculator

  1. Organise your data into a 2×2 contingency table: rows are the two groups (Group 1 and Group 2), columns are the two possible outcomes (Outcome 1 and Outcome 2).
  2. Enter the count for each cell: Cell A (Group 1, Outcome 1), Cell B (Group 1, Outcome 2), Cell C (Group 2, Outcome 1), Cell D (Group 2, Outcome 2). All values must be non-negative integers.
  3. Click 'Calculate'. The calculator enumerates all possible 2×2 tables with the same marginal totals and sums the hypergeometric probabilities for the exact one-tailed and two-tailed p-values.
  4. Read the two-tailed p-value for most research questions. If p < 0.05, the association between the two groups and the two outcomes is statistically significant.
  5. Interpret the odds ratio: values > 1 indicate Outcome 1 is more likely in Group 1; values < 1 indicate it is less likely. Use the load-example buttons below the table to see how the test works on real scenarios.

Fisher's Exact Test — FAQ

When should I use Fisher's Exact Test instead of the chi-squared test?
Use Fisher's Exact Test whenever any expected cell count in your 2×2 table falls below 5, or whenever the overall sample size is small (n < 20 is a common rule of thumb). The chi-squared test uses an approximation that breaks down with small counts, producing unreliable p-values. Fisher's test is always exact, so it can safely be used for any sample size.
What does the two-tailed p-value mean in Fisher's test?
The two-tailed p-value is the probability of observing a table as extreme as, or more extreme than, the one you have in either direction — assuming the null hypothesis of no association is true. 'Extreme' here means having a hypergeometric probability as small as or smaller than the observed table. A p-value < 0.05 conventionally means the association is statistically significant.
What is the odds ratio and how do I interpret it?
The odds ratio (OR) is (a × d) / (b × c). An OR of 1 means Outcome 1 is equally likely in both groups — no association. OR > 1 means Outcome 1 is more likely in Group 1 than Group 2; OR < 1 means it is less likely. For example, OR = 9 means the odds of Outcome 1 in Group 1 are nine times the odds in Group 2, a strong positive association.
What is the difference between the one-tailed and two-tailed p-values?
The one-tailed p-value tests for association in one specific direction (e.g., that Group 1 has a higher rate of Outcome 1 than Group 2). The two-tailed p-value tests for any association regardless of direction. Unless you had a prior directional hypothesis before seeing the data, the two-tailed p-value is the appropriate and more conservative choice.
What are the marginal totals and why must they be fixed?
The marginal totals are the row sums (a+b and c+d) and column sums (a+c and b+d) of the table. Fisher's test conditions on these totals being fixed, which is the basis for deriving the exact hypergeometric distribution. In practice, the marginals are fixed by the design of the study (e.g., predetermined group sizes or total events).
Can Fisher's Exact Test be used for tables larger than 2×2?
The classic Fisher's Exact Test is defined for 2×2 tables. Generalisations to larger r×c contingency tables exist (using a multi-dimensional hypergeometric distribution), but they are computationally demanding. For larger tables with small expected counts, Fisher's exact test can still be applied to 2×2 sub-tables, or you can use Monte Carlo simulation-based exact tests available in statistical software.