Fisher's Exact Test Calculator
Calculate an exact association test for a 2×2 table in MiniWebtool’s Fisher's Exact Test Calculator. Four counts yield one- and two-tailed p-values from the hypergeometric distribution, with odds ratio, relative risk, and visual summaries.
For Gemini, paste the copied question into the chat. You can also copy it below.Need help using this tool? Ask AI
View the question
Enter your 2×2 table below to get the exact one- and two-sided p-values, the odds ratio and the steps.
About Fisher's Exact Test Calculator
The Fisher's Exact Test Calculator performs the exact significance test for 2×2 contingency tables using the hypergeometric distribution. Unlike the chi-square test which relies on an asymptotic approximation, Fisher's test computes exact p-values, making it the gold standard for analyzing categorical data — especially with small sample sizes. Enter your 2×2 table to get one-tailed and two-tailed p-values, odds ratios, relative risk, interactive mosaic plots, and step-by-step solutions.
How to Use the Fisher's Exact Test Calculator
- Enter cell values — input the four observed frequency counts for your 2×2 contingency table. Cell "a" represents Group 1 with a positive outcome, "b" is Group 1 with a negative outcome, "c" is Group 2 positive, and "d" is Group 2 negative. You can also click a quick example to see how it works.
- Choose test direction — select "Two-Tailed" to test for any association (most common), "Left-Tailed" if you hypothesize that the odds ratio is less than 1, or "Right-Tailed" if you expect it to be greater than 1.
- Set significance level — choose α (commonly 0.05). A smaller α requires stronger evidence to reject the null hypothesis.
- Interpret the results — review the p-value, odds ratio, relative risk, mosaic plot, hypergeometric probability distribution chart, and the detailed step-by-step calculation.
What Is Fisher's Exact Test?
Fisher's exact test, developed by Sir Ronald Fisher in 1935, is a statistical significance test for categorical data in contingency tables. It determines whether there is a nonrandom association between two categorical variables. The test is called "exact" because it calculates the exact probability of obtaining the observed data (or more extreme data) under the null hypothesis of independence, rather than relying on approximations like the chi-square test.
The Hypergeometric Distribution Formula
The probability of observing a particular 2×2 table with fixed marginal totals is given by the hypergeometric distribution:
= (R₁! × R₂! × C₁! × C₂!) / (N! × a! × b! × c! × d!)
Where R₁, R₂ are row totals, C₁, C₂ are column totals, and N is the grand total. This formula computes the exact probability of observing exactly that arrangement of values in the table.
When to Use Fisher's Exact Test
- Small sample sizes — when any expected cell count is less than 5, chi-square approximation becomes unreliable and Fisher's test is recommended
- 2×2 tables — the test is specifically designed for two-by-two contingency tables
- Exact inference needed — when you need an exact p-value rather than an asymptotic approximation
- Clinical trials — commonly used in medical research to compare treatment vs. control group outcomes
- Quality control — testing if defect rates differ between processes or batches
Fisher's Exact Test vs. Chi-Square Test
Both tests assess independence in contingency tables, but they differ in approach:
- Fisher's test computes exact probabilities; chi-square uses a large-sample approximation
- Fisher's test is always valid regardless of sample size; chi-square requires expected counts ≥ 5
- For large samples, both tests give nearly identical results, but chi-square is faster to compute
- Fisher's test becomes computationally intensive for very large tables (N > 1000)
Understanding Odds Ratio and Relative Risk
The odds ratio (OR) measures the strength of association between two events. OR = (a × d) / (b × c). An OR of 1 means no association, OR > 1 means the outcome is more likely in Group 1, and OR < 1 means it is more likely in Group 2. The 95% confidence interval helps assess whether the OR is statistically distinguishable from 1.
The relative risk (RR) compares the probability of the outcome between groups. RR = [a/(a+b)] / [c/(c+d)]. While the OR approximates the RR when the outcome is rare, they diverge for common outcomes. RR is often more intuitive to interpret in prospective studies.
One-Tailed vs. Two-Tailed Tests
A two-tailed test sums the probabilities of all tables that are equally or less probable than the observed table, regardless of the direction of the association. This is the most common and conservative approach. A one-tailed test only considers tables in one direction — left-tailed for OR < 1 or right-tailed for OR > 1 — and should only be used when you have a strong prior hypothesis about the direction of the effect.
FAQ
Why is my odds ratio different from R's fisher.test?
R reports the conditional maximum-likelihood odds ratio with an exact confidence interval, not the simple sample odds ratio (a times d divided by b times c). This calculator shows both: the sample odds ratio with a Woolf interval and, underneath, the conditional MLE and exact 95% interval that match fisher.test in R.
What is Fisher's exact test?
Fisher's exact test is a statistical significance test used to determine if there is a nonrandom association between two categorical variables in a 2×2 contingency table. Unlike the chi-square test, it calculates exact probabilities using the hypergeometric distribution, making it ideal for small sample sizes or when expected cell counts are below 5.
When should I use Fisher's exact test instead of chi-square?
Use Fisher's exact test when any expected cell count in your 2×2 table is less than 5, when the total sample size is small (typically less than 20-30), or when you want an exact p-value rather than an approximation. Fisher's test is always valid regardless of sample size, while chi-square is an approximation that becomes unreliable with small samples.
What is the difference between one-tailed and two-tailed Fisher's exact test?
A two-tailed test checks for any association between variables regardless of direction and is the most commonly used approach. A one-tailed test checks for association in a specific direction: left-tailed tests if the odds ratio is less than 1, and right-tailed tests if it is greater than 1. Use a two-tailed test unless you have a strong prior hypothesis about the direction of the effect.
How is the p-value calculated in Fisher's exact test?
The p-value is calculated using the hypergeometric distribution. For a given 2×2 table with fixed row and column totals, the exact probability of that table is computed. For a two-tailed test, the probabilities of all possible tables that are equally or less probable than the observed table are summed. For one-tailed tests, probabilities are summed in one direction only.
What does the odds ratio tell me in Fisher's exact test?
The odds ratio measures the strength of association between two categorical variables. An odds ratio of 1 means no association. Greater than 1 means Group 1 has higher odds of the positive outcome compared to Group 2. Less than 1 means Group 2 has higher odds. The 95% confidence interval helps assess whether the association is statistically meaningful — if the interval includes 1, the association may not be significant.
What happens to the odds ratio if one cell in my 2×2 table is zero?
A zero cell can make the ordinary odds ratio equal to zero or undefined because its calculation multiplies the diagonal cell counts and divides by the other two. The exact test can still calculate a p-value from the table, but the odds ratio needs careful interpretation. Do not silently change a count; if you use a correction for reporting an odds ratio, state the method.
Does swapping the two groups change the Fisher’s exact test result?
Swapping the group rows reverses the direction of the comparison: an odds ratio greater than 1 may become its reciprocal, such as 2 becoming 0.5. The two-sided p-value remains the same because the observed association has not changed, only its orientation. Keep the group order consistent when reporting the odds ratio so readers can tell which group is in the numerator.
How do I set up a 2×2 table for a treatment and control comparison?
Put one group on each row and the two outcome categories in columns, using observed counts in all four cells. For example, record how many people improved and did not improve in the treatment group, then enter the same two counts for the control group. Keep the outcome order identical across rows; the odds ratio’s direction depends on which outcome and group occupy the first row and column.
Reference this content, page, or tool as:
"Fisher's Exact Test Calculator" at https://MiniWebtool.com/fisher-s-exact-test-calculator/ from MiniWebtool, https://MiniWebtool.com/
by miniwebtool team. Updated: 2026-04-15
Chat with your favorite AI
For Gemini, paste the copied question into the chat. You can also copy it below.
View the question
Statistics And Data Analysis:
- A/B Test Sample Size Calculator New
- A/B Test Significance Calculator New
- ANOVA Calculator
- Arithmetic Mean Calculator
- Average Calculator
- Average Deviation Calculator
- 📊 Bar Graph Maker New
- Bayes' Theorem Calculator New
- Beta Distribution Calculator New
- Box and Whisker Plot Maker
- Chi-Square Test Calculator
- Coefficient of Variation Calculator
- Cohen's d Calculator
- Compound Growth Calculator Popular
- Confidence Interval Calculator
- Confidence Interval for Proportion Calculator
- Contingency Table Calculator New
- Conversion Rate Calculator New
- Correlation Coefficient Calculator
- Effect Size Calculator New
- Exponential Distribution Calculator New
- F-Test / F-Distribution Calculator New
- Fisher's Exact Test Calculator New
- Five Number Summary Calculator New
- Geometric Distribution Calculator New
- Geometric Mean Calculator
- Gini Coefficient Calculator
- Harmonic Mean Calculator
- Histogram Maker
- Hypergeometric Distribution Calculator New
- Interquartile Range Calculator
- Kruskal-Wallis Test Calculator
- 📈 Line Graph Maker New
- Linear Regression Calculator
- Logarithmic Growth Calculator
- Mann-Whitney U Test Calculator
- Mean Absolute Deviation (MAD) Calculator
- Mean Calculator
- Mean Median Mode Calculator
- Median Absolute Deviation Calculator
- Median Calculator Popular
- Midrange Calculator
- Mode Calculator
- Normal Distribution Calculator New
- Odds Ratio Calculator New
- Outlier Calculator Popular
- p-Value Calculator New
- Pareto Chart Generator New
- Percentile Calculator New
- 🥧 Pie Chart Maker New
- Population Standard Deviation Calculator
- Quartile Calculator
- Quartile Deviation Calculator
- Range Calculator
- RSD Calculator - Relative Standard Deviation Popular
- Root Mean Square Calculator
- Sample Mean Calculator
- Sample Size Calculator
- Sample Standard Deviation Calculator
- Scatter Plot Maker
- Six Sigma Process Capability Calculator New
- Spearman Rank Correlation Calculator New
- Standard Deviation Calculator
- Standard Error Calculator Popular
- Statistics Calculator
- t-Test Calculator
- Variance Calculator
- Weibull Distribution Calculator New
- Z-Score Calculator