Chi-Square Distribution Calculator

Compute cumulative probabilities (CDF), probability density (PDF), and critical values (quantiles) for the chi-square distribution. Visualize the distribution curve, find p-values for hypothesis testing, and determine critical thresholds for significance levels.

Positive real number (≥ 0.1)
Non‑negative real number
? df=5, χ²=7.78
? df=10, χ²=18.31
? df=1, χ²=3.84 (α=0.05)
? df=2, χ²=5.99 (α=0.05)
? df=30, χ²=43.77 (α=0.05)
? df=5, critical at α=0.05
Privacy first: All calculations run locally in your browser. No data is sent to any server.

What is the Chi-Square Distribution?

The chi-square (χ²) distribution is a continuous probability distribution that arises frequently in statistical inference. It is defined as the sum of squares of k independent standard normal random variables, where k is the degrees of freedom. The chi-square distribution is the foundation for many hypothesis tests, including the goodness‑of‑fit test, the test of independence in contingency tables, and tests for population variance.

If Z₁, Z₂, …, Zk ∼ N(0, 1) independently, then
X = Z₁² + Z₂² + … + Zk² ∼ χ²(k)

The chi‑square distribution with k degrees of freedom.

Why Use This Interactive Chi‑Square Calculator?

  • Statistical Inference: Quickly obtain p‑values for chi‑square test statistics without consulting printed tables. Perfect for hypothesis testing in research, quality control, and social sciences.
  • Visual Learning: See how the distribution shape changes with degrees of freedom. Observe the critical region and understand the relationship between α, χ², and the p‑value.
  • Educational Resource: Ideal for students learning chi‑square tests, instructors preparing lecture materials, and self‑learners exploring probability distributions.
  • Research & Data Analysis: Compute critical values for confidence intervals and hypothesis tests with arbitrary significance levels and degrees of freedom.
  • Quality Assurance: Use in industrial settings for chi‑square control charts and variance analysis.

Mathematical Definition & Properties

Probability Density Function (PDF)
f(x; k) =   xk/2 − 1 · e−x/2  /  ( 2k/2 · Γ(k/2) )    for x ≥ 0

where Γ(·) is the gamma function, and k > 0 is the degrees of freedom. The PDF is zero for x < 0.

Cumulative Distribution Function (CDF)
F(x; k) = P(X ≤ x) =   γ(k/2, x/2)  /  Γ(k/2)

where γ(·, ·) is the lower incomplete gamma function.

Key Properties
Mean
k
Variance
2k
Mode
max(0, k−2)
Skewness
√(8/k)

As k increases, the chi‑square distribution approaches a normal distribution with mean k and variance 2k (by the Central Limit Theorem).

How to Use This Tool

  1. Select Mode: Choose between calculating a p‑value from a given χ² statistic or finding the critical value for a given significance level α.
  2. Enter Parameters: Input the degrees of freedom (df) and either the χ² value or the significance level.
  3. Choose Tail: Select lower tail (P(X ≤ x)) or upper tail (P(X ≥ x)) — the latter is most common for hypothesis testing.
  4. Click Calculate: The tool instantly computes the CDF, PDF, upper‑tail probability, and (if applicable) the critical value.
  5. Explore the Graph: The interactive canvas shows the distribution curve, marks your χ² value, and highlights the critical region.

Reference Table: Common Critical Values

Critical values χ²α, df for selected degrees of freedom and significance levels (upper tail). These values are frequently used in hypothesis testing.

df α = 0.10 α = 0.05 α = 0.025 α = 0.01 α = 0.001
1 2.706 3.841 5.024 6.635 10.828
2 4.605 5.991 7.378 9.210 13.816
3 6.251 7.815 9.348 11.345 16.266
4 7.779 9.488 11.143 13.277 18.467
5 9.236 11.070 12.833 15.086 20.515
10 15.987 18.307 20.483 23.209 29.588
20 28.412 31.410 34.170 37.566 45.315
30 40.256 43.773 46.979 50.892 59.703
50 63.167 67.505 71.420 76.154 86.661
100 118.498 124.342 129.561 135.807 149.449
Case Study: Goodness‑of‑Fit Test for Mendelian Genetics

A geneticist crosses two heterozygous pea plants (Aa × Aa) and observes 120 offspring with the following phenotypes: 72 dominant (AA or Aa) and 48 recessive (aa). The expected Mendelian ratio is 3:1, so expected counts are 90 and 30. The chi‑square statistic is:

χ² = (72−90)²/90 + (48−30)²/30 = 3.60 + 10.80 = 14.40   with df = 1

Using this calculator with df = 1 and χ² = 14.40, the upper‑tail p‑value is 0.00015. This is far below α = 0.05, so we reject the null hypothesis of a 3:1 ratio. The data strongly deviate from Mendelian expectations—perhaps due to linkage, selection, or misclassification. The interactive graph shows the observed χ² far in the critical region, confirming the statistical significance.

This example illustrates how the chi‑square distribution serves as the backbone of categorical data analysis.

Common Misconceptions

  • "Chi‑square is only for categorical data." While commonly used for contingency tables, the chi‑square distribution also applies to variance tests and likelihood‑ratio tests in many parametric models.
  • "The chi‑square test is always two‑tailed." The chi‑square test is inherently one‑tailed (upper tail) because the statistic is always non‑negative and larger values indicate stronger evidence against the null hypothesis.
  • "Degrees of freedom must be integer." In some contexts (e.g., variance components), df can be non‑integer. Our calculator accepts positive real numbers.
  • "A high p‑value means the null is true." A high p‑value indicates that the data are consistent with the null, but it does not prove the null is true—it only suggests insufficient evidence to reject it.

Applications Across Disciplines

  • Genetics: Testing Mendelian ratios, linkage equilibrium, and Hardy‑Weinberg equilibrium.
  • Epidemiology: Analyzing contingency tables for disease risk factors and exposure‑outcome associations.
  • Quality Control: Chi‑square control charts for monitoring process variability and attribute data.
  • Machine Learning: Feature selection via chi‑square tests for independence between features and target labels.
  • Finance: Testing the fit of asset return distributions and assessing model calibration.
  • Social Sciences: Analyzing survey data, cross‑tabulations, and testing for demographic differences.

Relationship to Other Distributions

The chi‑square distribution is a special case of the gamma distribution with shape parameter k/2 and scale parameter 2. It is also closely related to the F‑distribution (the ratio of two independent chi‑square variables divided by their degrees of freedom) and the t‑distribution (a standard normal divided by the square root of a chi‑square variable divided by its df). These relationships make the chi‑square distribution a cornerstone of classical statistical theory.

Furthermore, the chi‑square distribution is the limiting distribution of many test statistics under the null hypothesis, including the likelihood ratio, score test, and Wald test statistics. This property underpins its widespread use in both frequentist and Bayesian statistics.

Rooted in Statistical Theory – This calculator is built upon the mathematical foundations established by Karl Pearson (1900) who introduced the chi‑square test, and later refined by R.A. Fisher and others. The numerical implementation uses rigorous algorithms for the gamma and incomplete gamma functions, verified against standard tables (e.g., Pearson & Hartley, Biometrika Tables for Statisticians). Reviewed by the GetZenQuery tech team, last updated April 2026.

Frequently Asked Questions

It is used for hypothesis testing involving categorical data (goodness‑of‑fit, independence), testing population variance, likelihood‑ratio tests, and as a building block for the F‑ and t‑distributions. It is one of the most widely used distributions in applied statistics.

The p‑value is the probability of observing a chi‑square statistic as large as or larger than the one you computed, assuming the null hypothesis is true. A small p‑value (typically < 0.05) suggests that the null hypothesis is unlikely and provides evidence for the alternative.

Degrees of freedom (df) represent the number of independent pieces of information available to estimate a parameter. For a chi‑square test, df = (number of categories − 1) for goodness‑of‑fit, and df = (rows − 1) × (columns − 1) for independence tests. The df parameter shapes the distribution.

The calculations use double‑precision floating point with iterative refinement for the incomplete gamma function. Results are accurate to at least 12 decimal places for most inputs, surpassing the precision of printed statistical tables.

Yes. The chi‑square distribution is defined for any positive real df. Non‑integer df occur in some advanced applications, such as variance component estimation and mixed models.

Consult authoritative resources such as Wolfram MathWorld, Khan Academy, or the classic textbook Statistical Inference by Casella & Berger. For applied examples, see Applied Multivariate Statistical Analysis by Johnson & Wichern.
References: MathWorld Chi‑Squared Distribution; Pearson, K. (1900). "On the Criterion that a Given System of Deviations from the Probable in the Case of a Correlated System of Variables is Such that it can be Reasonably Supposed to have Arisen from Random Sampling"; Wikipedia: Chi‑squared distribution.