Chi-Square Distribution Calculator

Calculate p-value from a chi-square test statistic and degrees of freedom.
Shows the right-tail probability and plots the chi-square PDF with critical region.

Chi-Square Distribution

The chi-square distribution is a family of right-skewed probability distributions, one for each number of degrees of freedom. It shows up constantly in statistics: goodness-of-fit tests, tests of independence in contingency tables, and variance inference all rely on it.

The distribution is defined only for non-negative values. With small degrees of freedom it is heavily right-skewed; as degrees of freedom grow it approaches a normal distribution, centered around df and with variance 2·df.

This calculator takes a chi-square statistic and degrees of freedom, then returns the right-tail p-value — the probability of observing a chi-square value at least as large as yours, assuming the null hypothesis is true. A p-value below 0.05 is conventionally “statistically significant.”

The p-value is computed using the Wilson-Hilferty approximation, which converts a chi-square quantile to a standard normal quantile:

z = [(χ²/df)^(1/3) - (1 - 2/(9·df))] / sqrt(2/(9·df))

p-value = 1 - Φ(z), where Φ is the standard normal CDF.

This approximation is accurate to three decimal places for df ≥ 2 and reasonable chi-square values, which covers virtually all practical hypothesis tests.

Common critical values for reference:

  • df=1: χ² = 3.84 gives p = 0.05; χ² = 6.63 gives p = 0.01
  • df=2: χ² = 5.99 gives p = 0.05; χ² = 9.21 gives p = 0.01
  • df=5: χ² = 11.07 gives p = 0.05; χ² = 15.09 gives p = 0.01

The chart plots the chi-square PDF for your chosen degrees of freedom, shading the right-tail region that corresponds to the p-value.

Computing the χ² statistic from data

If you have observed counts and need to compute the chi-square statistic itself before entering it above, the formula is:

χ² = Σ (O − E)² / E

where O is the observed count in each category, E is the expected count under the null hypothesis, and the sum runs over all categories. Degrees of freedom for a goodness-of-fit test = (number of categories − 1).

Worked example — is a die fair? A die is rolled 60 times. Under a fair-die null hypothesis, each face is expected 10 times. Observed counts: 8, 12, 11, 7, 13, 9.

  • Each contribution: (8−10)²/10 = 0.4; (12−10)²/10 = 0.4; (11−10)²/10 = 0.1; (7−10)²/10 = 0.9; (13−10)²/10 = 0.9; (9−10)²/10 = 0.1
  • Sum: χ² = 2.8
  • df = 6 − 1 = 5
  • The critical value at α = 0.05 for df = 5 is 11.07; 2.8 is well below, so we fail to reject the null. The die looks fair.

A second example — survey preferences. 200 people are asked their favourite season; the null hypothesis is equal preference (50 each). Observed: Spring 65, Summer 55, Autumn 45, Winter 35.

  • χ² = 15²/50 + 5²/50 + (−5)²/50 + (−15)²/50 = 4.5 + 0.5 + 0.5 + 4.5 = 10.0
  • df = 4 − 1 = 3; critical value at α = 0.05 is 7.815
  • χ² = 10.0 > 7.815, so we reject the null. There is a real seasonal preference.

Rule of thumb that catches a lot of bad chi-square work: each expected count E should be at least 5. With smaller expected counts the chi-square approximation breaks down and a Fisher exact test is the better tool.


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.