Chi-Square Test of Independence Calculator
Test whether two categorical variables are related using a contingency table, with expected counts, chi-square statistic, p-value and Cramér's V.
Statistical results depend on the assumptions stated in the formula. Check that your data meet them before drawing conclusions.
How to use this calculator
Enter the observed counts in a table, with one row for each category of one variable and one column for each category of the other. For example, rows could be men and women and columns their preferred product. The calculator computes the counts expected if the variables were unrelated, the chi-square statistic, its p-value and the strength of the association.
Formula
Expected count Eᵢⱼ = row total × column total ÷ grand total. χ² = Σ (O − E)² ÷ E over all cells, with (rows − 1) × (columns − 1) degrees of freedom. Cramér's V = √(χ² ÷ [n × (min(rows, columns) − 1)]).
Calculator credits
Calculator developmentJulia Edwards
Editorial supervisionSamad Aslam Khan
Expert reviewSaeedM.Phil Statistics, Data Scientist
Published byThe Calculatorz
Last updated
Read how we research, test, review and correct our calculators in our editorial policy.
Frequently asked questions
What does the chi-square test of independence test?
Whether two categorical variables are associated in the population, for example whether smoking status differs by gender.
What are the assumptions?
Observations are independent, the data are counts (not percentages), and expected counts are at least 5 in most cells. The calculator warns when expected counts are small.
What if expected counts are below 5?
Combine categories if it makes sense, or use Fisher's exact test for 2 × 2 tables.
What is Cramér's V?
A measure of the strength of association from 0 (none) to 1 (perfect). Values around 0.1 are small, 0.3 medium and 0.5 large.
Can I enter percentages?
No. The test needs raw counts. Percentages lose the sample size and give wrong results.
Does a significant result show cause?
No. It shows an association. Other variables or the way data were collected may explain it.
References & methodology sources
These sources support the calculator’s formula, definitions, thresholds, units or result interpretation.
- Croarkin, C., & Tobias, P. (Eds.). (2012). NIST/SEMATECH e-handbook of statistical methods. National Institute of Standards and Technology. View source
- Illowsky, B., & Dean, S. (2023). Introductory statistics 2e. OpenStax. View source
- Casella, G., & Berger, R. L. (2002). Statistical inference (2nd ed.). Duxbury. View source
- Ross, S. M. (2019). A first course in probability (10th ed.). Pearson. View source