Home › Statistics & Probability Calculators › Chi-Square Goodness of Fit Calculator
Chi-Square Goodness of Fit Calculator
The chi-square goodness-of-fit test checks whether the counts observed in several categories match the counts you would expect under a claimed distribution: is a die fair, do birth months follow the calendar, does a sample of M&M colours match the stated mix? Enter the observed counts and, optionally, the expected counts or proportions; leave the expected box blank for equal expected counts.
The calculator scales expected proportions to the observed total, builds the (O − E)²/E table, sums it to get χ² with k − 1 degrees of freedom, and finds the p-value from the chi-square distribution. It also warns when any expected count is below 5, the usual condition for the approximation to be reliable.
The test is always right-tailed: large deviations from the expected pattern make χ² big and the p-value small. When categories form a two-way table rather than a single list, use the chi-square test of independence.
Separate values with commas, spaces or new lines.
Leave blank for equal expected counts. Proportions are scaled to the observed total.
Result and step-by-step solution
- State the hypothesesH₀: the observed counts follow the expected distribution. H₁: they do not.
- Expected countsTotal n = 120 across 6 categories. All expected counts are at least 5.
- Compute (O − E)² ÷ E for each category
Category Observed (O) Expected (E) O − E (O − E)²/E Category 1 22 20 2 0.2 Category 2 17 20 −3 0.45 Category 3 20 20 0 0 Category 4 26 20 6 1.8 Category 5 15 20 −5 1.25 Category 6 20 20 0 0 - Sum the termsχ² = Σ(O − E)²/E = 3.7, df = k − 1 = 5
- p-valueP(χ²5 ≥ 3.7) = 0.5934
- Decisionp = 0.5934 ≥ α = 0.05. Critical value χ²0.05,5 = 11.0705.
Frequently asked questions
- What are the degrees of freedom?
- k − 1, where k is the number of categories. If you estimated parameters of the expected distribution from the data, subtract one more for each estimated parameter.
- Can I enter expected values as percentages?
- Yes. Enter 50, 30, 20 or 0.5, 0.3, 0.2; the calculator scales them so they add to the observed total.
- What if an expected count is less than 5?
- The chi-square approximation becomes unreliable. Combine small categories or use an exact multinomial test.
- Is the goodness-of-fit test one-tailed or two-tailed?
- It is a one-tailed (right-tailed) test on the chi-square distribution, because any departure from the expected counts, in either direction, increases χ².
Last reviewed: September 25, 2026. Calculations run in your browser and were validated against SciPy.
