This chi-square goodness of fit calculator tests whether observed category counts match an expected distribution — paste observed counts, choose equal expected or supply your own, and get χ², degrees of freedom and the p-value.
χ² = Σ (O−E)²/E — a Fairness Audit for Categories
Testing association in a two-way table instead? That's the Chi-Square Calculator (independence test). Part of our Statistics Calculators collection.
Worked Example (Verified)
- Die rolled 60 times: 12, 8, 11, 9, 10, 10 (defaults), expected 10 per face: χ² = (4+4+1+1+0+0)/10 = 1.000, df = 5, p = 0.9626 — the die looks boringly fair; a chi-square this small is itself unremarkable (p near 1 hints at fitted data in fraud audits, in dice it's just luck running smooth)
- What rigged looks like: 20, 6, 8, 8, 9, 9 gives χ² = 12.6, p = 0.027 — flagged at last; but a subtler cheat (14, 7, 9, 9, 10, 11 → χ² = 2.8, p = 0.73) sails through 60 rolls untouched; dice need hundreds of rolls for court-grade evidence, which is why casinos swap dice instead of litigating them
- df = categories − 1 − (parameters estimated from the data) — fitting a Poisson and testing it costs an extra df for λ
Goodness-of-Fit Discipline
- Counts, never percentages or means — the statistic eats raw frequencies only.
- Expected ≥ 5 per category is the safety rule; merge sparse bins (and lose the df accordingly).
- A big n makes trivial misfits “significant”: report an effect sense (how far off, per category residuals) beside χ².
- The test is omnibus — it says “somewhere off”, the residuals say where.
Related Tools
- Chi-Square Calculator — independence in tables
- Dice Probability Calculator — exact dice distributions
- Statistics Calculators — the full collection
Frequently Asked Questions
How do you calculate chi-square goodness of fit?
For each category compute (Observed − Expected)²/Expected and sum: χ² = Σ(O−E)²/E, with df = categories − 1. The p-value comes from the chi-square distribution. Dice at 12, 8, 11, 9, 10, 10 vs 10 each: χ² = 1.000, df = 5, p = 0.9626 — an excellent fit.
What is a good chi-square value?
Near its degrees of freedom is “typical under the null”: χ² ≈ df means ordinary sampling wobble. Much larger (p < 0.05) signals misfit; suspiciously tiny (p > 0.999) can signal data too perfect — Mendel's pea data famously flirted with this.
Can I test against a non-uniform expected distribution?
Yes — enter expected counts (or proportions; the tool rescales them to your observed total). Testing Mendel ratios 9:3:3:1, a market-share model, or last year's distribution all work the same way, and df adjusts only if you estimated parameters from the same data.
Goodness of fit vs test of independence — what's the difference?
Goodness of fit: one categorical variable against a claimed distribution (this page). Independence: two categorical variables in a contingency table, asking whether they associate (the Chi-Square Calculator). Same χ² machinery, different tables and questions.
What if expected counts are below 5?
The chi-square approximation to the p-value degrades. Merge sparse categories into an “other” bin (df drops accordingly) or use an exact/simulated test. The tool reports your smallest expected count so you can judge.
Is this chi-square goodness of fit calculator free?
Yes — free, instant, no sign-up.