
Chi-Square Calculator
Chi-square goodness-of-fit statistic from observed and expected counts.
Chi-square (χ²)
12.32
df = 3
Degrees of freedom
3
Categories
4
Σ Observed
100
Σ Expected
100
Contribution by cell
| Cell | Observed | Expected | (O−E)²/E |
|---|---|---|---|
| Cell 1 | 18 | 25 | 1.96 |
| Cell 2 | 22 | 25 | 0.36 |
| Cell 3 | 20 | 25 | 1 |
| Cell 4 | 40 | 25 | 9 |
AI Breakdown & Smart Takeaway
Plain-English insight on your numbers
Get a personalized explanation of what these results mean — and how to improve them.
How the Chi-Square Calculator works
The Chi-Square Calculator computes the chi-square goodness-of-fit statistic by comparing observed counts to expected counts across categories, then returns the chi-squared value, degrees of freedom, and p-value — making it essential for students, researchers, and analysts who need to test whether real-world data matches a theoretical distribution.
The chi-square goodness-of-fit test answers one core question: does your observed data fit a hypothesized distribution? You supply two parallel lists — the counts you actually observed in each category and the counts you expected under your null hypothesis. The calculator squares the difference between each pair, divides by the expected value to normalize it, and sums those ratios across all categories. The resulting chi-squared statistic measures total discrepancy; a value near zero means the data fits well, while a large value signals a meaningful deviation from expectation.
Degrees of freedom (df) are calculated automatically as the number of categories minus one (k − 1). This matters because the chi-square distribution's shape changes with df, and the correct p-value can only be obtained by referencing the right distribution curve. For example, a chi-squared statistic of 7.0 yields a very different p-value with 2 degrees of freedom than with 5. Getting df wrong is one of the most common errors users make when performing the test by hand, which is exactly why letting the calculator derive it from your category count is valuable.
The p-value returned by the calculator is the probability of observing a chi-squared statistic at least as extreme as yours if the null hypothesis were true. By convention, a p-value below 0.05 is taken as statistically significant, meaning you reject the null hypothesis that the observed distribution matches the expected one. However, significance alone doesn't tell you where the mismatch is — inspect the category-level (O − E)² / E contributions to pinpoint which groups drive the result. Large individual contributions reveal the specific categories where reality diverges from expectation.
A critical but often overlooked assumption is that expected counts must be sufficiently large — generally at least 5 per category — for the chi-square approximation to be valid. If any expected count falls below 5, the p-value becomes unreliable, and you should consider combining adjacent categories or using an exact test instead. Similarly, the chi-square goodness-of-fit test requires independent observations; it is not appropriate for paired or repeated-measures data. Feeding in percentages or proportions instead of raw counts is another common mistake — always convert to actual counts before entering values.
Formula
χ² = Σ (Observed − Expected)² / Expected, df = categories − 1
Pro tips
- Always use raw counts, not proportions or percentages — the chi-square formula requires actual frequencies, and using proportions will produce a wildly incorrect statistic.
- Check that every expected count is at least 5 before trusting the p-value; if not, merge small categories or switch to Fisher's exact test to maintain validity.
- After getting your result, look at the per-category (O − E)² / E breakdown to identify which specific categories contribute most to any significant result — overall significance alone doesn't tell the full story.
- If you are fitting a distribution whose parameters were estimated from the data itself (e.g., estimating the mean to form expected counts), subtract one additional degree of freedom for each estimated parameter to avoid an inflated p-value.
- A non-significant p-value does not prove your model fits perfectly — it only means you lack evidence to reject it. Collect more data if you need tighter detection of small deviations.
Key terms
- Chi-Square Statistic (χ²)
- — A single number summarizing the total squared, normalized deviation between observed and expected counts across all categories.
- Goodness of Fit
- — A measure of how well observed data conform to a specified theoretical or expected distribution.
- Degrees of Freedom (df)
- — For a goodness-of-fit test, df equals the number of categories minus one, and it determines which chi-square distribution is used to find the p-value.
- P-Value
- — The probability of obtaining a chi-squared statistic as large as or larger than the one computed, assuming the null hypothesis is true.
- Observed Count (O)
- — The actual frequency or count recorded in each category from your data or experiment.
- Expected Count (E)
- — The theoretical frequency for each category predicted by the null hypothesis or a specified distribution.



