Chi-Square Calculator

Perform a chi-square goodness-of-fit test.
Enter observed and expected frequencies to calculate the chi-square statistic and p-value.

Chi-Square Test Results

The chi-square goodness-of-fit test determines whether observed data matches an expected distribution. This calculator computes the chi-square statistic, degrees of freedom, and p-value for your data.

Formula:

χ² = Σ (Observed - Expected)² / Expected

Step-by-step method:

  1. For each category, subtract the expected count from the observed count.
  2. Square the difference.
  3. Divide by the expected count.
  4. Sum all the values to get the chi-square statistic (χ²).

What each variable means:

  • Observed Values: the actual counts you measured or collected from your data.
  • Expected Values: the counts you would expect if the null hypothesis is true. If left blank, the calculator assumes all categories should be equal (total / number of categories).
  • Degrees of Freedom: equals the number of categories minus 1.

When to use this test: Use it when working with categorical data (counts or frequencies) and you want to test whether the observed distribution differs from what you expected. Common applications include testing whether a die is fair, whether customer preferences match predictions, or whether survey responses differ from expected proportions.

Practical example: You roll a die 60 times and get these results: 12, 8, 15, 10, 7, 8. Expected for a fair die: 10 each. χ² = (12-10)²/10 + (8-10)²/10 + (15-10)²/10 + (10-10)²/10 + (7-10)²/10 + (8-10)²/10 = 0.4 + 0.4 + 2.5 + 0 + 0.9 + 0.4 = 4.6. With df = 5, the p-value is 0.467. Since 0.467 > 0.05, we fail to reject the null hypothesis — the die appears fair.

Interpreting results:

  • If p-value < 0.05, reject the null hypothesis: the observed distribution significantly differs from expected.
  • If p-value ≥ 0.05, fail to reject the null: no significant difference detected.

Common mistakes: Each expected count should ideally be 5 or more for the test to be reliable. If you have very small expected counts, consider combining categories. The chi-square test works with counts, not percentages — always enter raw frequency data.


How we build and check this calculator

This calculator runs entirely in your browser, so the numbers you enter stay on your device. The math behind it is written by hand and tested against worked examples and standard references before the page goes live.

SuperGlobalCalculator is independently built and maintained. See how we build and verify our calculators.


Embed This Calculator

Copy the code below and paste it into your website or blog.
The calculator will work directly on your page.