Chi-Square Statistic Calculator
Compute the chi-square statistic from observed and expected.
Results update as you type.
How it works
The chi-square statistic measures how far observed data deviate from what a hypothesis predicts, and this calculator computes it for a goodness-of-fit test. You enter the observed frequencies and the expected frequencies as two lists, and it returns the chi-square statistic and the degrees of freedom. For each category, the calculation takes the difference between observed and expected, squares it, divides by the expected value, and sums these across all categories. A larger chi-square value means the observed counts differ more from the expected ones, suggesting the data may not fit the hypothesized distribution, while a value near zero means a close fit. The chi-square goodness-of-fit test is used to check whether observed categorical data match an expected distribution, for example whether a die is fair by comparing observed roll counts to the equal counts expected, or whether observed outcomes match a genetic ratio. The degrees of freedom, the number of categories minus one for a simple goodness-of-fit test, together with the chi-square value, is used to find a p-value from a chi-square distribution table or function, which tells you whether the deviation is statistically significant. This calculator provides the test statistic and degrees of freedom; to complete the test you compare the statistic to a critical value or compute the p-value. Expected frequencies must be positive. Enter your observed and expected frequencies to compute the chi-square statistic.
χ² = Σ (observed − expected)² / expected
The chi-square statistic sums, over each category, the squared difference between the observed and expected frequency divided by the expected frequency. A larger value indicates the observed data deviate more from what was expected. Degrees of freedom for a goodness-of-fit test is the number of categories minus one.
Source:Statistics
We review all our tools from time to time to ensure accuracy.
Worked example
How to use this calculator
- 1
Enter your values
Enter observed frequencies (comma-separated) and expected frequencies (comma-separated).
- 2
Adjust the options
Fine-tune any options to match your situation.
- 3
Read your result
Chi-square statistic (χ²) updates instantly as you type — no button to press.
Frequently asked questions
What is the chi-square statistic?
The chi-square statistic measures how much observed data differ from expected data across categories. It sums the squared difference between observed and expected frequencies, divided by the expected frequency, for each category. A larger value indicates greater deviation from what was expected, forming the basis of the chi-square goodness-of-fit and independence tests.
What is the chi-square goodness-of-fit test used for?
It tests whether observed categorical data match an expected distribution. Examples include checking whether a die is fair by comparing observed roll frequencies to equal expected frequencies, or whether observed genetic outcomes fit a predicted ratio. The test quantifies whether differences between observed and expected counts are larger than would be expected by chance.
What are degrees of freedom here?
For a simple goodness-of-fit test, the degrees of freedom equal the number of categories minus one. Degrees of freedom, together with the chi-square statistic, determine the critical value and p-value from the chi-square distribution. If parameters are estimated from the data, additional degrees of freedom are subtracted, but the basic case subtracts one.
How do I interpret the chi-square value?
Compare the chi-square statistic to a critical value from a chi-square table at your chosen significance level and degrees of freedom, or compute a p-value. If the statistic exceeds the critical value (or the p-value is below your threshold, often 0.05), the deviation is statistically significant, suggesting the data do not fit the expected distribution. This calculator gives the statistic and degrees of freedom.
What are the requirements for the test?
Each expected frequency should generally be reasonably large, commonly at least 5, for the chi-square approximation to be valid, and the data must be counts (frequencies), not percentages or means. Expected frequencies must be positive. The observed and expected lists must have the same number of categories. Meeting these conditions ensures the test statistic is meaningful.
Related calculators
Correlation Coefficient Calculator
Find the Pearson correlation between two datasets.
Standard Deviation Calculator
Calculate the standard deviation, variance, and mean of a data set.
Z-Score Calculator
Calculate the z-score (standard score) to see how many standard deviations a value is from the mean.