Percentages and Math

Fisher Exact Test Calculator

Enter the four counts of a 2 by 2 table to get an exact p value.

Your numbers

Example counts.

Higher or lower refers to the share of yes outcomes in group A compared with group B.

Result

P value (two-sided)

0.034965

Exact, from the hypergeometric distribution with the row and column totals fixed.

P value
0.034965
P value, two-sided
0.034965
P value, A higher
0.024476
P value, A lower
0.99913
Odds ratio (sample)
20.0000
Relative risk of yes, A over B
4.8000
Probability of this exact table
0.023601
Smallest expected count
2.63

Your table

GroupYesNoTotalShare yes
Group A821080.0%
Group B15616.7%
Total971656.3%
How this was calculated
  1. With the totals fixed at 10 and 6 in the groups and 9 yes outcomes, the count in the top left cell follows a hypergeometric distribution.
  2. The probability of exactly the table you entered is 0.023601.
  3. The two-sided p value adds the probability of every table that is no more likely than yours.
  • The test assumes each observation falls in exactly one cell and the groups are independent. It tests whether the yes share differs between groups; it does not measure how large or important the difference is, and it does not show a cause.

Calculated using SumPanda.com · https://sumpanda.com/fisher-exact-test-calculator/

Results are estimates for general information. Verify important figures before relying on them.

Next step

How to use the fisher exact test calculator

  1. Enter the four counts of a 2 by 2 table: yes and no in group A, and yes and no in group B. The example counts show how.
  2. Choose the alternative: two-sided, or one-sided for group A having a higher or lower share of yes outcomes.
  3. Read the exact p value, the sample odds ratio, the relative risk and the smallest expected count.
  4. Check the table of your counts with the share of yes in each group.

Formula

with fixed row and column totals, the top left cell a follows a hypergeometric distribution

P(a = k) = C(a + b, k) x C(c + d, m - k) / C(N, m), where m = a + c and N = all counts

two-sided p = sum of P(k) over every table with P(k) no larger than the probability of yours

odds ratio = a d / (b c), relative risk = (a / (a + b)) / (c / (c + d))

The test is exact: it adds probabilities of whole tables and uses no normal or chi-square approximation, so it is safe for small counts.

Eight of ten against one of six

Group A has 8 yes and 2 no, and group B has 1 yes and 5 no. Of 16 cases, 9 are yes. The probability of exactly this table is 0.023601, and adding every table that is no more likely gives a two-sided p value of 0.034965. The one-sided p value that A has the higher share of yes is 0.024476.

The sample odds ratio is (8 x 5) / (2 x 1) = 20, and the relative risk is 80% / 16.7% = 4.8. The smallest expected count is 2.63, below 5, which is the sort of table where the chi-square test is a poor approximation and an exact test is preferred.

When to use it

Fisher exact test suits a 2 by 2 table when counts are small or some expected counts are below 5. For larger tables or large counts, the Chi-Square Calculator gives a quick approximation that agrees closely. Both ask whether the share of yes differs between two groups.

The odds ratio and the relative risk describe how big the difference is. A p value only describes how surprising it would be if there were no difference.

Cautions

Each observation must fall in exactly one cell and the two groups must be independent. If the same people are counted twice, use a paired method. A zero cell leaves the sample odds ratio without a value, and the tool says so instead of printing a huge number. Significance does not show cause, and it says nothing about whether a difference is large enough to matter.

More statistics tools

For related statistical tests and measures, try the P Value Adjustment Calculator, Cohen's d Calculator and AUC ROC Calculator.

Assumptions and limits

  • The table is 2 by 2 and every observation is in exactly one cell.
  • The groups are independent, with fixed totals when the p value is computed.
  • Counts are whole numbers; every row and column has at least one observation.
  • The odds ratio is the sample estimate a d / (b c), not a conditional estimate.

Formulas reviewed October 10, 2026. See the calculation methodology for how SumPanda rounds, tests and sources its formulas.

Frequently asked questions

When is Fisher exact test better than chi-square?

It is better when counts are small, usually when any expected cell count is below 5. It computes the p value exactly instead of relying on a large sample approximation.

What does a two-sided Fisher test mean?

It adds the probability of every table that is as unlikely as yours or less likely, in either direction. A one-sided test only looks at tables more extreme in the direction you chose.

What is the odds ratio in a 2 by 2 table?

It is the odds of yes in group A divided by the odds of yes in group B, which equals a d divided by b c. A value of 1 means no difference.

Can I use it for large counts?

Yes, up to 100,000 per cell here. The result matches the chi-square test when counts are large, but it is slower for very big tables.