Guides
Fisher's Exact Test vs Chi-Square — Which Test for Your Table?
Fisher's exact test vs chi-square comes down to expected counts, not total N. Cochran's rule stated exactly, a decision guide, and one table run through both tests.
Fisher’s exact test vs chi-square is not a contest between a good test and a bad one; it is a question about whether the chi-square approximation can be trusted on your table, and that is decided by your expected counts — never by the total N. If Cochran’s rule holds for your expected counts, chi-square’s p-value is trustworthy and the two tests will tell you much the same story. If it fails, the approximation is unreliable in a direction nobody can sign in advance, and Fisher’s exact test — which enumerates the tables instead of approximating them — is the result to read. This guide states the rule exactly, walks the decision in order, and runs one table through both tests so the gap is a number, not an adjective.
Quick decision — the expected-count rule
Compute the expected count for each cell, E = (row total × column total) ÷ N. Then ask one question: are all expected counts at least 1, and do at least 80 percent of cells have an expected count of at least 5? That is Cochran’s rule. If yes, use chi-square (or Fisher — they will broadly agree). If no, use Fisher’s exact test for a 2×2 table, or its Freeman–Halton extension for a larger one. The chi-square calculator on this site runs this check on your own table and prints the verdict inside the result; the Fisher exact test calculator is there when the verdict points that way.
The short answer
Chi-square is a large-sample approximation: it pretends the test statistic follows a smooth chi-square distribution, which is only nearly true when the expected counts are large enough. Fisher’s exact test makes no such pretence — it conditions on the margins and enumerates every table they allow, summing hypergeometric probabilities, so its p-value is exact for the table in front of it at any size. The price Fisher pays is discreteness: with small margins only a few tables exist, the attainable p-values are coarse, and the test is conservative — its real false-positive rate sits below the nominal α. So the short answer is: chi-square when the approximation is earned, Fisher when it is not, and the expected counts — not habit, not the total, not which button your software puts first — are what decide.
Side-by-side comparison — Fisher’s exact test vs chi-square
| Fisher’s exact test | Chi-square test | |
|---|---|---|
| Basis | Hypergeometric enumeration at fixed margins | A continuous approximation to the statistic’s distribution |
| p-value | Exact, given the margins | Approximate; accuracy grows with expected counts |
| Table sizes | 2×2 directly; larger via Freeman–Halton | Any r×c |
| Small expected counts | No lower limit | Untrustworthy when Cochran’s rule fails |
| Conditioning | Conditions on both margins | Does not condition; uses the margins to build expected counts |
| Behaviour at small N | Conservative — attainable p-values are discrete | Can be anti-conservative — p smaller than it should be |
| Effect sizes | Odds ratio with exact (Cornfield) interval | None native; pair with Cramér’s V or an odds ratio |
| Cost | Enumeration grows with table size; stated limits, then labelled simulation | Instant at any size |
Chi-square test — fast but approximate
The chi-square test’s strength is reach: any table size, any number of categories, computed instantly, with a well-understood distribution behind it. Its weakness is in the name of its method — it is an approximation whose error concentrates exactly where researchers most need care, in small and sparse tables. With an expected count of 2.6 in a cell, the smooth curve is a poor sketch of a distribution that actually lives on a handful of discrete tables, and the printed p-value can be far from the exact one in either direction, as the worked comparison below shows: 0.0134 against an exact 0.0350.
Fisher’s exact test — conditional but conservative
Fisher’s test trades reach for certainty about the number itself. Given the margins, the p-value is not estimated or approximated; it is a sum of probabilities that can be audited table by table, which is why our by-hand guide can reproduce it with pencil arithmetic. The honest cost is conservatism: because only a few tables exist at small margins, the p-value often cannot land just under α, so the test gives up some power — it will miss some real associations that a valid approximation would catch. Conservative means the error is on the cautious side, and for a result you intend to publish, cautious is usually the side to err on.
Expected counts — the number that actually decides
An expected count is what a cell would hold, on average, if the null hypothesis of independence were true: E = (row total × column total) ÷ N. Take the teaching table used throughout this site, [[8, 2], [1, 5]] — row totals 10 and 6, column totals 9 and 7, N = 16:
| Cell | Observed | Expected |
|---|---|---|
| Treatment, improved | 8 | 10 × 9 ÷ 16 = 5.625 |
| Treatment, not improved | 2 | 10 × 7 ÷ 16 = 4.375 |
| Control, improved | 1 | 6 × 9 ÷ 16 = 3.375 |
| Control, not improved | 5 | 6 × 7 ÷ 16 = 2.625 |
The smallest expected count is 2.625. Notice what did not enter this calculation: the total, N = 16, is neither large nor small in itself — a table with N = 200 can still have an expected count under 1 if its margins are lopsided enough, and a table with N = 16 can pass if its margins are even. That is why every rule of thumb phrased in terms of total sample size (“use Fisher under 20, chi-square over 20”) misleads: it answers a question the mathematics never asked. The 2×2 contingency table calculator shows the expected-count table beside every result for exactly this reason.
Cochran’s rule, stated exactly
Cochran’s rule (Cochran, 1954) has two parts, and both must hold before the chi-square approximation is trusted:
- Every expected count is at least 1.
- At least 80 percent of cells have an expected count of at least 5.
For a 2×2 table, 80 percent of four cells is 3.2 cells — in practice, all four. The popular flattening of the rule into “all expected counts must be at least 5” is wrong in both directions: it is stricter than Cochran for larger tables, where a fifth of the cells may fall below 5, and it drops the first clause entirely, although an expected count under 1 breaks the approximation even in a huge table. On the teaching table above, the first clause holds (smallest expected count 2.625) and the second fails — only 1 of the 4 cells reaches 5 — so Cochran’s rule is not met, and the exact test is the one to trust for this table. Our calculators state the rule in this full form and run it on your own expected counts.
Decision guide — which test to use
Work through these in order; stop at the first that settles it.
- Are the data paired? The same subjects measured twice, or matched pairs, violate the independence both tests assume. Use McNemar’s test — neither Fisher nor chi-square is a candidate.
- Is the table larger than 2×2? Chi-square if Cochran’s rule holds for the r×c expected counts; the Freeman–Halton exact test if it does not, or if you want the exact answer within its stated limits.
- For a 2×2 table, compute the expected counts and apply Cochran’s rule. Rule met: chi-square is trustworthy; Fisher will agree closely and costs nothing if you prefer it. Rule not met: Fisher’s exact test, full stop.
- Whichever you choose, report the effect size too. An odds ratio with its confidence interval says what a p-value cannot — how large the association is and how precisely the table pins it down. The odds ratio calculator computes it for the same table.
| Your table | Test to read |
|---|---|
| Paired or matched data | McNemar (exact form for small discordant counts) |
| 2×2, Cochran’s rule met | Chi-square or Fisher — expect agreement |
| 2×2, Cochran’s rule not met | Fisher’s exact test |
| Larger than 2×2, rule met | Chi-square |
| Larger than 2×2, rule not met | Freeman–Halton exact test (labelled Monte Carlo beyond its limits) |
Strengths and weaknesses of each test
Chi-square — strengths: any table size; fast; familiar to every reader and reviewer; the statistic decomposes into per-cell contributions and residuals, so it shows where a table departs from independence, not just that it does. Weaknesses: an approximation whose error is uncontrolled when expected counts are small; gives no effect size on its own; the Yates variant (below) can overshoot into over-conservatism.
Fisher — strengths: the p-value is exact given the margins, at any sample size; the enumeration can be shown and audited; it arrives with an exact confidence interval for the odds ratio. Weaknesses: conservative at small margins, so power is lower; conditioning on both margins is a modelling choice some designs argue with; computation grows combinatorially, which is why larger tables have stated enumeration limits and labelled simulation beyond them — never simulation dressed as exactness.
Neither weakness list is a verdict. A test is right or wrong for a table, and the table’s expected counts are what make it one or the other.
Yates’ continuity correction — what it does and whether to use it
Yates’ correction (Yates, 1934) shrinks each |O − E| by 0.5 before squaring, nudging the discrete statistic toward the continuous distribution it is being compared against. R’s chisq.test applies it by default on 2×2 tables, which surprises people whose by-hand or other-software chi-square differs. On the teaching table the uncorrected statistic is χ² = 6.112 (p = 0.0134) and the corrected one is χ² = 3.810 (p = 0.0510) — the correction alone moves the result across the α = 0.05 line, and here it overshoots: the exact answer is 0.0350, which the uncorrected value understates and the corrected value overstates.
The practical adjudication: if expected counts are large, the correction is negligible and harmless; if they are small enough for the correction to matter, the exact test is available and settles the question the correction was approximating its way around. What is never acceptable is silence — a reported chi-square on a 2×2 table should state whether Yates’ correction was applied, because two honest analysts can otherwise produce 0.0134 and 0.0510 from the same four counts.
Same table, both tests — a worked comparison
Here is the teaching table [[8, 2], [1, 5]] run through everything, so the comparison is arithmetic rather than rhetoric:
| Method | Statistic | p-value |
|---|---|---|
| Pearson chi-square | χ² = 6.112 | 0.0134 |
| G-test | G = 6.515 | 0.0107 |
| Yates-corrected chi-square | χ² = 3.810 | 0.0510 |
| Fisher’s exact test (two-sided, probability ordering) | — | 0.0350 |
The expected counts (5.625, 4.375, 3.375, 2.625) fail Cochran’s rule, so the exact value, 0.0350, is the one to trust — and the approximations scatter around it on both sides. The uncorrected chi-square and the G-test are anti-conservative here, reporting the table as roughly three times more surprising than it exactly is; Yates is conservative past the exact value. Nothing about the table changed between rows; only the method did. There is one more split worth knowing, inside Fisher’s test itself: a calculator that defines the two-sided p by doubling the one-sided tail reports 0.0490 for this table instead of 0.0350. Same counts, same test name, different definition — which is why our interpretation guide treats “why do two calculators give different two-sided p-values” as its own question, and why this site names its definition next to every two-sided p it prints.
When Fisher is the wrong answer anyway
Exactness is not a universal solvent. Fisher’s test is the wrong answer when the data are paired (McNemar’s territory), when the table’s margins were themselves the outcome of the design in a way conditioning distorts — the long-running argument around comparative trials with only one margin fixed, where unconditional tests were developed in response — and when the sample is large and the expected counts comfortable, where Fisher’s conservatism simply donates power for nothing the approximation had not already earned. It is also the wrong answer when the real question is not independence at all: a trend across ordered categories, a stratified set of tables (Cochran–Mantel–Haenszel territory), or an effect size with a confidence interval as the primary output. Naming the question comes before naming the test.
The modern nuance — Boschloo, Barnard and Campbell (2007)
Two unconditional exact tests exist precisely because Fisher’s conditioning costs power. Barnard’s test (1945) and Boschloo’s test (1970) drop the fixed-both-margins conditioning and are uniformly more powerful for comparative 2×2 designs, while remaining exact in the sense that matters — their error rates are controlled without approximation. Campbell’s 2007 review in Statistics in Medicine turned this into design-based advice: for comparative trials, Boschloo’s test is the recommendation; Fisher remains a sound choice for the designs its conditioning matches. We record this honestly as nuance, not as a gap: this site does not offer Barnard or Boschloo calculators, because demand evidence for them is thin and a half-checked implementation would betray the exactness this site exists for. They are named here so a reader who meets them in the literature knows they exist, what they fix, and that a Fisher result beside them is not an error.
Larger tables (r×c) — Freeman–Halton and labelled Monte Carlo
Past 2×2, the choice has the same shape. Chi-square handles any r×c table instantly and is trustworthy when Cochran’s rule holds across the larger expected-count table. The exact route is the Freeman–Halton extension (Freeman and Halton, 1951): enumerate every table with the observed margins — by the Mehta–Patel network algorithm, since the raw count of tables explodes — and sum the probabilities of those no more probable than yours. Our Freeman–Halton calculator enumerates exactly up to 5×5 tables with N at most 200, and beyond those limits offers a Monte Carlo estimate labelled in the headline itself: “Simulated p-value (Monte Carlo, 10,000 replicates)”. That label is the whole point — research for this site found rival tools burying the simulated nature of a result in a footnote or an FAQ. An exact p-value never changes between runs; if yours does, it is simulated, whatever the page calls it.
Key takeaways
- The choice between Fisher and chi-square is made by the expected counts, never by total N.
- Cochran’s rule, in full: all expected counts at least 1, and at least 80 percent of cells at least 5.
- Chi-square approximates; Fisher enumerates. When the approximation is earned, they agree; when it is not, they can differ on both sides of the exact value.
- Yates’ correction can move a 2×2 result across the significance line by itself — always state whether it was applied.
- Fisher is conservative by construction. That is a cost in power, paid for a p-value that is exactly what it claims to be.
- Paired data belongs to neither test: McNemar first, everything else after.
Frequently asked questions
When should I use Fisher’s exact test instead of chi-square?
When Cochran’s rule fails for your expected counts — any expected count below 1, or more than a fifth of cells below 5 (for a 2×2 table, any cell below 5). Below that line the chi-square approximation is unreliable in an unknown direction, and the exact enumeration is the result to trust.
What is Cochran’s rule for chi-square?
Two parts, both required: every expected count is at least 1, and at least 80 percent of cells have an expected count of at least 5. For a 2×2 table the second part means all four cells. It is often misquoted as “all expected counts at least 5”, which drops the first clause and over-tightens the second for larger tables.
Is Fisher’s exact test better than chi-square for small samples?
It is more trustworthy, which is not quite the same claim. Its p-value is exact given the margins, where chi-square’s is an approximation of unknown accuracy at small expected counts. The cost is power: Fisher’s discreteness makes it conservative, so it detects fewer real associations than a valid test of the same size would.
Why does Fisher’s exact test give a higher p-value than chi-square?
Usually for two reasons at once: the chi-square approximation runs anti-conservative on small tables (0.0134 against an exact 0.0350 on this page’s worked table), and Fisher’s attainable p-values are discrete, so the sum often lands noticeably above α rather than just under it. The exact value is the benchmark; the approximation is the one that moved.
How big does N need to be for the asymptotic test?
There is no N that answers this, which is the trap in the question. The chi-square approximation depends on the expected counts, and a large N with lopsided margins can still produce an expected count below 1, while a small N with even margins can pass Cochran’s rule. Compute the expected counts and judge those.
Is chi-square ever exact?
No. Chi-square is always an approximation of a discrete distribution by a continuous one; it can be an excellent approximation when expected counts are large, but excellence is not exactness. The exact tests are the enumerative ones — Fisher, Freeman–Halton, and the unconditional Barnard and Boschloo tests.
What about Boschloo’s or Barnard’s tests?
They are unconditional exact tests that recover the power Fisher’s conditioning gives up, and Campbell (2007) recommends Boschloo’s for comparative trials. This site names them honestly but does not offer them as calculators; a Fisher result is not made wrong by their existence.
Does the choice of test change my effect size?
No — the odds ratio, relative risk and the other effect sizes are properties of your table, not of the test you ran on it. What the choice changes is the p-value and, for the odds ratio’s interval, whether the interval is the exact Cornfield one or an approximation. Report the effect size whichever test you choose.
Run your own table — both calculators
Put your four counts into the Fisher exact test calculator and read the exact p-value with its enumeration shown; then run the same table through the chi-square test calculator and look at the validity verdict in its result block — it runs Cochran’s rule on your expected counts and tells you which of the two numbers deserves your trust. If the table is larger than 2×2, the Freeman–Halton calculator is the exact route, and if your data are paired, start with McNemar’s test instead. When the two p-values differ and you need to explain why in a report, the interpretation guide takes the result the rest of the way.