← Back to Blog

Categorical data

Chi-Square vs Fisher's Exact Test: When to Use Each

Statistics for clinical researchers and surgical trainees

In short

Use Fisher's exact test if any expected cell count in your table is below 5. Otherwise use the chi-square test. That single rule decides which one you need.

Both of these tests check whether two categorical variables — labels such as yes/no or which group — are related. Deciding which one to use is one of the most common questions in clinical research, and one of the easiest to answer once you know the single rule behind it.

The rule

Use Fisher's exact test when any expected cell count in your table is below 5. Use the chi-square test when every expected cell count is 5 or more. That is the whole decision.

What "expected cell counts" means

Expected cell counts are not the numbers you actually observed. They are the numbers you would expect in each box of the table if the two variables were completely unrelated, calculated as (row total × column total) ÷ grand total. Here is a worked example. In a subgroup of 23 heart-failure patients with severely reduced cardiac function, we look at anaemia by smoking status. Of the 23, 9 had anaemia and 14 did not, while 9 were smokers and 14 were non-smokers. Working through all four boxes:

  • No anaemia & non-smoker: (14 × 14) ÷ 23 = 8.5
  • No anaemia & smoker: (14 × 9) ÷ 23 = 5.5
  • Anaemia & non-smoker: (9 × 14) ÷ 23 = 5.5
  • Anaemia & smoker: (9 × 9) ÷ 23 = 3.5

The smallest expected count is 3.5, which is below 5 — so you would switch to Fisher's exact test.

Why it matters

The chi-square test is an approximation that works well only when the counts are reasonably large. When an expected count drops below 5, that approximation breaks down and the p-value becomes unreliable. Fisher's exact test calculates the probability directly, with no approximation, so it stays valid even with very small numbers. This is exactly the threshold described by Kim in a widely cited note for clinical researchers.1

In practice

For most single-centre studies and audits with small numbers, at least one expected count in a 2×2 table will fall below 5, so a sensible default is: for a 2×2 table with fewer than about 50 patients, use Fisher's exact; with more than 100, chi-square is usually fine; for larger tables, chi-square is standard as long as the expected counts are all 5 or more.

A note on Yates' correction

Some software applies something called Yates' continuity correction to the chi-square test for 2×2 tables. It is widely viewed as too conservative and has fallen out of favour. StatsPlease uses the uncorrected chi-square test and automatically switches to Fisher's exact when any expected count falls below 5. Whichever you use, state it in your methods.

StatsPlease output — chi-square (valid)

2×2 table (maternal smoking × low birthweight)
→ smallest expected count 23.1 → all ≥ 5
Test selected: chi-square

Maternal smokingNormal weightLow birthweight
Non-smoker8629
Smoker4430

χ²(1) = 4.92 · p = .026 · Cramér's V = 0.16 (small)

Maternal smoking was significantly associated with low birthweight (χ²(1) = 4.92, p = .026, Cramér's V = .16).

Example output. Figures are illustrative.

Example data: Vanderbilt University Department of Biostatistics public teaching datasets (hbiostat.org/data). Figures computed with scipy from real data.

StatsPlease output — Fisher's exact (required)

2×2 table, n = 23 (anaemia × smoking)
→ smallest expected count 3.5 → below 5
Test selected: Fisher's exact

AnaemiaNon-smokerSmoker
No anaemia68
Anaemia81

Fisher's exact p = .040 · OR = 0.09 · 95% CI [0.01, 0.97]

For comparison, an uncorrected chi-square on this table gives p = .027 — artificially low, because the approximation breaks down once an expected count drops below 5. This discrepancy is exactly why the rule exists.

In patients with severely reduced cardiac function, anaemia was significantly associated with smoking status (Fisher's exact test, p = .040, OR = 0.09, 95% CI [0.01, 0.97]). Note: the odds ratio estimate should be interpreted with caution given the small sample size (n = 23).

Example output. Figures are illustrative.

Example data: Vanderbilt University Department of Biostatistics public teaching datasets (hbiostat.org/data). Figures computed with scipy from real data.

Reporting a chi-square result

Use the format: "χ²(df) = X.XX, p = .0XX, Cramér's V = .XX." For example: "Maternal smoking was significantly associated with low birthweight (χ²(1) = 4.92, p = .026, Cramér's V = .16)." Cramér's V is the effect size for chi-square; its small/medium/large guideposts come from Cohen.2

Reporting a Fisher's exact result

Use the format: "Fisher's exact test, p = .0XX, OR = X.XX (95% CI X.XX–X.XX)." For example: "In patients with severely reduced cardiac function, anaemia was significantly associated with smoking status (Fisher's exact test, p = .040, OR = 0.09, 95% CI 0.01–0.97)." Do not report a chi-square statistic for Fisher's exact — there isn't one. Report the exact p-value and the odds ratio (OR, how many times more likely the outcome is in one group than the other) with its 95% confidence interval (CI, the plausible range for that ratio).

What StatsPlease does

StatsPlease calculates the expected cell counts before choosing a test. If any expected count is below 5, it automatically uses Fisher's exact test. The output states which test was used and why, gives Cramér's V for chi-square, and gives the odds ratio with a 95% confidence interval for Fisher's exact — all in the downloadable report.

Try it yourself

Reproduce these results — in StatsPlease or SPSS

Both 2×2 tables above come from public datasets, so you can run each test yourself and confirm the numbers — and see the chi-square / Fisher's rule in action.

In StatsPlease

  1. For the valid case: upload the birthweight dataset and cross maternal smoking with low birthweight.
  2. For the small case: in the heart failure dataset, keep the patients with severely reduced cardiac function (ejection fraction ≤ 20%) and cross anaemia with smoking.
  3. Run each. StatsPlease checks the expected counts and picks chi-square or Fisher's automatically.

In SPSS

  1. Open each CSV and go to Analyze ▸ Descriptive Statistics ▸ Crosstabs.
  2. Under Statistics, tick Chi-square. For a 2×2 table SPSS also prints Fisher's exact automatically.
  3. Read the chi-square row for birthweight and the Fisher's exact row for the small cardiac table.

Compare: birthweight returns χ²(1) = 4.92, p = .026; the small cardiac table returns Fisher's exact p = .040. Both tools apply the same expected-count rule — StatsPlease just makes the choice for you and states why.

References

  1. Kim HY. Statistical notes for clinical researchers: Chi-squared test and Fisher's exact test. Restorative Dentistry & Endodontics. 2017;42(2):152–155. https://doi.org/10.5395/rde.2017.42.2.152
  2. Cohen J. Statistical Power Analysis for the Behavioral Sciences. 2nd ed. Hillsdale, NJ: Lawrence Erlbaum Associates; 1988.

Chi-square or Fisher's exact — StatsPlease picks the right one from your expected cell counts.

Analyse My Data →