Skip to content
CalculatorAtlas

Chi-Square Statistic Calculator

Tested

Goodness-of-fit chi-square from observed and expected counts.

Tested, not yet published. The formula for this calculator is implemented and passes its automated checks. This page stays non-indexable until it is reviewed and published.

Results

Enter your values and press Calculate. Results appear here.

  • • Result

Quick answer

The chi-square statistic is χ² = Σ (O − E)² ÷ E with df = k − 1. Observed counts 20, 30, 50 against expected 25, 25, 50 give χ² = 2, 2 degrees of freedom and p = 0.3679.

Enter observed and expected counts. The calculator returns χ², the degrees of freedom and the p-value.

Related tools: T Statistic Calculator: t statistic from summary statistics. P-Value Calculator: P-value from a z, t, chi-square or F statistic. Critical Value Calculator: Critical values for z, t, chi-square and F distributions.

How to use the Chi-Square Statistic Calculator

  1. Type observed counts, for example 20, 30, 50.
  2. Type expected counts, for example 25, 25, 50.
  3. Press Calculate to see the result, and use Reset to start again.
Inputs of the Chi-Square Statistic Calculator
InputWhat to enterAllowed values
Observed countsText, such as 20, 30, 50—
Expected countsText, such as 25, 25, 50—

Formula and method

Formula

χ² = Σ (O − E)² ÷ E, df = k − 1

IEEE-754 double precision; shown to at most 6 decimal places.

Expected counts must be positive; the p-value is the right tail.

Worked examples

This example is verified: each one is an automated test case that the live calculator must reproduce exactly.

Example 1

Inputs: Observed counts = 20,30,50; Expected counts = 25,25,50.

Results of example 1
ResultValue
Chi-square2
Degrees of freedom2
p-value0.367879

The first line is the headline result (chi-square). Below it the chi-Square Statistic Calculator lists degrees of freedom and p-value, which describe the same case from other angles. IEEE-754 double precision; shown to at most 6 decimal places.

Worked example

(20 − 25)²/25 = 1, (30 − 25)²/25 = 1 and (50 − 50)²/50 = 0, so χ² = 2. With p = 0.37, the data are consistent with the expected counts.

Conditions

Each expected count should be at least 5 for the approximation to hold. The lists must have equal length and expected values must be above zero. It tests goodness of fit; independence in tables needs expected counts computed from totals.

What happens with invalid input

These messages are produced by the calculator itself, so you know what to fix.

  • Expected counts: entering "1" shows "Enter at least 2 numbers." beside that field and no result.

Choosing between the Chi-Square Statistic Calculator and similar calculators

Each row shows what a related calculator on this site asks for and what it returns, so you can pick the one that matches your question.

Choosing between the Chi-Square Statistic Calculator and similar calculators
CalculatorYou enterIt returns
[T Statistic Calculator](/statistics/t-statistic/)sample mean, hypothesised mean and sample standard deviationt statistic
[P-Value Calculator](/statistics/p-value/)test statistic, statistic value and test typep-value
[Critical Value Calculator](/statistics/critical-value/)distribution, significance level and tailsCritical value
[Degrees of Freedom Calculator](/statistics/degrees-of-freedom/)test and n₁Degrees of freedom
[One-Sample T-Test Calculator](/statistics/t-test-calculator/)sample mean, hypothesised mean and sample standard deviationt statistic

Background: hypothesis testing and inference

A hypothesis test compares a test statistic with what the null hypothesis predicts. The decision rule is to reject the null hypothesis when the p-value is at or below the significance level α, which you should choose before seeing the data (0.05 is conventional, not special). For a two-tailed z test the p-value is 2 × (1 − Φ(|z|)); for a one-sample t test the statistic is (x̄ − μ₀) ÷ (s ÷ √n) with n − 1 degrees of freedom.

Failing to reject the null hypothesis does not prove it true, and a statistically significant result can still be too small to matter in practice.

Assumptions and limitations

  • Equal-length lists
  • Expected > 0

If a required value is empty, not a number, or outside its allowed range, the form marks that field with a message and shows no result instead of a misleading number. The automated checks deliberately try invalid entries for expected counts to confirm this.

Frequently asked questions

What does a small p-value mean?

The data differ from what was expected.

What is df here?

Categories minus one.

Can I use proportions?

Use counts, not proportions: the statistic Σ(O − E)²/E depends on the sample size, which proportions would remove.

What does the Chi-Square Statistic Calculator calculate?

Goodness-of-fit chi-square from observed and expected counts. It returns Chi-square, Degrees of freedom and p-value.

What formula does the Chi-Square Statistic Calculator use?

χ² = Σ (O − E)² ÷ E, df = k − 1. Expected counts must be positive; the p-value is the right tail.

What do I need to enter in the chi-Square Statistic Calculator?

You enter Observed counts and Expected counts.

How is the result rounded or limited?

IEEE-754 double precision; shown to at most 6 decimal places. Equal-length lists.

What are the limits of this calculator?

Equal-length lists. Expected > 0.

What is an example of a chi-Square Statistic result?

With observed counts 20,30,50 and expected counts 25,25,50, the chi-square is 2.

Sources

  • NIST/SEMATECH e-Handbook of Statistical Methods (itl.nist.gov/div898/handbook)
  • Standard textbook definitions (e.g. Moore, McCabe & Craig, Introduction to the Practice of Statistics)

Content last reviewed 2026-11-04. Formulas and worked examples are checked by automated tests against independently computed values.