Statistics

Chi-Square Goodness of Fit Calculator

Compare observed category counts against fully specified expected counts with a Pearson chi-square test.

Data stays on this deviceConvention explained below
Data explorer
Data explorer

Check the dataset and sample convention before interpreting results.

See the method

Add your observations

Runs on your device

Your statistical summary

Your result

Let’s calculate.

Use the Calculate button to see your result.

Review the method below for assumptions and conventions.

How to use this tool

  1. Enter observed counts, expected counts, significance level.
  2. Select Calculate to view the result.
  3. Check the method and assumptions below before using the result.

Input reference and sample values

Use the units and choices shown for each field. Sample values are provided for practice, not as recommendations.

InputFormat and unitsSample
Observed countsKeep the structure and separators shown in the sample. Line breaks are retained in this input.18, 22, 25, 15
Expected countsKeep the structure and separators shown in the sample. Line breaks are retained in this input.20, 20, 20, 20
Significance levelNumeric value. Minimum: 0.0001. Maximum: 0.2.0.05

Result for these sample inputs

0.407301567 probability
Test statistic
2.9
Degrees of freedom
3
Decision at chosen alpha
Do not reject the null hypothesis
Total observations
80
Expected cells below 5
0

The p-value is not the probability that the null hypothesis is true. Choose the hypothesis and significance level before inspecting the result; statistical significance does not measure practical importance.

Select Try the example in the form to load these values and calculate them again. This replaces the current form inputs. Compare the result with the method and worked explanation below.

The method, explained

χ² = sum[(observed−expected)²/expected]. Degrees of freedom = categories−1; no model parameters may be estimated from these observations.

A WORKED EXAMPLE

Using observed counts = 18, 22, 25, 15, expected counts = 20, 20, 20, 20, significance level = 0.05, the result is 0.407301567 probability. Change these example inputs to match your task; use the method above to check each step.

What to keep in mind

Categories are mutually exclusive. Expected counts must be specified independently of the observed data. Sparse categories need a different test or a justified combination. A descriptive or probability calculation under the stated assumptions. Check the sample design and model before interpreting results.

Reference: NIST: statistical methods handbook

Common questions

Should I enter expected percentages or counts?

Enter expected counts that add to the observed total. For example, an expected share of 25% in a sample of 80 corresponds to an expected count of 20.

Can expected counts be fitted from these same observations?

This page assumes a fully specified model and uses categories minus one degrees of freedom. If you estimate model parameters from the observations, this degrees-of-freedom rule is not appropriate.

Methodology maintained by ClarityKit. How these tools are built and checked.