Chi-Square Test Calculator - Goodness of Fit & Test of Independence

AdSense Placeholder
Slot: header_tool

Chi-Square Test Calculator

Goodness of fit and contingency-table tests with exact p-values

Your counts
Leave empty for equal frequencies. Percentages and proportions are rescaled to your total.
Separate values with spaces or tabs; you can paste from a spreadsheet.
--

χ² statistic
--
Degrees of freedom
--
Critical value
--
Total count
--
Cramér's V
--
Yates applied
--
Enter your counts to run the test.

AdSense Placeholder
Slot: tool_mid_article

Two Tests

Check whether counts match an expected distribution, or whether two categorical variables in a table are related.

Paste from a Spreadsheet

Copy a block of cells and paste it straight into the table box; tabs and spaces both work.

Assumption Check

Expected counts below 5 are flagged, because the chi-square approximation becomes unreliable there.

Private

Your data stays in your browser.

How the Chi-Square Test Works

Both tests compare observed counts O with the counts E you would expect if the null hypothesis were true, adding up (O − E)2/E over every category or cell. In a goodness-of-fit test, E comes from the distribution you specify (equal by default) and there are k − 1 degrees of freedom. In a test of independence, E for each cell is (row total × column total) / grand total and the degrees of freedom are (rows − 1)(columns − 1).

Example: a die rolled 120 times gives 22, 17, 21, 12, 14 and 34. With 20 expected per face, χ2 = 15.5 with 5 degrees of freedom and p ≈ 0.0084, so the die looks unfair at the 5% level. Use raw counts, never percentages or means, in the observed boxes. Cramér's V, from 0 to 1, shows how strong an association is, which a small p-value alone does not.

Key Takeaways

  • Counts only: The observed values must be frequencies, not percentages.
  • Expected at least 5: Small expected counts are flagged; merge categories if needed.
  • Effect size: Cramér's V shows how strong an association is.
AdSense Placeholder
Slot: footer_leaderboard