Chi-Square Calculator
Run a chi-square goodness-of-fit test from observed and expected counts. Get the statistic, degrees of freedom and p-value.
Comma-separated, e.g. 25, 75.
Same length as observed, e.g. 50, 50.
Chi-square statistic
25
Degrees of freedom
1
p-value
< 0.0001
Statistic = Σ (observed − expected)² ÷ expected, over all categories.
Last updated: August 2026
How this calculator is verified
Checked by True Calculator automated test suite on
- Formula verified against a published worked example in the automated test suite
- Edge cases (zero, negative, boundary and unit-mismatch inputs) covered by unit tests
The full verification method is on our how we verify page. Found an error? Tell us and we will re-check it.
When to Use This Calculator
Use the chi-square calculator whenever you compare observed counts against counts predicted by a theory or a claim — testing whether a die is fair, whether a medicine's responders match an expected rate, whether customer preferences differ from a company's assumption, or whether survey proportions deviate from a known population distribution. Indian biology and commerce students use it for genetics ratio problems and market-research assignments, while quality teams check whether defect counts across shifts follow expected patterns. The goodness-of-fit form in this calculator accepts any number of categories, and the p-value it produces is the same figure journals require when reporting a chi-square test. Because it shows the statistic, degrees of freedom and p-value together, you can verify every step of the calculation for submissions and reports.
How to Use This Calculator
- Step 1: Paste or type the observed counts from your data, comma-separated.
- Step 2: Enter the expected counts under your hypothesis in the same order.
- Step 3: Check that both lists have the same length and every expected count is positive.
- Step 4: Read the chi-square statistic, degrees of freedom (k − 1) and p-value.
Worked Example
A snack manufacturer expects equal sales of two flavours and observes 25 sales of one and 75 of the other across 100 purchases. Enter observed 25, 75 against expected 50, 50: the chi-square statistic is 25 with 1 degree of freedom and a p-value far below 0.05, so the flavour split is definitely not 50-50. The classic biology example — Mendel's pea experiment with observed 315, 101, 108, 32 against expected 312.75, 104.25, 104.25, 34.75 — gives a statistic of about 0.47 with 3 degrees of freedom, a comfortable fit to the 9:3:3:1 ratio.
Tips and Common Mistakes
- •Tip 1: Expected counts below 5 make the test unreliable — merge small categories when possible.
- •Tip 2: Degrees of freedom equal the number of categories minus 1 for a goodness-of-fit test.
- •Tip 3: A small statistic with a large p-value means the observed data matches the expectation — that is a good fit, not a failure.
- ✗Mistake 1: Entering expected counts in a different order than the observed counts, which silently corrupts the result.
- ✗Mistake 2: Using percentages instead of actual counts — the test requires raw frequencies.
Frequently Asked Questions
What is the chi-square test used for?
The chi-square test compares observed counts with expected counts to check whether a pattern fits a theory. Common uses include testing whether a dice or coin is fair, whether survey responses differ from a known distribution, and whether two categorical variables are independent — such as gender and product preference.
How is the statistic calculated?
For each category you compute (observed − expected)² ÷ expected and add up the results. For example, observed counts of 25 and 75 against expected 50 and 50 give a statistic of 25. With 1 degree of freedom the p-value is far below 0.05, so the departure from the expected 50-50 split is highly significant.
How many degrees of freedom do I have?
For a goodness-of-fit test with k categories, degrees of freedom = k − 1. Two categories give 1 degree of freedom, four categories give 3, and so on. The degrees of freedom determine which p-value the statistic maps to, so entering the right count is essential.
What counts as a significant chi-square result?
Compare the p-value with 0.05. A p-value below 0.05 means the observed counts deviate from the expected more than chance alone would usually produce. For example, a statistic of 3.8415 with 1 degree of freedom gives a p-value of exactly 0.05 — the classic critical value found in statistics tables.
Can I use this for a contingency table like a survey breakdown?
Yes — the underlying test is the same. You can paste observed and expected counts, or use the 2×2 (or larger) table layout where expected counts are derived from row and column totals. A classic example: expected counts of 312.75, 104.25, 104.25 and 34.75 against observed 315, 101, 108 and 32 give a statistic of about 0.47, a good fit to Mendel's 9:3:3:1 ratio.
You might also need
Related calculators from other categories
Finance
Annuity Calculator
Build the future value of an annuity with monthly payments, interest and payment timing. Plan guaranteed income.
Health & Fitness
Army Body Fat Calculator
Estimate body fat percentage with the US Army circumference formula using neck and waist measurements. See your category instantly.
Construction
Brick Calculator
Calculate the number of bricks, mortar volume and cost for a wall using Indian standard brick size, in feet and inches.
Finance
Car Depreciation Calculator
Estimate your car's value after depreciation with reducing-balance or straight-line methods. Plan resale value for any price and ownership period.