CATEGORICAL DATA
Chi-square vs. Fisher’s Exact Test: How to Choose for Categorical Data
Use a chi-square test when its large-sample approximation is suitable. Use Fisher’s exact test, or another exact or simulation-based approach, when a small or sparse table makes that approximation unreliable. Report observed counts and an effect size—not only a p-value.
Published by BioTabularLast reviewed: August 21, 2026
Chi-square and Fisher’s exact test both help answer whether two categorical variables are associated. The usual decision is not based on total sample size alone. It depends on the table structure, expected cell counts under the null hypothesis, and whether observations are independent.
The short answer
| Data structure or question | Usual starting point |
|---|---|
| Two categorical variables, with independent observations and adequately sized expected counts | Chi-square test of independence |
| A 2×2 table with small or sparse expected counts | Fisher’s exact test is often appropriate |
| A larger sparse r×c table | Consider an exact or simulation-based method; seek support if the design or sparsity is complex |
| Same people measured twice, with a binary outcome | A paired method such as McNemar’s test, not an ordinary chi-square or Fisher test |
| Clustered observations, matched sets, or repeated measurements | Use a method that accounts for dependence; ordinary contingency-table tests treat observations as independent |
The tests assess evidence about an association in the population. They do not show that one variable causes the other.
Start with a table of counts
Both tests use a contingency table: rows represent categories of one variable, columns represent categories of the other, and each cell contains the number of observations in that category combination.
For example, suppose 120 independently enrolled participants are classified by treatment group and whether they experienced an outcome:
| Treatment group | Outcome | No outcome | Total |
|---|---|---|---|
| Treatment | 18 | 42 | 60 |
| Control | 8 | 52 | 60 |
| Total | 26 | 94 | 120 |
The analysis starts with counts. Percentages are useful for interpretation, but a test cannot be calculated from percentages alone unless the underlying denominators are known.
Before choosing a test, confirm that each participant contributes to one appropriate cell, categories are mutually exclusive, and rows are independent. Repeated visits, both eyes from a participant, family members, matched pairs, or several samples from the same experimental unit need a different analysis.
What the chi-square test asks
A chi-square test of independence compares observed counts with the counts expected if the two categorical variables were unrelated in the population. For a 2×2 table, the expected count in a cell is calculated from its row total and column total:
expected count = (row total × column total) ÷ overall total
In the treatment example, if treatment and outcome were unrelated, the expected number of treatment participants with the outcome would be (60 × 26) ÷ 120 = 13, not necessarily the observed 18.
The chi-square statistic summarizes the discrepancy between observed and expected counts across all cells. A small p-value indicates that the observed table would be relatively unusual under the model of no association, assuming the test conditions fit.
Why expected counts matter
The ordinary chi-square p-value uses an approximation that generally improves as expected counts become larger. Sparse expected counts can make the approximation inaccurate.
There is no single cutoff that automatically decides every case. Rules of thumb differ by table size and context. Rather than applying a mechanical “all counts must be at least 5” rule, inspect expected counts, the number of sparse cells, total sample size, and study design. If the table is sparse, choose a method designed for that situation or seek statistical advice.
Expected counts are not the same as observed counts. A cell can have an observed count above or below 5 while its expected count may or may not raise an approximation concern.
What Fisher’s exact test asks
Fisher’s exact test is most commonly used for a 2×2 table. It evaluates the probability of the observed table, and tables at least as incompatible with the null hypothesis according to the chosen definition, under a model that conditions on the row and column totals.
It is useful when a 2×2 table has small expected counts or a small total sample. It does not rely on the same large-sample approximation as the ordinary chi-square test.
“Exact” describes the p-value calculation under the test’s conditional model; it does not make data collection exact, remove bias, solve confounding, or establish causation. For larger r×c tables, exact extensions are available but can be computationally demanding. A carefully chosen simulation-based procedure may be used instead, depending on the question and software.
Choosing between the tests
- Build and inspect the table of observed counts and percentages.
- Confirm that each observation is independent and belongs in one mutually exclusive cell.
- Calculate or inspect expected counts under the null hypothesis.
- Use a chi-square test when the approximation is suitable for the table.
- For a small or sparse 2×2 table, use Fisher’s exact test; for a larger sparse table, consider an exact or simulation-based approach.
- Report the estimated association and its uncertainty, not just which test produced a smaller p-value.
The choice should be planned from table structure and design before inspecting a preferred result.
What to report with the p-value
A p-value does not describe the size, direction, or practical importance of an association. Report cell counts and percentages with an effect measure that suits the design and question.
For a 2×2 table
- Risk difference: the absolute difference in outcome risk between groups; often easy to interpret in cohort studies or trials.
- Risk ratio: compares outcome risks; generally meaningful when risks can be estimated from the study design.
- Odds ratio: compares odds; commonly used in case-control studies and logistic regression, but it is not the same as a risk ratio when outcomes are common.
Report a confidence interval for the chosen effect measure. State which group and outcome form the numerator or reference category so the direction is unambiguous.
For larger tables
Cramér’s V can summarize the overall strength of association in an r×c table. It does not describe a direction or identify which categories differ, so show the full table and consider focused comparisons only when they address the research question and account for multiple testing.
Common mistakes
“I can run the test on percentages.”
No. The test needs underlying counts or denominators. The same percentages can represent very different amounts of information in a table of 10 people versus 10,000 people.
“Any cell below 5 means Fisher’s exact test is mandatory.”
Not necessarily. The relevant issue is the suitability of the chi-square approximation based on the pattern of expected counts and table structure. Fisher’s exact test is often sensible for a sparse 2×2 table, but it is not a universal substitute for every sparse or complex table.
“Fisher’s exact test is better because it is exact.”
Not automatically. The best method depends on the estimand, table size, design, and inferential model. Fisher’s test conditions on margins and can be conservative in some settings. Choose it because the table and question support it, not because the word “exact” sounds stronger.
“I can treat repeated observations as separate rows.”
No. Repeated or clustered observations can make an ordinary contingency-table p-value too optimistic. Use a paired, clustered, repeated-measures, or regression-based method that reflects the design.
When neither ordinary test is appropriate
Do not apply an ordinary chi-square or Fisher test by default when data are paired, matched, clustered, longitudinal, or contain multiple observations from the same unit. Examples include before-and-after binary outcomes in the same participants, matched case-control pairs, several samples from one animal, or repeated clinic visits.
For two measurements of a binary outcome in the same people, McNemar’s test may be appropriate. More complex designs may need conditional logistic regression, generalized estimating equations, mixed-effects models, or another method selected from the study design and estimand.
What to report
- The study population and what one observation represents.
- The complete table of observed counts and meaningful percentages.
- Whether observations were independent, and any matching, clustering, or repeated-measure structure.
- The method used, including why Fisher’s exact test or a simulation-based procedure was chosen if applicable.
- The effect size and confidence interval, with its reference categories defined.
- The test statistic and degrees of freedom for chi-square tests, or the exact method for Fisher’s test, plus the p-value.
When to seek additional statistical support
Consult a statistician before analysis when the table is sparse and larger than 2×2, when matching, clustering, repeated observations, missing data, or covariate adjustment are involved, when several tables or subgroup analyses are planned, or when the analysis will support a causal or clinical decision. The method should follow the study design and research question, not only observed cell counts.
Related resources
For a broader path through common statistical methods, see Which Statistical Test Should I Use?. For a study-design distinction that affects categorical-method choice, see Paired vs. Independent Samples: How Study Design Changes Your Statistical Test. For choosing a correlation summary, read Pearson vs. Spearman Correlation: Which Measure of Association Should You Use?. For an introduction to distributional shape and diagnostics, read What Is a Normal Distribution? A Practical Guide for Research Data.
References and further reading
- NIST/SEMATECH e-Handbook of Statistical Methods
- American Statistical Association statement on statistical significance and p-values
BioTabular’s editorial approach and scope explain how these educational resources are prepared and what they do not replace.