Chi-Square Calculator
Calculate the chi-square statistic for observed and expected frequencies.
Formula and sources updated · Data sources · 1View algorithm, constants and default inputs (JSON)
About this calculator
Compare two equally sized lists of observed and expected counts. Expected counts must be positive and must add up to the observed total. This calculator returns the chi-square statistic and degrees of freedom, not a p-value or a conclusion about significance.
Worked example
calculated with the default values below
Observed values (comma separated) 30, 20, 25, 25 · Expected values (comma separated) 25, 25, 25, 25 Chi-square statistic 2.0000 · Degrees of freedom 3 · Total observed 100 · Total expected 100 · Largest single contribution 1.0000
Method and assumptions
χ² = Σ (O_i − E_i)² ÷ E_i, df = k − 1 Expected counts must be positive and sum to the observed total. For a goodness-of-fit test with fixed expected proportions, df = k − 1. Small expected counts may make the approximation unreliable. Compare two equally sized lists of observed and expected counts. Expected counts must be positive and must add up to the observed total. This calculator returns the chi-square statistic and degrees of freedom, not a p-value or a conclusion about significance. The references explain definitions and methods; any extra preset must be checked against the assumptions on this page.
Data sources
The references explain definitions and methods; any extra preset must be checked against the assumptions on this page.
Disclaimer
These calculators give general mathematical results. They suit study, planning and estimation — verify anything that feeds a graded submission, a published figure or a financial commitment.
Implementation source
This record describes the implementation used by this page. It is not independent validation. External references, when available, support only the stated formula or definition; estimates and custom rules retain their own assumptions.
Formula and variables
χ² = Σ (O_i − E_i)² ÷ E_i, df = k − 1
- χ²
- Chi-square statistic
- O_i
- Observed count
- E_i
- Expected count
- n
- Number of categories
- df
- Degrees of freedom
Expected counts must be positive and sum to the observed total. For a goodness-of-fit test with fixed expected proportions, df = k − 1. Small expected counts may make the approximation unreliable.
Frequently asked questions
Why does the chi-square statistic square the gap between observed and expected counts?
Squaring (observed − expected) makes every deviation positive and gives larger gaps more weight. For a goodness-of-fit test with fixed expected proportions, degrees of freedom are categories minus one. This calculator reports the statistic and degrees of freedom, but not a p-value. Small expected counts can make the chi-square approximation unreliable; use an appropriate exact method. Fisher’s exact test is for 2×2 contingency tables, not a general replacement for every goodness-of-fit test.
What makes an observed-versus-expected comparison valid?
Use the same number of categories in both lists, with at least two categories. Every expected count must be positive, and the expected counts must add up to the observed total. This calculator rejects inputs that do not meet those conditions.
Which inputs and limits apply to Chi-Square Calculator?
Use the units shown beside each field. These are form limits, not recommended settings. χ² = Σ (O_i − E_i)² ÷ E_i, df = k − 1 Expected counts must be positive and sum to the observed total. For a goodness-of-fit test with fixed expected proportions, df = k − 1. Small expected counts may make the approximation unreliable. Compare two equally sized lists of observed and expected counts. Expected counts must be positive and must add up to the observed total. This calculator returns the chi-square statistic and degrees of freedom, not a p-value or a conclusion about significance. The references explain definitions and methods; any extra preset must be checked against the assumptions on this page.
What is a complete worked example for Observed values (comma separated) = 30, 20, 25, 25; Expected values (comma separated) = 25, 25, 25, 25?
Inputs: Observed values (comma separated) = 30, 20, 25, 25; Expected values (comma separated) = 25, 25, 25, 25. Calculation: χ² = Σ (O_i − E_i)² ÷ E_i, df = k − 1. Results: Chi-square statistic = 2.0000; Degrees of freedom = 3; Total observed = 100; Total expected = 100; Largest single contribution = 1.0000.