Fisher’s Exact Test: Definition, Formula, and Example

Fisher’s Exact Test is used to determine whether or not there is a significant association between two categorical variables. It is typically used as an alternative to the  when one or more of the cell counts in a 2×2 table is less than 5. 

Fisher’s Exact Test uses the following null and alternative hypotheses:

  • H0: (null hypothesis) The two variables are independent.
  • H1: (alternative hypothesis) The two variables are not independent.

Suppose we have the following 2×2 table:

Group 1Group 2Row Total
Category 1aba+b
Category 2cdc+d
Column Totala+cb+da+b+c+d = n

The one-tailed p value for Fisher’s Exact Test is calculated as:

p = (a+b)!(c+d)!(a+c)!(b+d)! / (a!b!c!d!n!)

This produces the same p value as the CDF of the with the following parameters:

  • population size = n
  • population “successes” = a+b
  • sample size = a + c
  • sample “successes” = a

The two-tailed p value for Fisher’s Exact Test is less straightforward to calculate and can’t be found by simply multiplying the one-tailed p value by two. To find the two-tailed p value, we recommend using the .

Fisher’s Exact Test: Example

Suppose we want to know whether or not gender is associated with political party preference. We take a simple random sample of 25 voters and survey them on their political party preference. The following table shows the results of the survey:


Step 1: Define the hypotheses.

We will perform Fisher’s Exact Test using the following hypotheses:

  • H0Gender and political party preference are independent.
  • H1: Gender and political party preference are not independent.

Step 2: Calculated the two-tailed p value.

Fisher's Exact test example

The two-tailed p value is 0.115239. Since this value is less than 0.05, we fail to reject the null hypothesis. We do not have sufficient evidence to say that there is any statistically significant association between gender and political party preference.

Additional Resources

The following tutorials explain how to perform a Fisher’s Exact Test using different statistical programs:

How to Perform Fisher’s Exact Test in SPSS
How to Perform Fisher’s Exact Test in Python

Scroll to Top