The chi-square calculator computes χ² statistic, degrees of freedom, and p-value for goodness-of-fit tests. Enter observed and expected frequencies to test whether your data fits a hypothesized distribution.
Chi-Square Goodness-of-Fit Test (χ²)
How to Use the Chi-Square Calculator
The chi-square goodness-of-fit test determines whether observed frequencies match expected frequencies from a theoretical distribution.
Example: Fair Die Test
Roll a die 120 times. Expected frequency for each of 6 faces = 20. If you observe [25, 18, 22, 19, 23, 13]: χ² = Σ(O−E)²/E = 25/20+4/20+4/20+1/20+9/20+49/20 = (25+4+4+1+9+49)/20 = 92/20 = 4.6. df = 6−1 = 5. p ≈ 0.47. Fail to reject: die appears fair.
Interpreting p-value
p < 0.05: reject the null hypothesis — your data doesn't fit the expected distribution. p ≥ 0.05: fail to reject null — observed data is consistent with expected distribution (but doesn't prove it's exactly correct).
Expected Frequencies Rule
Each expected frequency should be ≥ 5 for valid chi-square results. With very small expected values, combine categories or use Fisher's exact test instead.
Frequently Asked Questions
What is the chi-square test?
The chi-square test measures whether observed frequencies differ significantly from expected frequencies. χ² = Σ(O − E)² / E. A large χ² means the observed data is unlikely under the null hypothesis. Used for: goodness-of-fit (does data match a distribution?) and independence (are two categorical variables related?).
What is a p-value in chi-square?
The p-value is the probability of getting a χ² statistic this extreme or more extreme if the null hypothesis is true. p < 0.05: reject null (significant result). p < 0.01: strongly significant. p > 0.05: fail to reject null (no significant evidence). Always report the actual p-value, not just significant/not.
Is this calculator free?
Yes, completely free with no signup required. All calculations run in your browser.
Is my data private?
Yes. All calculations run locally. Nothing is transmitted.
What are degrees of freedom in chi-square?
For goodness-of-fit: df = number of categories − 1. For independence test: df = (rows − 1) × (columns − 1). Degrees of freedom determine which chi-square distribution to use for the p-value. A 2×2 contingency table has df = (2-1)×(2-1) = 1.