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.
Chi-Square Calculator on True Calculator gives you an instant, accurate answer with no sign-up and no app install. Run a chi-square goodness-of-fit test from observed and expected counts. Get the statistic, degrees of freedom and p-value. Every result shows the formula and a worked example so you can verify the calculation yourself, and all values are computed in your own browser — your numbers never leave your device.
Popular uses: chi square calculator · chi square test calculator · chi square p value
Reviewed by the True Calculator team · Last updated: August 2026
How We Calculate
This calculator uses standard statistical formulas as defined in textbooks and statistical software. All calculations are performed instantly in your browser using JavaScript — no data is sent to any server.
Formulas follow the conventions used in academic statistics, including population and sample variants where they differ.
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
Construction
BTU Calculator
Calculate the BTU and AC tonnage required for a room based on size, sun exposure and insulation.
Construction
Concrete Calculator
Calculate concrete volume, weight and number of cement bags for a slab. Get exact quantities for your construction project.
Construction
Gravel Calculator
Estimate gravel volume, weight in tonnes and 50 kg bags for driveways and paths by material density.
Construction
Mulch Calculator
Work out mulch volume in m³ and litres, plus bags needed and cost for your garden beds.