Chi-Square Calculator — Goodness of Fit Test (Free)
StatisticsFreeNo sign-up
A chi-square calculator tests whether observed counts match expected counts. Add (O − E)²/E over every category, then compare the total with the chi-square distribution. For a die rolled 60 times showing 8, 9, 12, 11, 6 and 14, each expected count is 10, so χ² = 4.2 with 5 degrees of freedom and p = 0.521: no evidence the die is unfair.
Row 2
| Category | Observed O | Expected E | O − E | (O − E)²/E | Std. residual |
|---|---|---|---|---|---|
| Category 1 | 8 | 10 | −2 | 0.4 | −0.63 |
| Category 2 | 9 | 10 | −1 | 0.1 | −0.32 |
| Category 3 | 12 | 10 | 2 | 0.4 | 0.63 |
| Category 4 | 11 | 10 | 1 | 0.1 | 0.32 |
| Category 5 | 6 | 10 | −4 | 1.6 | −1.26 |
| Category 6 | 14 | 10 | 4 | 1.6 | 1.26 |
| Total | 60 | 60 | 0 | 4.2 |
Show steps
- Hypotheses. H₀: the population follows the expected distribution (all 6 categories equally likely). H₁: it does not.
- Expected counts: E = N / k = 60 / 6 = 10 for every category.
- For each category compute (O − E)²/E: (8 − 10)²/10 = 0.4; (9 − 10)²/10 = 0.1; (12 − 10)²/10 = 0.4; (11 − 10)²/10 = 0.1; (6 − 10)²/10 = 1.6; (14 − 10)²/10 = 1.6.
- Add them: χ² = Σ(O − E)²/E = 4.2.
- Degrees of freedom: df = k − 1 = 6 − 1 = 5. (If you estimated parameters from the data, such as a mean, subtract one more for each.)
- p-value = P(χ² > 4.2) for df = 5 = 0.5210. The critical value at α = 0.05 is 11.070.
- Fail to reject H₀: 4.2 ≤ 11.070 (p > α). The observed counts are consistent with the expected distribution.
- Effect size: w = √(χ²/N) = √(4.2/60) = 0.265, a small effect.
| Significance level α | Critical χ² | χ² > critical? |
|---|---|---|
| 0.1 | 9.236 | No |
| 0.05 | 11.070 | No |
| 0.025 | 12.833 | No |
| 0.01 | 15.086 | No |
| 0.005 | 16.750 | No |
| 0.001 | 20.515 | No |
How to use the chi-square calculator
- Pick the test. Goodness of fit checks one categorical variable against expected counts or proportions. Independence checks whether two categorical variables in a contingency table are related. p-value turns a χ² statistic and its degrees of freedom into a p-value.
- Enter the observed counts. For goodness of fit, leave the expected box empty when every category should be equally likely, or type expected counts, proportions, percentages or a ratio such as 9:3:3:1 (as 9 3 3 1). For independence, type the table and use + Row and + Column to resize it up to 10 × 10.
- Choose the significance level α (0.05 is the usual choice) and read χ², df, the p-value and the decision. Open Show steps for the full working.
The result also shows expected counts, each cell’s contribution, residuals, the effect size (Cohen’s w or Cramér’s V), a warning when expected counts are too small, the chi-square curve with the p-value shaded, and a table of critical values for your df.
The chi-square statistic
χ² = Σ (O − E)² / E, where O is an observed count and E the expected count for the same category or cell. A large χ² means the observed counts are far from what H₀ predicts. Always use counts, not percentages, for O.
- Goodness of fit: E = N × (expected proportion), and df = k − 1 for k categories.
- Independence: E = (row total × column total) / N, and df = (rows − 1)(columns − 1).
The p-value is the area of the chi-square curve to the right of your statistic. The calculator finds it with the regularized incomplete gamma function, p = Q(df/2, χ²/2), which is accurate far into the tail, so very small p-values are shown in scientific notation instead of being rounded to 0.
Worked examples
Goodness of fit: is the die fair?
Rolls of 1 to 6: 8, 9, 12, 11, 6, 14 (N = 60). If the die is fair, E = 60 / 6 = 10 for each face. Contributions: 0.4, 0.1, 0.4, 0.1, 1.6, 1.6, so χ² = 4.2 with df = 5. The p-value is 0.521, far above 0.05, and the critical value 11.070 is far above 4.2. Fail to reject H₀.
Goodness of fit with a ratio: Mendel’s peas
Mendel counted 315, 108, 101 and 32 peas (N = 556) where theory predicts 9:3:3:1. The expected counts are 556 × 9/16 = 312.75, then 104.25, 104.25 and 34.75. The statistic is χ² = 0.470 with df = 3, p = 0.925: the data fit the 9:3:3:1 ratio very well.
Test of independence: a 2 × 3 table
Two groups of 50 people choose among options A, B and C: group 1 picks 25, 15, 10 and group 2 picks 15, 25, 10. The column totals are 40, 40 and 20, so the expected counts are 20, 20 and 10 in each row. χ² = 1.25 + 1.25 + 0 + 1.25 + 1.25 + 0 = 5.0 with df = (2 − 1)(3 − 1) = 2, p = 0.082. At α = 0.05 there is not enough evidence of an association; Cramér’s V = √(5 / (100 × 1)) = 0.224.
A 2 × 2 table with and without Yates’ correction
For the table 42, 18 / 28, 32 (N = 120), Pearson’s χ² = 6.72 with df = 1 and p = 0.0095. With Yates’ continuity correction, χ² = 5.794 and p = 0.016. Both are significant at 0.05; the correction always makes a 2 × 2 test a little more cautious.
Chi-square critical values table
Reject H₀ when your χ² is larger than the value in your df row and α column.
| df | α = 0.10 | α = 0.05 | α = 0.01 | α = 0.001 |
|---|---|---|---|---|
| 1 | 2.706 | 3.841 | 6.635 | 10.828 |
| 2 | 4.605 | 5.991 | 9.210 | 13.816 |
| 3 | 6.251 | 7.815 | 11.345 | 16.266 |
| 4 | 7.779 | 9.488 | 13.277 | 18.467 |
| 5 | 9.236 | 11.070 | 15.086 | 20.515 |
| 6 | 10.645 | 12.592 | 16.812 | 22.458 |
| 7 | 12.017 | 14.067 | 18.475 | 24.322 |
| 8 | 13.362 | 15.507 | 20.090 | 26.124 |
| 9 | 14.684 | 16.919 | 21.666 | 27.877 |
| 10 | 15.987 | 18.307 | 23.209 | 29.588 |
| 12 | 18.549 | 21.026 | 26.217 | 32.909 |
| 15 | 22.307 | 24.996 | 30.578 | 37.697 |
| 20 | 28.412 | 31.410 | 37.566 | 45.315 |
| 25 | 34.382 | 37.652 | 44.314 | 52.620 |
| 30 | 40.256 | 43.773 | 50.892 | 59.703 |
Expected counts below 5 and effect size
The chi-square test is an approximation that works when expected counts are large enough. A common rule (Cochran’s) asks that no expected count is below 1 and no more than 20% are below 5. When the rule fails, combine small categories, collect more data, or for a 2 × 2 table use Fisher’s exact test. The calculator counts the low cells and shades them for you.
A p-value says whether a difference is likely to be real, not how big it is. With a large N even a tiny difference becomes significant, so report an effect size too. Cramér’s V = √(χ² / (N × min(r − 1, c − 1))) runs from 0 (no association) to 1. For a 2 × 2 table it equals |φ|, and 0.1, 0.3 and 0.5 are the usual cut-offs for small, medium and large. For goodness of fit, Cohen’s w = √(χ² / N) uses the same cut-offs.
Common mistakes
| Mistake | Fix |
|---|---|
| Entering percentages as observed values | Use the actual counts; a chi-square test on percentages gives a wrong χ². |
| Wrong degrees of freedom | k − 1 for goodness of fit, (r − 1)(c − 1) for independence, not N − 1. |
| Ignoring small expected counts | Check the warning; combine categories or use an exact test. |
| Saying H₀ is proven | A large p-value means “no evidence of a difference”, not proof that there is none. |
| Counting one person twice | Each subject must fall in exactly one cell, and observations must be independent. |
Checking homework with the calculator
Work out the expected counts and contributions by hand first. Then compare with the table in the result: if your χ² differs, the first cell that does not match shows where the slip happened. Most textbook answers round to 2 or 3 decimals, so tiny differences in the last digit are normal.
Chi-square test practice quiz: 10 questions
Test yourself with 10 multiple-choice questions. Choose an answer and press Submit to see if you are right and why. Your score appears at the end.
E = 50 for heads and tails. (60 − 50)²/50 + (40 − 50)²/50 = 2 + 2 = 4.
The 0.05 critical value for df = 1 is 3.841 (which is 1.96²). 5.991 is for df = 2 and 2.706 is α = 0.10.
The critical value for df = 2 is 5.991. 9.2 > 5.991 (p ≈ 0.010), so reject H₀.
Half the cells (50%) are below 5, more than the 20% the rule allows. A zero observed count is fine; the rule is about expected counts.
Chi-square tests need counts (frequencies) of categories. Means, bare percentages and continuous measurements need other methods.
Quiz complete
Frequently asked questions
What does chi-square calculate?
It measures how far observed counts are from the counts you would expect under a hypothesis. The goodness-of-fit test compares one variable with a claimed distribution; the test of independence checks whether two categorical variables are related.
How do you calculate a p-value from chi-square?
Find the area to the right of the statistic under the chi-square curve with the right df. Use the p-value tab, a table (which only gives a range, such as 0.05 < p < 0.10), or a function such as CHISQ.DIST.RT in a spreadsheet. For χ² = 3.841 with df = 1, p = 0.05.
How do you do a chi-square goodness-of-fit test on a graphing calculator?
On a TI-84, put the observed counts in L1 and the expected counts in L2, then choose STAT, TESTS, χ²GOF-Test, enter df = k − 1 and calculate. The calculator here gives the same χ² and p-value and shows the working.
Is it chi-square or chi-squared?
Both are used. “Chi-square” is common in American textbooks and “chi-squared” in British and mathematical writing. The symbol is χ².
Is chi-square only for 2 × 2 tables?
No. The test of independence works for any r × c table (this calculator goes up to 10 × 10), and the goodness-of-fit test works for any number of categories. Only Yates’ correction is limited to 2 × 2 tables.
Related calculators
- P-value calculator: p-values for z, t and other tests
- Sample size calculator: how many responses a survey needs
- Probability calculator: basic and conditional probability
- Binomial probability calculator: exact tests for two categories
- Standard deviation calculator: spread of numerical data
More statistics calculators
Related to This Article
More math articles
- Number Properties Puzzle – Challenge 10
- Mississippi MAAP Grade 4 Math Free Worksheets: 72 Free Skill-by-Skill PDFs with Answer Keys
- The Double V Campaign and the Second Great Migration
- 8th Grade OST Math Practice Test Questions
- GED Math Practice Test PDF with Answers (2027 Guide)
- Seven Playful Ways to Get Sharper at Math Without Turning It Into Homework
- How to Find the Surface Area of Pyramid?
- 5th Grade NYSE Math FREE Sample Practice Questions
- Partial Fraction Decomposition Calculator (Free)
- 49 Free MTYA Grade 5 Math Worksheets for Maine Students (Aligned, One Skill Per Page)












What people say about "Chi-Square Calculator: Goodness of Fit & Independence Test"?
No one replied yet.