Editverse Free Calculator
Fisher’s Exact Test Calculator
Test the association in a 2×2 table when counts are small — with the exact p-value, the odds ratio, and the reproducible R command. Read a full interpretation guide below. Validated against R 4.3.3.
In Simple Words
Fisher’s exact test checks whether two categorical variables in a 2×2 table are associated — for example, whether a treatment and an outcome occur together more often than chance. Unlike the chi-square test, which relies on a large-sample approximation, Fisher’s test computes the probability directly, so it stays valid when the table has small or zero cell counts.
It works by calculating the exact probability of the observed table, and every table at least as extreme, given the row and column totals. That makes it the go-to choice for small studies, rare events, and sparse tables where the chi-square approximation would be unreliable.
When to Use Fisher’s Exact Test
Use it for a 2×2 table when any expected cell count is small — the usual rule of thumb is below 5 — or when total sample size is small. In those situations the chi-square test’s p-value can be misleading, while Fisher’s exact probability is correct by construction. For larger tables with adequate counts, the chi-square test is the conventional and computationally simpler choice.
Report the exact p-value together with the odds ratio and its confidence interval, so readers see both whether an association exists and how strong it is. For paired categorical data — the same subjects measured twice — use McNemar’s test instead, since Fisher’s assumes independent observations. Not sure which categorical test fits? Our interactive Test Selector can help.
tbl <- matrix(c({a},{b},{c},{d}), nrow = 2, byrow = TRUE)
fisher.test(tbl)User guide
When to use. Exact test of association in a 2×2 table, ideal for small samples.
Assumptions. Fixed marginal totals; independent observations.
Common mistakes. For large samples the chi-square test is computationally simpler and equivalent.
Worked example
Click Load example data above, then Run Analysis to see a fully worked result with figure, formula and interpretation for this test.
References
- Fisher RA. The logic of inductive inference. J R Stat Soc. 1935;98:39-82.
Worked Examples
Example 1 — A small 2×2 table
Suppose 8 of 10 treated patients improve versus 3 of 10 controls. With cells this small, the chi-square approximation is shaky, but Fisher’s exact test computes the probability of a table this extreme directly. Report the exact p-value alongside the odds ratio so readers see both significance and effect size.
Example 2 — A zero cell
If no control patient had the outcome, one cell is zero and the chi-square test misbehaves. Fisher’s exact test handles the zero cell without a continuity correction, giving a valid p-value where the approximation fails.
Assumptions to Check
Independent observations. Each subject contributes to exactly one cell. Paired or repeated measurements need McNemar’s test, not Fisher’s.
Fixed margins interpretation. The classic test conditions on the observed row and column totals. This is standard, but be aware it underlies the exact probability calculation.
Categorical data in a contingency table. Both variables must be categorical. Continuous variables should not be forced into a 2×2 table by arbitrary cut-points.
Common Mistakes
Using chi-square when counts are tiny
When expected counts fall below 5, the chi-square p-value is unreliable. Fisher’s exact test is the correct choice for sparse 2×2 tables.
Applying it to paired data
Fisher’s assumes independent observations. For the same subjects measured before and after, use McNemar’s test instead.
Reporting only the p-value
Significance alone does not convey magnitude. Pair the exact p-value with the odds ratio and its confidence interval.
Dichotomising continuous data
Collapsing a continuous measure into two categories to fit a 2×2 table discards information and can mislead. Analyse the continuous variable directly where possible.
Frequently Asked Questions
When should I use Fisher’s exact test instead of chi-square?
Use Fisher’s when any expected cell count is small (below about 5) or the sample is small. For larger tables with adequate counts, chi-square is conventional.
Can Fisher’s exact test handle tables larger than 2×2?
Yes, an extension exists for larger tables, though it is computationally heavier. This calculator focuses on the standard 2×2 case.
Is Fisher’s test one- or two-sided?
It can be computed either way. Report the two-sided p-value unless you have a strong directional hypothesis specified in advance.
Does the result match SPSS, R, and Stata?
Yes. The calculator uses the same exact hypergeometric computation as standard software and shows the exact R command so you can reproduce it.
Related Calculators
References
- Hazra A, Gogtay N. Biostatistics series module 4: comparing groups — categorical variables. Indian J Dermatol. 2016;61(4):385–392. PMID 27512183.
- Andrade C. Understanding relative risk, odds ratio, and related terms: as simple as it can get. J Clin Psychiatry. 2015;76(7):e857–e861. PMID 26231012.
- Fisher RA. On the interpretation of χ² from contingency tables, and the calculation of P. J R Stat Soc. 1922;85(1):87–94.
Need This Analysis Done for Your Manuscript?
Our PhD biostatisticians analyse your categorical data, choose the right exact or approximate test, and deliver publication-ready tables with reproducible R output.
