χ²

Chi-Square Calculator

Goodness-of-fit test: enter observed (O) and expected (E) frequencies to get χ², degrees of freedom, and p-value significance.

Results

Chi-Square Test

The chi-square goodness-of-fit test asks: "Is the distribution of observed frequencies consistent with what we expected?" The test statistic χ² = Σ(O−E)²/E accumulates the standardized squared deviations across all categories.

Interpretation

A large χ² means observed frequencies deviate substantially from expected. The p-value tells you the probability of getting a χ² this large or larger if the null hypothesis (data follows the expected distribution) were true. p < 0.05 is typically considered statistically significant.

Assumptions

Expected frequency ≥ 5 in each category (combine small categories if needed). Observations must be independent. The test applies to counts/frequencies, not percentages or continuous measurements.

Worked Example

A die is rolled 120 times. You expect each face to appear 20 times. Observed counts: 1→25, 2→17, 3→15, 4→23, 5→20, 6→20. Calculate χ²:

(25−20)²/20 + (17−20)²/20 + (15−20)²/20 + (23−20)²/20 + (20−20)²/20 + (20−20)²/20 = 1.25 + 0.45 + 1.25 + 0.45 + 0 + 0 = 3.40

With df = 6 − 1 = 5, a χ² of 3.40 gives p ≈ 0.64. Since p > 0.05 there is no significant evidence that the die is unfair — the observed deviations are well within random chance.

Chi-Square Critical Values Reference

Degrees of Freedomp = 0.10p = 0.05p = 0.01p = 0.001
12.7063.8416.63510.828
24.6055.9919.21013.816
36.2517.81511.34516.266
47.7799.48813.27718.467
59.23611.07015.08620.515
1015.98718.30723.20929.588

If your χ² statistic exceeds the critical value in the table for your degrees of freedom, you reject the null hypothesis at that significance level. For example, with df=3 and χ²=8.5, since 8.5 > 7.815 (p=0.05 threshold), the result is significant at the 5% level.

Frequently Asked Questions

χ² = Σ(Oᵢ − Eᵢ)² / Eᵢ, summed over all categories. Each term measures how far the observed count is from expected, relative to expected. Larger deviations contribute more to χ².

For goodness of fit with k categories: df = k − 1. The chi-square distribution shape depends on df. The critical value for significance (p=0.05) increases with more degrees of freedom.

There is less than a 5% probability of observing a χ² this large if the null hypothesis (no difference between observed and expected) were true. This is standard evidence to reject the null hypothesis.

The chi-square approximation is unreliable when any expected frequency is below 5. Combine small categories or use Fisher's exact test for small samples.

Not directly. Chi-square works on counts (frequencies). If you have continuous data, you first bin it into categories, then use the observed and expected counts within each bin. Choosing bin widths can affect the result, so this requires care.

The goodness-of-fit test (used here) compares a single variable's observed distribution against a specified theoretical distribution. The test of independence examines a two-way contingency table to see if two categorical variables are associated with each other. Both use the same χ² = Σ(O−E)²/E formula but differ in how expected values are calculated and the degrees of freedom.

A chi-square of zero means observed frequencies exactly match expected frequencies in every category — a perfect fit. In real data this almost never happens. A very small χ² (not zero) simply means your data fits the expected distribution well and there is no reason to reject the null hypothesis.

Formula sources & accuracy standards: Calculator Methodology · Editorial Policy