Chi-Square (Goodness-of-Fit) Calculator
Enter observed counts and expected counts to calculate the chi-square statistic, degrees of freedom, and p-value.
What this chisq calculator does
This chisq calculator performs a chi-square goodness-of-fit test. It helps you compare what you observed in real data against what you expected under a hypothesis. If observed and expected counts are very different, the test statistic grows and the p-value drops.
In plain language: this test answers the question, βAre these category counts close enough to expectation, or too far off to be explained by random variation?β
When to use a chi-square goodness-of-fit test
- You have categorical data (for example, yes/no, color categories, survey choices).
- You have counts, not percentages alone.
- You want to compare your observed distribution to a known or expected distribution.
- Each observation belongs to one category only.
Typical examples
- Checking whether a six-sided die is fair.
- Testing whether customer choices match a predicted market-share model.
- Comparing observed genetics ratios to Mendelian expectations.
How to enter your data
Put your observed counts into the first field. Then either:
- Enter expected counts directly, or
- Leave expected blank to assume all categories are equally likely.
If your expected values do not sum to the same total as observed values, the calculator automatically rescales them proportionally so totals match.
Formula used by the calculator
The chi-square statistic is:
χ2 = Σ (O - E)2 / E
where O is observed count and E is expected count for each category. Degrees of freedom are k - 1, where k is the number of categories.
Interpreting the result
- Large p-value (for example, p > 0.05): data are consistent with expected distribution.
- Small p-value (for example, p ≤ 0.05): evidence suggests observed data differ from expectation.
Statistical significance does not always mean practical importance. Always consider context, sample size, and real-world impact.
Assumptions and quality checks
Core assumptions
- Counts are from independent observations.
- Categories are mutually exclusive.
- Expected counts are not too small (a common guideline: each expected count should be at least 5).
Common mistakes to avoid
- Using percentages instead of counts without converting to counts.
- Mixing overlapping categories.
- Using this test for continuous data.
- Ignoring very small expected values.
Quick practical workflow
- Define categories and expected distribution.
- Collect observed counts.
- Run the chisq calculator.
- Check p-value against your alpha level.
- Report statistic, df, p-value, and interpretation.
FAQ
Can I leave expected counts blank?
Yes. The tool then assumes equal expected counts across all categories.
What if my expected counts and observed totals differ?
The calculator rescales expected values to match the observed total. This keeps the comparison valid for goodness-of-fit.
Is this the same as the chi-square test of independence?
No. This page implements the one-variable goodness-of-fit version. A chi-square test of independence uses a contingency table with row/column totals.