Chi-Square Calculator
Test cases replayed : 4 of 4 match · Methodology · No outside source listed
Enter the chi-square statistic and the degrees of freedom of your test to get its p-value.
Result
Right-tailed p-value P(χ² ≥ statistic)
Cumulative probability P(χ² ≤ statistic)
Estimate for planning only, not tax, legal, financial or medical advice. This calculator uses the method explained on this page.
This browser did not allow copying. The sentence is in the box below, already selected: copy it with your keyboard or the menu.
How to use this calculator
Fill in the fields in this order; each step takes you to its field.
- Chi-square statistic (χ²): enter 0 or more.
- Degrees of freedom: enter a number from 1 to 1,000.
- Read the result: Right-tailed p-value P(χ² ≥ statistic); the panel also shows Cumulative probability P(χ² ≤ statistic).
How this calculator works
The p-value of a chi-square test is P(X ≥ χ²) for a chi-square distribution with k degrees of freedom: Q(k/2, χ²/2), the regularized upper incomplete gamma function, evaluated with the series and continued fraction of Numerical Recipes.
Degrees of freedom: categories − 1 for a goodness-of-fit test; (rows − 1) × (columns − 1) for a test of independence in a contingency table.
The formula
| Symbol | Meaning |
|---|---|
| Chi-square statistic (χ²) | |
| Degrees of freedom | |
| Right-tailed p-value P(χ² ≥ statistic) | |
chi2cdf(x, k) | the probability that a chi-square variable with k degrees of freedom is at most x. |
Worked example
| Chi-square statistic (χ²) | 7.81 |
|---|---|
| Degrees of freedom | 3 |
| Cumulative probability P(χ² ≤ statistic) | 0.9499 |
|---|
Right-tailed p-value P(χ² ≥ statistic) 0.0501
Each step uses the unrounded value of the step before it; figures on this page are rounded for display.
Frequently asked questions
What is the p-value of χ² = 7.81 with 3 degrees of freedom?
About 0.0501, right at the usual 0.05 threshold: 7.815 is the 5% critical value for 3 degrees of freedom.
How many degrees of freedom does a 2 × 2 table have?
(2 − 1) × (2 − 1) = 1.