StatisticsFree

Chi-Square Calculator

Use this free online chi-square calculator to run a goodness-of-fit test from observed and expected frequencies. Enter up to 4 categories to get the chi-square statistic, degrees of freedom, and p-value with a clear interpretation.

Enter Values

Actual count in category 1

Actual count in category 2

Actual count in category 3

Actual count in category 4

Expected count if null hypothesis is true

Expected count for category 2

Expected count for category 3

Expected count for category 4

Result

Enter values above and click Calculate to see your result.

AI Assistant

Ask about this calculator

I can help you understand the chi-square calculator formula, interpret your results, and answer follow-up questions.

Try asking

Formula

chi-square = sum of (O - E) squared / E

For each category, subtract the expected from the observed, square the difference, divide by expected. Sum across all categories. Larger values mean greater deviation from expected.

Worked Example

Observed: [20, 30, 25, 25], Expected: [25, 25, 25, 25] Step 1: Cat 1: (20-25) squared / 25 = 1.00 Step 2: Cat 2: (30-25) squared / 25 = 1.00 Step 3: Cat 3: (25-25) squared / 25 = 0.00 Step 4: Cat 4: (25-25) squared / 25 = 0.00 Step 5: Chi-square = 2.00, df = 3 Step 6: p-value = approximately 0.572 Result: No significant deviation from expected distribution.

What Is the Chi-Square Goodness-of-Fit Test?

The chi-square goodness-of-fit test determines whether observed frequency data matches an expected distribution. It answers: "Do these observed counts differ from expected by more than random chance?"
  • Common uses: testing die fairness, survey distributions, genetic ratios
  • The test statistic is always non-negative because differences are squared
  • Degrees of freedom = number of categories minus 1 (df = k - 1)
  • Rule of thumb: all expected counts should be at least 5 for the approximation to be reliable
  • The chi-square test is one-tailed (right-tailed) because only large values indicate poor fit

The chi-square test is non-parametric and widely used in genetics, quality control, market research, and social sciences.

You can also calculate changes using our Degrees of Freedom Calculator, Test Statistic Calculator, F-Test Calculator or T-Test Calculator.

Frequently Asked Questions

What does the chi-square test check?

It checks whether observed frequencies differ from expected frequencies by more than random chance. A significant result means the observed distribution does not match the expected one.

Can expected counts be zero?

No. Expected values must be positive because the formula divides by E. The general rule is all expected counts should be at least 5.

What is the difference between goodness-of-fit and independence tests?

Goodness-of-fit tests one variable against an expected distribution. Independence tests whether two categorical variables are related using a contingency table.

How do I test whether a die is fair?

Roll the die many times and record counts for each face. Expected = total rolls / 6 for each face. If p-value is below alpha, the die is likely unfair.

What if expected counts are less than 5?

The chi-square approximation becomes unreliable. Options: combine categories, use Fisher's exact test for 2x2 tables, or use exact multinomial tests.

Can I use chi-square for continuous data?

Not directly. Chi-square requires categorical count data. For continuous data, consider the Kolmogorov-Smirnov or Shapiro-Wilk tests.

Accurate and Reliable

All calculations run locally. Trusted statistical analysis with step-by-step breakdowns.

Precise Statistical Calculations Powered by Calculory AI