Chi-Square CalculatorChi-Square Calculator
Values

Chi-Square p-Value Calculator

Enter χ² and its degrees of freedom to get the exact p-value. Useful when a paper or an exam question gives you the statistic but not the p-value.

p-value (upper tail)0.0113
Lower tail P(X ≤ χ²)0.9887
Mean of this distribution4
Critical value at 0.059.4877
018.5χ² = 12.990

The upper tail is the p-value for chi-square tests of independence and goodness of fit: the chance of a statistic of 12.9900 or more when the null hypothesis is true.

Reproduce this result in R or Python

R

pchisq(12.99, df = 4, lower.tail = FALSE)   # upper tail p
pchisq(12.99, df = 4)                       # lower tail

Python (SciPy)

from scipy.stats import chi2
print(chi2.sf(12.99, 4))    # upper tail p
print(chi2.cdf(12.99, 4))   # lower tail

Checked on November 21, 2026. Results computed by our statistics engine, version 1.0.0.

On this page

What the p-value is

For tests of independence and goodness of fit, large values of χ² count against the null hypothesis, so the p-value is the area under the chi-square curve to the right of your statistic: the probability of a χ² at least that large if the null hypothesis were true. The calculator shades that area.

The example above uses χ² = 12.99 with 4 degrees of freedom, the rounded statistic from the OpenStax volunteer table on the test of independence page. The exact upper-tail p is 0.0113. A table would only tell you that p is between 0.01 and 0.025.

Why exact beats a table range

Printed tables give a handful of columns, so you can only say "p < 0.05" or "between 0.01 and 0.025". Journals now ask for exact p-values, and APA style asks for exact values to two or three decimals, with p < .001 for anything smaller. The value here is computed to about twelve significant figures, the accuracy of R's pchisq and SciPy's chi2.sf (R pchisq documentation, SciPy gammainc).

For a check you can do in your head: χ² = 3.841 with 1 degree of freedom sits at the 5% point, so p comes back as 0.0500.

How it is computed

The upper tail of the chi-square distribution with k degrees of freedom equals Q(k/2, χ²/2), the regularized upper incomplete gamma function (NIST DLMF chapter 8). We evaluate it with a power series or a continued fraction, whichever converges faster, and compute the tail you ask for directly rather than as 1 minus the other tail. That is what keeps very small p-values accurate: a statistic of 1,000 with 10 degrees of freedom gives p = 1.870 × 10−208, where a naive subtraction would print 0.

Degrees of freedom need not be whole numbers. That is rare in chi-square tests but appears in some approximations, and the calculation handles it.

Upper or lower tail?

  • Upper tail: the p-value for tests of independence, homogeneity, goodness of fit, McNemar and the G-test. This is almost always what you want.
  • Lower tail: used for a suspiciously good fit (counts closer to expected than chance allows) and in tests about a variance.
  • Two-tailed: only for tests about a variance, where both very small and very large χ² count against the null. Double the smaller tail.

From p back to a statistic

To go the other way, from a significance level to the χ² you need to beat, use the critical value calculator, or the printable chi-square table. The chi-square distribution guide shows how the curve changes shape with the degrees of freedom.

Common questions

Why is my p-value 1 minus the table value?

Some tables list the area to the left. For chi-square tests you need the area to the right, the upper tail.

Can p be exactly zero?

No. Very large χ² values give extremely small p-values, which we show in scientific notation rather than as 0.000.

Sources