Chi-Square Calculator

Test whether observed counts differ from what you expected, or whether two categories are related. Enter counts, not percentages. The p-value is computed exactly, and each step is shown.

one per category
counts or proportions; blank = equal
Significance level (α)
Chi-square statistic
-

Degrees of freedom
-
p-value
-
Critical value
-
Effect size
-

Observed vs expected

Step by step

CellObservedExpected(O − E)² ÷ E

The chi-square formula

χ² = Σ (O − E)² ÷ E goodness of fit: df = k − 1 independence: df = (rows − 1) × (columns − 1), E = row total × column total ÷ grand total

Each cell compares an observed count O with the count E you would expect if the null hypothesis were true. Squaring makes every gap positive, and dividing by E scales it, so a gap of 10 matters more when you expected 20 than when you expected 2,000. The p-value is the chance of a χ² at least this large if the null hypothesis is true. If it is below your significance level, you reject the null hypothesis.

Which test to use

Goodness of fit checks one categorical variable against a claimed distribution: is a die fair, do customers pick the four plans in the proportions the business plan assumed? Test of independence checks two variables measured on the same people: is buying related to which ad someone saw, is smoking related to region? For a 2 × 2 table the calculator also reports Yates' continuity correction, which some textbooks require.

Assumptions

The test needs raw counts of independent observations, each falling into exactly one cell. Expected counts should be at least 5 in most cells (Cochran's rule: no cell below 1 and no more than 20% below 5). With smaller samples use Fisher's exact test instead. A significant result shows an association, not its cause, and with very large samples even trivial differences become significant, which is why the effect size (Cramér's V) is shown as well.

Critical values

dfα = 0.10α = 0.05α = 0.01α = 0.001
12.7063.8416.63510.828
24.6055.9919.21013.816
36.2517.81511.34516.266
47.7799.48813.27718.467
59.23611.07015.08620.515
610.64512.59216.81222.458
712.01714.06718.47524.322
813.36215.50720.09026.124
914.68416.91921.66627.877
1015.98718.30723.20929.588
1218.54921.02626.21732.909
1522.30724.99630.57837.697
2028.41231.41037.56645.315
2534.38237.65244.31452.620
3040.25643.77350.89259.703

Questions people ask

Can I enter percentages?

Not as observed values. The test depends on sample size, so it needs counts. Expected values in goodness of fit can be proportions or percentages; the calculator scales them to the observed total.

What does a p-value of 0.03 mean?

If the null hypothesis were true, a result at least this extreme would happen about 3% of the time. At α = 0.05 you would reject the null hypothesis; at α = 0.01 you would not.

What is a good Cramér's V?

As a rough guide with df = 1: about 0.1 is a small association, 0.3 medium and 0.5 large (Cohen). Thresholds get smaller as the table gets bigger.