Chi-Square Calculator: Independence Test

This chi-square calculator runs the two most common chi-square tests. For a test of independence, type your contingency table with commas between columns and semicolons between rows, such as 20, 30; 30, 20. For a goodness-of-fit test, type the observed counts and, if you like, the expected counts or percentages; leave expected blank to test against equal counts. You get the chi-square statistic ฯ‡², the degrees of freedom, the p-value, the critical value at your significance level, a plain-English decision and a table of expected counts with each cell's contribution.

Chi-Square Calculator

Run a chi-square test of independence on a contingency table or a goodness-of-fit test on counts.

Everything runs in your browser. Nothing you type is sent to a server.

How to use the Chi-Square Calculator

  1. Choose test of independence or goodness of fit.
  2. Type the table or the observed counts.
  3. Pick the significance level ฮฑ.
  4. Read ฯ‡², df, the p-value and the decision.

Chi-square formula

ฯ‡² = ฮฃ (O − E)² ÷ E · Expected (table) = row total × column total ÷ N · df = (r − 1)(c − 1) or k − 1

Features

  • Test of independence (any r × c table)
  • Goodness of fit vs equal or given expected counts
  • p-value and critical value
  • Expected counts and cell contributions
  • Warns when expected counts are below 5

Frequently asked questions

What is a chi-square test?

A chi-square test compares observed counts with the counts you would expect if there were no effect. A large ฯ‡² means the observed counts are far from expected.

How do I calculate expected counts?

For a contingency table, expected = row total × column total ÷ grand total. For goodness of fit, expected = total × the expected proportion of each category.

How many degrees of freedom does a chi-square test have?

For independence, df = (rows − 1) × (columns − 1). For goodness of fit, df = number of categories − 1.

What does the p-value mean?

It is the chance of a ฯ‡² this large or larger if the null hypothesis is true. If p is below ฮฑ, such as 0.05, you reject the null hypothesis.

When should I not use a chi-square test?

When many expected counts are below 5 the test is unreliable. Combine categories or use Fisher's exact test for small 2 × 2 tables.