HomeCalculatorsStatisticsChi-Square Test Calculator

Chi-Square Test Calculator

Statistics

Run a chi-square goodness-of-fit test in seconds. Enter up to six rows of observed vs expected frequencies to get the chi-square statistic, degrees of freedom, and verdict.

Observed vs Expected Frequencies
ObservedExpected#1#2#3#4

Add up to 6 categories. At least 2 rows are required.

Chi-Square Statistic (χ²)

0

Degrees of Freedom

0

Critical (α=0.05)

0

Not Statistically Significant

No significant difference from the expected frequencies (fail to reject the null hypothesis).

What is a Chi-Square Test?

The Chi-Square Test Calculator runs a chi-square goodness-of-fit test on your observed versus expected frequency data across up to six categories. It computes the chi-square statistic, degrees of freedom, critical value, and a plain-language verdict on whether your observed data significantly differs from what was expected.

The chi-square goodness-of-fit test is the standard statistical tool for comparing category counts (not numeric averages) against a theoretical or historical expectation. Whether you're checking if a die is fair, if survey responses match a known population distribution, or if defect counts differ meaningfully across production lines, this test quantifies exactly how much the observed pattern deviates from the expected one.

For comparing numeric averages between two groups instead of category counts, use the T-Test Calculator.

How to use this Chi-Square Test calculator

  1. Enter your observed frequencies — the actual counts you recorded for each category.

  2. Enter your expected frequencies — the counts predicted by your theory, model, or historical baseline for the same categories.

  3. Add or remove categories as needed — the calculator supports 2 to 6 rows of observed/expected pairs.

  4. Read the chi-square statistic and critical value — compare them directly, or rely on the automatic significance verdict shown below the result.

  5. Check the step-by-step breakdown — see exactly how each category's (O−E)²/E contribution combined into the final statistic.

  6. Interpret the verdict in context — a significant result tells you the observed pattern differs from expected, but doesn't by itself explain why — investigate the categories with the largest individual contributions to understand the source of the deviation.

Formula & Methodology

Chi-square statistic:
χ² = Σ [(Observed − Expected)² / Expected]

Degrees of freedom:
df = number of categories − 1

Variable definitions:
- Observed — the actual recorded frequency for a category
- Expected — the predicted or theoretical frequency for that category
- Σ — sum across all categories

Worked example:

Testing whether customer complaints are evenly distributed across 4 product lines, with 66 total complaints expected evenly (16.5 each) but observed as: 18, 22, 11, 9.

Category 1: (18−15)²/15 (adjusting expected proportionally) — using expected = 15 for each category for this example:
(18−15)²/15 = 0.6
(22−15)²/15 = 3.267
(11−15)²/15 = 1.067
(9−15)²/15 = 2.4

Step 1 — Sum: χ² = 0.6 + 3.267 + 1.067 + 2.4 = 7.33

Step 2 — Degrees of freedom: 4 categories − 1 = 3

Step 3 — Critical value at α = 0.05, df = 3: 7.815

Step 4 — Verdict: χ² = 7.33 does not exceed 7.815 → not statistically significant at the 5% level (though it is close, suggesting a larger sample might reveal a real pattern).

Assumption: The chi-square approximation is most accurate when each expected frequency is at least 5. Categories with very small expected counts can make the test unreliable and may need to be combined with adjacent categories before testing.

Frequently Asked Questions

A chi-square goodness-of-fit test checks whether observed frequency data (actual counts in different categories) matches an expected frequency distribution (what you'd predict from a theory, model, or historical pattern). For example, you might test whether the actual distribution of customer orders across five days of the week matches an expected even distribution, or matches last year's proportions.
For each category, subtract the expected value from the observed value, square the result, and divide by the expected value. Sum this quantity across all categories to get the chi-square statistic: χ² = Σ[(O − E)² / E]. For example, if a category has observed = 18 and expected = 15, that term contributes (18−15)²/15 = 9/15 = 0.6 to the total.
For a goodness-of-fit test, degrees of freedom equal the number of categories minus 1 (df = k − 1). For example, comparing observed vs expected frequencies across 4 categories gives df = 3. Degrees of freedom determine which row of the chi-square distribution table (or critical value) applies when judging significance.
Compare your calculated chi-square statistic against the critical value for your degrees of freedom at your chosen significance level (commonly α = 0.05). If your statistic exceeds the critical value, the difference between observed and expected frequencies is statistically significant — you reject the null hypothesis that the data follows the expected distribution. If it doesn't exceed the critical value, you fail to reject the null hypothesis.
A high chi-square statistic means the observed frequencies differ substantially from what was expected — the categories with the largest (O−E)²/E contributions are driving the biggest gaps. In quality control, a high chi-square when testing defect counts across production lines would signal that at least one line is producing meaningfully more or fewer defects than the expected baseline, warranting investigation.
A common rule of thumb is that each expected frequency should be at least 5 for the chi-square approximation to be reliable. If some categories have expected frequencies below 5, the test's p-value can become inaccurate, and combining smaller categories together (or using an exact test alternative) is recommended instead.
A goodness-of-fit test (what this calculator performs) compares a single set of observed frequencies against a single set of expected frequencies across categories of one variable. A test of independence instead uses a two-way contingency table to check whether two categorical variables are related to each other (e.g., whether product preference is related to age group) — a different calculation involving row and column totals.
This calculator supports 2 to 6 categories (rows of observed vs expected data). For goodness-of-fit tests with more categories, the same formula applies — you would simply need a tool or table that supports more rows, since the underlying chi-square calculation scales to any number of categories.
The interpretation of the chi-square result stays the same regardless of where the expected frequencies came from, but the conclusion you draw differs: testing against a theoretical model (like an even 50/50 split) tells you whether your data deviates from that theory, while testing against historical data tells you whether the current period differs from a known past pattern. Always state clearly which type of expectation you tested against when reporting results.
Chi-square tests are the standard tool for analyzing categorical (non-numeric) data — counts and proportions across distinct groups — as opposed to t-tests, which compare continuous numeric means. If your data involves numeric averages instead of category counts, use the [T-Test Calculator](/t-test-calculator/) instead, which is designed for comparing means rather than frequency distributions.
The chi-square statistic is a sum across all categories, so adding more categories (each contributing its own (O−E)²/E term) tends to increase the total even if each individual deviation is modest — which is exactly why the critical value also increases with degrees of freedom (number of categories minus 1), keeping the significance threshold appropriately calibrated for the added complexity.
Common applications include testing whether dice or card game outcomes are fair (uniform expected distribution), whether a survey's demographic breakdown matches a known census distribution, whether genetic inheritance ratios in a biology experiment match predicted Mendelian ratios, and whether a website's traffic sources match expected proportions from historical patterns.
Also known as
chi square testgoodness of fit test calculatorchi-square statistic calculatorobserved vs expected calculatorchi square distribution calculator