Chi-Square Test Calculator
Test whether two categorical variables are associated. Enter the observed counts for a 2 x 2 table and read the chi-square statistic, degrees of freedom, p-value and expected counts.
When to use this calculator
- You have two categorical variables, for example an exposure and an outcome, and want to test for an association.
- Your data are counts of independent participants, not paired or repeated measurements.
- Most expected counts are at least 5. If they are not, use Fisher's exact test instead.
How to use it
- Arrange your data as a 2 x 2 table, with one variable in the rows and the other in the columns.
- Enter the four observed counts.
- Choose Pearson (no correction) or the Yates continuity correction.
- Read the p-value, then check the smallest expected count and the strength of association (Cramer's V).
How to read the result
The p-value is the probability of seeing an association at least this strong if the two variables were truly independent. A small p-value is evidence against independence. It is not proof of a causal link.
Cramer's V describes the strength of the association on a scale from 0 to 1. Report it with the p-value, because a large sample can make a trivial association statistically significant.
If any expected count is below 5, the chi-square approximation can be poor. Use the Fisher's exact test calculator.
To describe how much more or less likely the outcome is, use the odds ratio or relative risk calculators.
Frequently asked questions
- When should I use the chi-square test?
- Use it to test whether two categorical variables are associated when the observations are independent and the expected counts are large enough, commonly at least 5 in most cells.
- Should I use the Yates continuity correction?
- Opinions differ. The correction makes the test more conservative for 2 x 2 tables. Many analysts use Pearson's chi-square when expected counts are adequate and Fisher's exact test when they are small. State which one you used.
- What are the degrees of freedom?
- For a table with r rows and c columns they equal (r - 1)(c - 1), so a 2 x 2 table has 1 degree of freedom.
- What if my expected counts are below 5?
- Use Fisher's exact test, which gives an exact p-value for a 2 x 2 table and does not rely on the chi-square approximation.
- Does a significant result mean the exposure causes the outcome?
- No. The test shows an association in your data. Causation depends on the study design and on ruling out bias and confounding.
Guides
Related calculators
Use this in a full research protocol
A free ToProt account lets you save calculations to a study, build your protocol and objectives, manage references and generate your data dictionary in one place.