1. Home
  2. Calculators
  3. Chi-Square Calculator

Chi-Square Calculator

For categorical data: test whether counts match an expected pattern or whether two variables are related.

Free, no sign-up. Runs in your browser: nothing is uploaded.

Free workspace included. Docs, spreadsheets, notes and tasks that save on your device. No sign-up.Take a look

How to use Chi-Square Calculator

  1. Enter your numbers, or press a sample to see an example.
  2. Read the results and the table under them.
  3. Copy the results or download the table as a CSV file.

Features

  • Goodness of fit with equal, proportional or custom expected values
  • Independence tests for r × c tables
  • Yates correction and Fisher exact test for 2 × 2
  • Expected counts, cell contributions and Cramér’s V
  • Warnings when expected counts are below 5

Supported formats

Input

  • Counts typed as rows
  • Expected values or proportions

You get

  • On-screen results
  • Chi-square curve (SVG and PNG)
  • CSV tables

Private by design

Everything you enter is processed by your browser on this device. Nothing is sent to openWorkstand or anyone else, so the Chi-Square Calculator is safe for private and work data. After you have used it once while online, it also works without an internet connection. How local processing works

Good to know

  • Counts must be real frequencies, not percentages, and observations must be independent.
  • The chi-square approximation is poor when expected counts are below 5.

Guide

Chi-square tests: goodness of fit, independence and Fisher’s exact test

Many questions are about counts in categories: is this die fair, do men and women answer a question differently, do offspring appear in the ratio a theory predicts? The chi-square test compares the counts you observed with the counts you would expect if a simple hypothesis were true, and turns the gap into a p-value. This calculator runs the two standard versions, adds the exact test for small 2 × 2 tables and draws the distribution with your result marked.

The statistic

For each category the tool takes the observed count O and the expected count E and adds up (O − E)² / E. A large total means the data are far from what the hypothesis predicts. The p-value is the probability, if the hypothesis were true, of a total at least that large, taken from the chi-square distribution with the right degrees of freedom. It is compared with your significance level α, and the tool reports the critical value at that level.

Goodness of fit

Choose Goodness of fit and enter one row of counts. Expected counts can be All categories equally likely, Given proportions or percentages, or Given expected counts, which must add to the same total. Degrees of freedom are the number of categories minus 1, minus any parameters estimated from the data, which you can set. Observed counts of 5, 8, 9, 8, 10 and 20 for a die give χ² = 13.4, df = 5 and p = 0.0199, so a fair die is rejected at 5%. Most of the gap comes from the 20 sixes, which contribute 10 of the 13.4.

Test of independence

Choose Independence in a table and enter the counts with one row per line. Expected counts are the row total times the column total divided by the grand total. For [[10, 20], [30, 40]] these are 12, 18, 28 and 42, and the result is χ² = 0.79365079, df = 1, p = 0.3730, Cramér’s V 0.089 and a phi coefficient of 0.089: no evidence of a link. A 3 × 3 table of 30 20 10, 20 25 15, 10 15 35 gives χ² = 30, df = 4, p below 0.0001 and V = 0.289.

2 × 2 tables, Yates and Fisher

A 2 × 2 table gets extra rows: the Fisher exact test p-value and the odds ratio. For the default table Fisher’s p is 0.5045 and the odds ratio 0.667. The Yates continuity correction can be switched on for 2 × 2 tables; it reduces χ² to 0.4464286 for the default and is conservative. Use Fisher whenever an expected count is below 5, as in [[3, 1], [1, 3]], where Fisher gives p = 0.4857 while the plain χ² gives 0.1573.

Effect size and contributions

A p-value says whether a pattern is unlikely to be chance, not how strong it is. Cramér’s V, from 0 to 1, measures strength: 0.089 is a tiny association and 0.289 a modest one. Tables show the expected counts and each cell’s contribution to χ², so you can see where the difference lies: in the die example the sixes contribute 10 and the ones 2.5. Contributions of the 3 × 3 table are 5, 0, 5, 0, 1.25, 1.25, 5, 1.25 and 11.25.

Worked examples

Mendel’s peas: counts 315, 101, 108 and 32 against expected proportions 9, 3, 3 and 1 have expected counts 312.75, 104.25, 104.25 and 34.75, so χ² = 0.47002398, df = 3, p = 0.9254: an excellent fit. The critical value at 5% is 7.81473. A fair die, a gene ratio and a survey cross-tabulation are the three typical uses, and each is a sample chip on the page.

Limits

Counts must be actual frequencies from independent observations, not percentages, and each person or item should appear once. The chi-square approximation is unreliable when many expected counts are below 5. A significant result does not show cause, and a non-significant one does not prove the null hypothesis, it only fails to reject it. Tables with a row or column of zeros are rejected because their expected counts are zero.

Checked against the current version of the Chi-Square Calculator on .

Frequently asked questions

What does it mean that Mendel’s result had a p-value of 0.9254?

It means the observed counts are very close to the 9:3:3:1 prediction: if the ratio were exactly right, results at least this far from it would occur about 92.5% of the time. A p-value near 1 shows a good fit, not an error. The statistician R. A. Fisher noted in 1936 that Mendel’s results across all his experiments fit unusually well, which is a separate question from this one test.

Why does the tool warn about expected counts below 5?

The chi-square distribution is only an approximation of the true sampling distribution, and it is poor when expected cell counts are small. With the [[3, 1], [1, 3]] table all four expected counts are 2, so χ² suggests p = 0.1573 while the exact answer is 0.4857. For a 2 × 2 table use the Fisher value; otherwise combine categories or collect more data.

What does a significant chi-square mean?

It means the counts differ from what the null hypothesis predicts by more than chance would usually produce. It does not say how large or important the difference is; Cramér’s V does that.

When should I use Fisher’s exact test?

For a 2 × 2 table with small expected counts, such as below 5 in any cell, where the chi-square approximation is poor.

Keep working with the result

openWorkstand also includes a free workspace with documents, spreadsheets, tasks, projects and a calendar that save to a folder on your computer.