chi2 calculator

Chi-Square (χ²) Goodness-of-Fit Calculator

Enter observed counts and expected counts for each category. You can separate values with commas, spaces, or new lines.

Tip: You can also enter probabilities (sum = 1) or percentages (sum = 100).

What is a chi2 calculator?

A chi2 calculator helps you run a chi-square test, one of the most common methods in statistics for comparing what you observed in data to what you expected under a hypothesis. In this page, the tool performs a chi-square goodness-of-fit test.

In plain language: if your observed counts are very different from expected counts, the chi-square statistic gets large, and the p-value gets small.

How to use this calculator

  • Step 1: Enter your observed counts (for example, survey choices or category frequencies).
  • Step 2: Enter expected counts. If you leave this blank, the calculator assumes all categories are equally likely.
  • Step 3: Choose a significance level (commonly 0.05).
  • Step 4: Click Calculate χ² to see the statistic, degrees of freedom, and p-value.

Formula used

The calculator uses the standard goodness-of-fit formula:

χ² = Σ (Oi − Ei)² / Ei

  • Oi = observed count in category i
  • Ei = expected count in category i

Degrees of freedom are computed as k − 1, where k is the number of categories.

Worked example

Suppose you observed outcomes across three categories: 90, 60, and 50. You expected 50%, 30%, and 20% of the total, respectively. Entering those values gives a chi-square result and p-value that tells you whether your observed data are consistent with that expectation.

Use the Load Example button in the calculator to test this quickly.

Assumptions and best practices

1) Count data only

Chi-square tests work on frequencies or counts, not raw continuous values.

2) Independent observations

Each observation should belong to only one category, and observations should be independent.

3) Reasonable expected counts

A common rule of thumb is that expected counts should generally be at least 5 in each category. If many expected values are too small, the test may be unreliable.

Interpreting the output

  • Large χ²: observed values are far from expected values.
  • Small p-value (typically < α): reject the null hypothesis.
  • Large p-value: insufficient evidence to reject the null hypothesis.

Remember: “fail to reject” does not prove the null hypothesis true; it only means your data did not provide strong evidence against it.

Goodness-of-fit vs. independence tests

This page calculates a one-way goodness-of-fit chi-square. Another common chi-square test is the test of independence, used with contingency tables (such as 2×2 tables). The interpretation is related, but the setup and degrees of freedom are different.

🔗 Related Calculators

🔗 Related Calculators