Chi-Square Test Calculator
Chi-square test of independence for any r × c contingency table with expected counts, Cramér's V and Fisher's exact test for 2 × 2, plus chi-square goodness of fit.
The Chi-Square Calculator tests whether two categorical variables are independent (χ² = Σ(O − E)²/E over a contingency table, df = (r − 1)(c − 1)) or whether observed counts fit expected proportions (goodness of fit, df = k − 1). For 2 × 2 tables it also gives Yates' correction and the exact Fisher p-value.
Free, runs in your browser. Nothing you enter is uploaded.
How to use it
- Choose independence or goodness of fit.
- Set the table size and enter counts.
- Read χ², p and expected counts.
- For small counts use the Fisher p-value.
What you enter
- Observed counts
What you get
- χ² and df
- p-value
- Expected counts
- Effect size
- Fisher's exact p (2 × 2)
Formula
χ² = Σ (O − E)² / E, E = (row total × column total) / N
Under independence each cell's expected count is proportional to its row and column totals; large discrepancies inflate χ². The p-value comes from the χ² distribution with (r − 1)(c − 1) degrees of freedom.
Worked example
Input: [[30, 10], [15, 25]]
Result: χ² = 11.43, df = 1, p = 0.0007, Cramér's V = 0.38, Fisher p = 0.0015
Row and column categories are associated; the effect is moderate.
Questions
When should I use Fisher's exact test instead?
For 2 × 2 tables whenever any expected count is below 5, or the total sample is small (under ~40). The calculator shows both so you can compare.
Should I apply Yates' correction?
It makes the 2 × 2 test more conservative. Many statisticians now prefer the uncorrected test or Fisher's exact test; report which you used.
Limitations
- Unreliable when an expected count is below 5 — the tool flags this and offers Fisher's exact test for 2 × 2.
- Needs counts, not percentages.
References
Related reading
- Chi-Square Test of Independence in Genetics
- Fisher's Exact Test vs. Chi-Square: When to Use Each
- Effect Sizes for Categorical Data: Cramér's V, Phi and Odds Ratio
- Genetics Lab Report Example: Drosophila Crosses and Chi-Square
More Statistics
- Standard Deviation Calculator
- Mean, Median & Mode Calculator
- Variance Calculator
- Z-Score Calculator
- P-Value Calculator
- Confidence Interval Calculator
- T-Test Calculator
- Correlation Coefficient Calculator
- Linear Regression Calculator
- Normal Distribution Calculator
- Probability Calculator
- Binomial Distribution Calculator
All free tools · By Dr. Zubair Khalid, DVM, MS, PhD.