Skip to content
Statistics CalculatorStatistics Calculator

Chi-Square Calculator

Run a chi-square test — goodness of fit or a test of independence — to get the χ² statistic, degrees of freedom, p-value, and a clear decision, with a shaded distribution chart.

Tested against reference valuesLast reviewed August 2026
Chi-square (χ²)2.0000
P-value0.7358
Fail to reject H₀ at α = 0.05
Degrees of freedom
4
Critical value
9.4877

Chi-square distribution (df = 4)

p = 0.7358
χ² = 2.00
Distribution P-value area Test statistic

How to use this calculator

  1. Choose “Goodness of fit” to compare observed counts to expected counts, or “Independence” to test a contingency table.
  2. For goodness of fit, leave the expected counts blank to assume every category is equally likely.
  3. For independence, enter one row of the table per line.
  4. Read the χ² statistic, degrees of freedom, p-value, and the decision at your chosen α.

What is a chi-square test?

A chi-square test compares observed frequencies with the frequencies you would expect under a null hypothesis. A goodness-of-fit test checks whether a single categorical variable follows an expected distribution. A test of independence checks whether two categorical variables are related.

χ2=(OE)2E\chi^2=\sum \dfrac{(O-E)^2}{E}

where O is each observed count and E is the expected count. A larger χ² means the observed data is further from what the null hypothesis predicts.

Degrees of freedom

  • Goodness of fit: df = number of categories − 1.
  • Test of independence: df = (rows − 1) × (columns − 1).

Interpreting the result

Compare the p-value to your significance level (α, often 0.05). If the p-value is smaller, reject the null hypothesis: the observed counts differ significantly from expectation, or the two variables are related. Otherwise, fail to reject it.

Chi-square tests assume reasonably large expected counts (a common rule is that each expected count should be at least 5).

Chi-square test in Excel

Use =CHISQ.TEST(observed_range, expected_range) to get the p-value directly, or =CHISQ.DIST.RT(x, df) to find the upper-tail probability for a χ² statistic.

Frequently asked questions

What is the difference between goodness of fit and a test of independence?

A goodness-of-fit test checks whether one categorical variable matches an expected distribution. A test of independence uses a contingency table to check whether two categorical variables are associated.

What does a large chi-square value mean?

A large χ² statistic means the observed counts are far from the expected counts, which is evidence against the null hypothesis. Whether it is significant depends on the degrees of freedom and the resulting p-value.

What are the assumptions of a chi-square test?

The data should be counts of independent observations in mutually exclusive categories, and expected counts should be reasonably large — a common guideline is at least 5 in each cell.

Related calculators

Was this calculator helpful?