Chi-Square vs Fisher's Exact Test: Which to Use
Chi-square or Fisher's exact test? Learn the expected-count rule, when to use continuity correction, and how to report results for 2x2 tables in a paper.
Use the Pearson chi-square test to compare proportions in a contingency table when the sample is reasonably large, and use Fisher's exact test when the table is small, specifically when any expected cell count is below 5. Both test whether two categorical variables are associated. Fisher's test computes an exact p-value and does not rely on a large-sample approximation, so it is valid at any sample size, but it is mainly needed for sparse data.
Which one you ultimately report depends on your study design and journal requirements, so treat the guidance here as a starting point.
What both tests answer
Imagine a 2x2 table: treatment (yes/no) by outcome (event/no event). The null hypothesis is that the event proportion is the same in both groups, equivalently that treatment and outcome are independent. Both tests give a p-value for that hypothesis. Neither tells you how large or how important the difference is, which is why you also need an effect measure.
The decision rule
The standard rule of thumb concerns expected counts, calculated for each cell as (row total x column total) / grand total.
| Condition | Suggested test |
|---|---|
| 2x2 table, all expected counts at least 5 | Pearson chi-square |
| 2x2 table, any expected count below 5 | Fisher's exact test |
| Total n very small (for example under about 20-40) | Fisher's exact test |
| r x c table, no more than about 20% of cells with expected count below 5 and none below 1 | Pearson chi-square |
| r x c table with many sparse cells | Fisher-Freeman-Halton exact test, or merge categories sensibly |
| Paired binary data (same patients twice) | McNemar test |
| Ordered categories (for example grade 1-4) | Chi-square test for trend |
Note that these thresholds are conventions. Cochran's guidance is commonly quoted, and some authors argue that the exact test is acceptable, and conservative, in almost all situations, while modern software makes it easy for moderately large tables too. Whichever you choose, define the rule in your methods and apply it consistently.
A worked example of expected counts
Suppose 40 patients: 20 received drug A and 20 received drug B. In total 6 had the event and 34 did not. Under independence, the expected number of events in each group is 20 x 6 / 40 = 3. That is below 5, so the chi-square approximation is unreliable, and Fisher's exact test is the better choice even though n = 40.
The observed counts could be 5 and 1, but it is the expected count of 3 that triggers the rule.
Continuity correction and variants
- Yates' continuity correction adjusts the 2x2 chi-square statistic for the fact that a continuous distribution approximates discrete counts. It is conservative and is sometimes criticised for being too conservative. Reporting practice differs between fields, so state which version you used.
- Likelihood-ratio (G) test is an alternative to Pearson and gives similar answers with decent sample sizes.
- Fisher's test is "conservative" in the sense that its actual type I error is often below the nominal level because of discreteness. This is generally acceptable but is why mid-p versions exist for some purposes.
Do not choose a test only by the p-value
Switching between chi-square and Fisher after seeing which gives p below 0.05 is a form of p-hacking. Decide the rule in advance, from the expected counts and the design.
Also remember the independence assumption. Both tests require that observations are independent. Repeated measurements on the same patient, clustered data (several teeth per patient, multiple lesions per person) or matched designs violate it and need other methods, such as McNemar for paired data or models that handle clustering.
Reporting the result in a paper
Give readers the data, the test and a measure of effect.
- Counts and percentages for each group, for example "events occurred in 5/20 (25.0%) vs 1/20 (5.0%)".
- The test used, including the reason when it is not the default: "Fisher's exact test was used because expected counts were below 5."
- The p-value, usually exact to two or three decimals, or "p < 0.001" for very small values.
- An effect measure with a 95% confidence interval: odds ratio, relative risk, or risk difference. Choose based on design: case-control studies use the odds ratio; cohort studies and trials can report risk ratio or risk difference.
- For chi-square, the statistic and degrees of freedom, for example chi-square(1) = 4.12. Fisher's test has no test statistic to report.
Sample methods sentence: "Categorical variables are presented as n (%) and compared using the chi-square test, or Fisher's exact test when any expected cell count was below 5. All tests were two-sided with a significance level of 0.05."
Common mistakes
- Checking observed counts instead of expected counts.
- Applying chi-square to percentages or means instead of raw counts.
- Using an unpaired test for before-and-after binary data.
- Reporting only the p-value, without proportions or an effect size.
- Splitting a continuous variable into categories just to run a chi-square test and losing information.
- Running many pairwise tests across several groups without adjusting for multiple comparisons.
How to do this in MedStat
With MedStat AI statistics, you upload your dataset, and the AI automatically selects an appropriate test for two categorical variables, including the choice between chi-square and Fisher's exact test, then returns the results, charts and p-values in one click. This works through a point-and-click, no-code statistics interface, so you do not need to write syntax. Check the output against your study design and the target journal's reporting requirements before finalising your analysis.
Upload your data, let AI pick the right test, and get results and charts in one click.
Try MedStat
FAQ
When should I use Fisher's exact test instead of chi-square?
Use Fisher's exact test when the expected count in any cell of a 2x2 table is below 5, or when the total sample size is small (commonly under 40). Otherwise the Pearson chi-square test is appropriate.
Do I check observed or expected counts for the chi-square rule?
Expected counts. The rule of thumb concerns the counts you would expect under no association, calculated from the row and column totals, not the counts you actually observed.
How do I report a chi-square test in a paper?
Give the counts and percentages in each group, the test statistic with degrees of freedom, and the exact p-value, for example chi-square(1) = 4.12, p = 0.042. Add an effect measure such as an odds ratio or risk difference with its 95% confidence interval.
Can Fisher's exact test be used for tables larger than 2x2?
Yes. Many programs offer the Freeman-Halton extension for r x c tables, which is useful when several cells have small expected counts. Combining sparse categories sensibly is another option if it makes clinical sense.