Statistics / Tests
Chi-Square Calculator (Independence and Goodness of Fit)
Run a χ² test of independence on a contingency table of counts, or a goodness-of-fit test against equal or given proportions, with χ², the degrees of freedom, the p-value, expected counts, and Cramér's V.
Chi-Square Calculator (Independence and Goodness of Fit): Each cell's expected count, if there were no association, is row total × column total ÷ grand total. χ² adds up (observed − expected)² ÷ expected over all cells, with (rows − 1) × (columns − 1) degrees of freedom, and the p-value comes from the χ² distribution. For the 2 × 2 table 20, 30 / 30, 20, χ² = 4.00 and p = 0.0455. Cramér's V scales χ² to 0–1 as a measure of strength. Runs 100% locally in your browser with zero server file uploads.
- Category
- School & study tools
- Runs
- In your browser
- Cost
- Free · no sign-up
- Availability
- Ready to use
Runs entirely in your browser
| 25 | 25 |
| 25 | 25 |
Significant at the 5% level (p < 0.05): the result would be unlikely if there were no real difference.
The χ² test compares observed counts with the counts expected if there were no effect: χ² = Σ (observed − expected)² ÷ expected. The test of independence asks whether two categorical variables are related, from a table of counts; goodness of fit asks whether counts follow given proportions. Use raw counts, not percentages, and no continuity correction is applied.
Worked example
In a survey, 20 of 50 men and 30 of 50 women prefer option A. The table 20, 30 / 30, 20 gives expected counts of 25 in every cell, χ² = 4.00 with 1 degree of freedom, and p = 0.046: just significant at the 5% level.
For comparing means of measurements rather than counts, use the t-test calculator.
Goodness of fit
To test a die for fairness, roll it 60 times and enter the six counts: the expected count is 10 for each face. A large χ² means the counts are further from equal than chance would usually give.
For several groups of measurements, the ANOVA calculator is the counterpart.
How to use it
- Choose independence (a table) or goodness of fit (one list of counts).
- Type the counts, one row per line for a table, and the expected proportions if they are not equal.
- Read χ², the degrees of freedom, the p-value, and the expected counts.
Privacy & limitations
Your data stay in your browser.
Related tools
Frequently asked questions
Can I use percentages?
No: the test needs the actual counts, because the same percentages from 10 people and from 1,000 carry very different evidence.
What if expected counts are small?
The χ² approximation becomes unreliable when expected counts fall below about 5; use Fisher's exact test for small 2 × 2 tables.
Is the Yates correction applied?
No: the result is the uncorrected Pearson χ², which statistics packages report by default for tables larger than 2 × 2.
Free tool · runs in your browser · no account required