How to Use the Chi-Square Calculator

Compute chi-square p-values, critical values, and quantiles from the χ² distribution, generate a critical-value table, and interpret the result with the correct degrees of freedom.

  1. 1. Pick the mode that matches your input: P-value from χ² if you have a chi-square statistic and df. Critical value if you have df and α. χ² from p-value if you have a tail probability and df. Chi-square distribution for a combined p-value, critical value, and density chart in one view. Chi-square table if you want a reference list of critical values across df. Σ (O − E)²/E if you already have observed and expected count pairs.
  2. 2. Enter the degrees of freedom: df comes from the design of your test, not from the data. Use k − 1 for goodness of fit with k categories and no estimated parameters, (r − 1)(c − 1) for independence in an r × c table, or the df from your statistical package. Enter it as a whole number.
  3. 3. Enter the χ², α, or p-value: Depending on the mode, enter the chi-square statistic, the significance level α, or the upper-tail probability. The α presets are 0.10, 0.05, and 0.01; the custom option accepts any value between 0 and 1 exclusive.
  4. 4. Read the result and the distribution chart: The results panel shows the p-value, critical value, significance decision, and the density, CDF, and survival values at your input. The chart plots the density for your df, marks the critical value with a dashed line, and shades the rejection region beyond it.
  5. 5. Apply the decision rule: Both rules give the same answer. P-value rule: reject H₀ if p < α. Critical-value rule: reject H₀ if χ² > χ²crit. The calculator shows both so you can use whichever matches your field's convention.
  6. 6. Generate the table or O/E contributions if needed: In table mode, set the maximum df and the calculator produces a critical-value table at α = 0.10, 0.05, 0.01, and your chosen α. In formula mode, enter each (O, E) pair and the calculator sums the contributions to produce the chi-square statistic. Both modes use the same distribution engine as the single-value calculations.

What this calculator does

Every chi-square test in statistics — goodness of fit, independence, homogeneity — reduces to the same distribution math: given a chi-square statistic and degrees of freedom, what does the chi-square distribution say? This calculator answers that question in every direction. Enter χ² and df to get an upper-tail p-value. Enter df and α to get a critical value. Enter a p-value and df to get the χ² that produces that tail area. It also draws the density, generates a critical-value table, and sums (O − E)² / E contributions if you already have observed and expected counts.

Chi-square formula and distribution

The Pearson chi-square statistic is χ² = Σ (O − E)² / E, where O is the observed count in a cell and E is the expected count under the null hypothesis. Each term (O − E)² / E is a contribution, and the statistic is their sum. Every chi-square test uses this same formula applied to a different arrangement of cells. What changes across tests is the degrees of freedom, not the statistic itself.

Under H₀, χ² approximately follows the chi-square distribution with df degrees of freedom. Its density is f(x; k) = x^(k/2 − 1) e^(−x/2) / [2^(k/2) Γ(k/2)] for x ≥ 0. The mean equals k and the variance equals 2k. At low df the shape is strongly right-skewed, with most mass near zero and a long right tail. As k grows the distribution becomes more symmetric and eventually approaches a normal shape.

The upper-tail p-value is the area under the density to the right of the observed statistic. The critical value χ²crit is the cutoff on the statistic such that the area beyond it equals α. Both come from the same distribution — they are two descriptions of the same threshold.

Degrees of freedom in practice

df is not derivable from the statistic. It comes from the study design. Common cases:

  • Goodness of fit with k categories and no estimated parameters — df = k − 1.
  • Goodness of fit with m parameters estimated from the data — df = k − 1 − m.
  • Test of independence in an r × c contingency table — df = (r − 1)(c − 1).
  • Test of homogeneity across groups — df = (r − 1)(c − 1).
  • McNemar's test, standard 2 × 2 case — df = 1.

Enter df as a whole number. This calculator does not infer it from raw data, because df depends on the design, not on the numbers. If you need to derive df automatically from a contingency table, use a dedicated test calculator.

Worked example

Suppose χ² = 12.4 with df = 4 and α = 0.05.

  • Upper-tail p-value: P(X² ≥ 12.4) with df = 4 ≈ 0.0146.
  • Critical value: χ²crit at α = 0.05, df = 4 ≈ 9.49.
  • Decision: since χ² = 12.4 > 9.49 and p = 0.0146 < 0.05, both the critical-value rule and the p-value rule reject H₀.

What that rejection means substantively depends entirely on the original test. The calculator gives the distribution-level result; whether the result is meaningful for your research question is a separate judgement that only the study design can answer.

Tips and limits

  • Always report df alongside χ². A chi-square value alone is not interpretable — χ² = 10 is highly significant at df = 2 and not significant at df = 10.
  • Check the expected counts before trusting the approximation. A common rule of thumb is at least 5 in every expected cell. Small expected counts make the chi-square approximation unreliable.
  • Do not treat p > α as proof of the null. Failing to reject H₀ is not the same as confirming it. The sample may simply be too small to detect a departure.
  • Independence is assumed. Repeated measures, paired data, or clustered sampling violate the assumption and call for different methods like McNemar's test or mixed models.
  • This page handles the distribution math only. It does not build contingency tables, compute expected counts, or choose the correct test for your design. Those steps belong to a dedicated test calculator. Fisher's exact test and McNemar's test are also separate methods with their own distributions.

Frequently Asked Questions

Q: What is the difference between this calculator and a full chi-square test calculator?

This is the distribution-level tool. It takes χ² and df and returns a p-value or critical value. A full test calculator takes raw data, builds expected counts, derives df from the design, runs the test, and reports the complete result. Use this one when you already have χ² and df, or when you need a critical value or a distribution chart.

Q: Why does the calculator ask for df separately from the statistic?

Because df comes from the study design, not from the data. The same chi-square value of 12.4 means different things at df = 2, df = 4, and df = 10. The calculator asks explicitly so the result reflects the actual test, not an assumption about the design.

Q: What is the chi-square formula?

The Pearson chi-square statistic is χ² = Σ (O − E)² / E, where O is observed and E is expected under the null hypothesis. Every chi-square test uses this same formula. What changes across tests is the degrees of freedom, which depends on the arrangement of cells in the design.

Q: How do I calculate a chi-square p-value?

Under the null hypothesis, the statistic follows the chi-square distribution with df degrees of freedom. The p-value is the upper-tail probability p = P(X² ≥ χ²). Enter your statistic and df in the P-value from χ² mode and the calculator returns it, along with the critical value for comparison.

Q: What does the critical value mean?

The critical value χ²crit satisfies P(X² ≥ χ²crit) = α, where α is your significance level. Reject the null if your observed statistic exceeds it. The critical value depends only on df and α, which is why a chi-square table lists it by df for a handful of common α levels.

Q: Can I use this for a goodness-of-fit test or a test of independence?

You can use it for the distribution-level calculation once you have χ² and df from that test. But the workflow — building the categories or contingency table, computing expected counts, deriving df from the design — belongs to a dedicated goodness-of-fit or independence calculator. This page handles only the shared distribution math.

Q: What about Fisher's exact test or McNemar's test?

Those are separate methods with their own distributions. Fisher's exact test is used when expected counts are too small for the chi-square approximation. McNemar's test is used for paired binary data. Neither is computed on this page.

Q: How large do expected counts need to be for the chi-square approximation?

A common rule of thumb is at least 5 in every expected cell, though the exact threshold depends on the number of cells and the specific test. When expected counts are small, the approximation can be unreliable and an exact test like Fisher's is usually preferable. This calculator does not check expected counts for you — that judgement belongs to the test workflow.

Q: Does the calculator work in both directions?

Yes. P-value from χ² takes χ² and df and returns the upper-tail probability. χ² from p-value takes a probability and df and returns the χ² with that tail area. Both directions use the same distribution engine, so they are exact inverses of each other.

Loaded shared calculation