Chi-Square Calculator

Enter your observed and expected frequencies for up to 5 categories to run a chi-square goodness-of-fit test. The calculator returns the chi-square statistic (χ²), degrees of freedom, and p-value so you can determine whether your observed data differs significantly from what you expected.

The threshold p-value for statistical significance.

Results

Chi-Square Statistic (χ²)

--

Degrees of Freedom

--

p-Value

--

Result

--

Critical Value (χ² crit)

--

Observed vs Expected Frequencies

Results Table

Frequently Asked Questions

What is a chi-square test?

A chi-square test is a statistical test that compares observed count data across categories to expected counts. It tells you whether the difference between what you observed and what you expected could be due to random chance, or whether it reflects a real pattern in your data. It applies only to count (frequency) data, not percentages or continuous measurements.

How do I find the expected frequencies?

Expected frequencies depend on your hypothesis. For a goodness-of-fit test, you might expect equal counts across all categories, counts proportional to a known distribution, or counts based on prior research. Multiply the total sample size by the expected proportion for each category. For example, if you expect a 50/50 split and have 100 subjects, each expected count would be 50.

What does the p-value mean in a chi-square test?

The p-value tells you the probability of observing a chi-square statistic as extreme as yours (or more extreme) if the null hypothesis were true. A p-value below your significance level (e.g., 0.05) suggests the difference between observed and expected counts is statistically significant, meaning it's unlikely due to chance alone.

What are the degrees of freedom in a chi-square test?

For a goodness-of-fit test, degrees of freedom equals the number of categories minus one (k − 1). So with 3 categories, you have 2 degrees of freedom. Degrees of freedom affect the shape of the chi-square distribution and therefore the critical value and p-value for your test.

What are the assumptions of the chi-square test?

The chi-square test assumes that observations are independent, data consists of counts (not proportions or means), each expected frequency is at least 5 (to ensure the approximation is valid), and categories are mutually exclusive. Violating these assumptions — especially having expected counts below 5 — can make results unreliable.

How is the chi-square statistic calculated?

The chi-square statistic is computed as χ² = Σ [(O − E)² / E], where O is the observed count and E is the expected count for each category. You square the difference, divide by the expected count, and sum across all categories. Larger values indicate greater divergence between observed and expected data.

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

A goodness-of-fit test (used here) checks whether a single variable's distribution matches an expected distribution. A test of independence uses a contingency table to check whether two categorical variables are related to each other. Both use the same chi-square formula but differ in how expected values are calculated and in their degrees of freedom.

When should I use a different test instead of chi-square?

Consider alternatives when expected cell counts are below 5 (use Fisher's Exact Test for 2×2 tables), when data is continuous rather than categorical (use t-tests or ANOVA), or when you have paired or repeated-measures categorical data (use McNemar's test). Chi-square is specifically designed for independent count data across discrete categories.

More Math Tools