CalcWorldHub
Free online calculator · no signup

Fisher exact two by two contingency test calculator

Test association in a small independent 2×2 count table using fixed margins and an exact probability-ordering p-value.

4,000 tools
Fisher exact two by two contingency test calculator — Top-left count a, Top-right count b, Bottom-left count c and calculation method
Fisher exact two by two contingency test calculator: inputs and calculation method.

How to use this calculator

Test association in a small independent 2×2 count table using fixed margins and an exact probability-ordering p-value.

  1. Enter Top-left count a, Top-right count b, Bottom-left count c, Bottom-right count d. Match the units shown beside each field and review the result together with the assumptions below.
  2. Read the worked example below to check the expected input format and result.
  3. Compare another scenario by changing one input at a time. Use Reset to return to the starting values.
Calculation guide

Fisher exact two by two contingency test explained

Conditioning on the table’s row and column totals leaves a hypergeometric distribution for the top-left cell. The probability-ordering two-sided p-value sums feasible tables no more likely than the observed table; it is not generally twice the smaller one-sided tail.

Fisher probability-ordering two-sided p-value: 0.0697785187 in the worked scenario.

Inputs, symbols, and units

a — Top-left count a
Count in row 1, column 1. Rows are independent groups and columns are the two outcomes; keep this orientation for all four cells. Enter a whole number.
b — Top-right count b
Count in row 1, column 2, using the same outcome definitions as the second row. Enter a whole number.
c — Bottom-left count c
Count in row 2, column 1. Each observation belongs to exactly one table cell. Enter a whole number.
d — Bottom-right count d
Count in row 2, column 2. Enter observations rather than percentages or expected counts. Enter a whole number.

Formula and method

P(A=x)=C(a+c,x)C(b+d,a+b−x)/C(N,a+b); two-sided p=Σ P(x) for P(x)≤P(a).

The entered cells define row and column totals. Enumerate every feasible top-left cell while holding those margins fixed. The two-sided tail sums table probabilities, rather than doubling whichever one-sided p-value is smaller. The displayed odds ratio is ad/(bc), the sample cross-product estimate.

A worked scenario

Top-left count a = 7; Top-right count b = 3; Bottom-left count c = 2; Bottom-right count d = 8.

  • Fisher probability-ordering two-sided p-value: 0.0697785187
  • Lower-tail p-value: 0.9972612527
  • Upper-tail p-value: 0.0348892593
  • Sample cross-product odds ratio: 9.33333333

The first row contains ten observations and the first column nine. Reallocating the first cell changes all four cells while those totals stay fixed; the observed 7:3 versus 2:8 contrast is one of those tables.

Assumptions and edge cases

Independent observations and fixed-margin conditional inference. Positive row and column totals; at most 20,000 observations. An infinite or undefined sample odds ratio does not prevent the exact p-value from existing.

Reading the outputs

The first result tests independence under the conditional model. Lower and upper tails refer to decreasing or increasing the top-left cell with margins fixed.

Frequently asked questions

Can I use percentages?

No. Enter the underlying integer counts; percentages do not preserve sample size.

Is the reported odds ratio a conditional estimate?

No. It is the sample cross-product odds ratio, which can differ from a conditional maximum likelihood estimate.

Does a small p-value show the effect is large?

No. Inspect the table and effect size separately; the test does not quantify practical importance.

How do I use the Fisher exact two by two contingency test calculator?

Enter Top-left count a, Top-right count b, Bottom-left count c, Bottom-right count d. Match the units shown beside each field and review the result together with the assumptions below.

What is a worked example of Fisher exact two by two contingency test?

Top-left count a = 7; Top-right count b = 3; Bottom-left count c = 2; Bottom-right count d = 8. Fisher probability-ordering two-sided p-value: 0.0697785187 Lower-tail p-value: 0.9972612527 Upper-tail p-value: 0.0348892593 Sample cross-product odds ratio: 9.33333333 The first row contains ten observations and the first column nine. Reallocating the first cell changes all four cells while those totals stay fixed; the observed 7:3 versus 2:8 contrast is one of those tables.