3. Enter data
4. View results

Compare observed and expected frequencies

This calculator compares observed and expected frequencies within (up to 20) categories using the chi-square test.
Enter the names of the categories into the first column, then enter the actual counts observed and expected for each group.
Learn more about chi-square in the description below the calculator.

Enter data

Category
Observed #
Expected #
Enter one value per row.

View the results

What is chi-square?

A chi-square test compares count data in different groups to their expected counts within each group. "Subjects" in the experiment can be individuals, events, items, or anything else so long as it can be counted.

It is a flexible method where the researcher must determine the expected counts for each group. The expected counts can be that they are equal, are based on previous research, follow some statistical distribution, or something else entirely.

The key is that its focus is on count data. If you are analyzing rates or percentages, then chi-square is not the appropriate tool.

How to use the chi-square table calculator

Enter the label (optional), actual counts of observed subjects (or events), and expected counts for each category on a separate line. Labels for each category are not used in calculation but are often helpful to organize the input data.

Important: Expected frequencies (like observed) should be entered as counts. Decimals in the expected count are acceptable so long as they do not represent percentages (for 15% of 250 total individuals, enter 37.5).

Example experiment setup

Suppose you have 605 subjects in total spread across five categories and observe the counts for each below:

  • Group A: 200
  • Group B: 102
  • Group C: 50
  • Group D: 153
  • Group E: 100

We can compare the counts that we observe to the expected distribution to see if there is evidence that our sample as a whole is different from the hypothesized distribution.

How do I find the expected frequencies?

Chi-square calculators require you to enter the expected frequencies in each group so that it knows what it is comparing against.

Here is an example of how to calculate expected frequencies. One common assumption is that all groups are equal (e.g. 605 / 5 = 121 expected per group). This calculator allows for more flexible options beyond just that, and decimals are acceptable so long as the expected frequencies add up to the total number of observations.

A specific use-case of chi-square is analyzing contingency tables. With contingency tables, the expected counts are determined using the assumption that the factors are not-related. This contingency table calculator includes an option to do a Yates' correction.


Performing a chi-square test? We can help.

Sign up for more information on how to perform this and other common statistical analyses.

How to calculate chi-square by hand

Chi-square is not as complicated as some statistical tests and is sometimes done by hand. You can use the formula below, entering the observed (O) and expected (E) frequencies for each group. By summing up the calculated values for each of the categories, we can calculate the chi-square test statistic as shown below:

Chi-square test calculation details

Once you have calculated the test statistic, you would need to use a computer or a chi-square table to find the approximate P value.

While this can be done by hand, there are several opportunities for human error, which is why we recommend this calculator (or Prism for more advanced analysis).

Assumptions of chi-square

While chi-square is one of the more flexible tests in statistics, it has the following assumptions:

  • Analyzing counts (not percentages)
  • Large number of subjects in each category (usually greater than 5)
  • Comparing to a theoretical distribution

See more details in our analysis checklist.

Related tests and calculators

Chi-square test for contingency tables

Chi-square tests are also used to analyze contingency tables. If you have a 2x2 contingency table, use this calculator. The difference is that with contingency tables, the expected counts are calculated behind the scenes with the assumption that the variables are not associated.

Binomial test

If you have only two categories, use this binomial test calculator instead. Chi-square can give P values that are too low in this case, but the binomial test will calculate it exactly.

Chi-square test vs t-test

Chi-square tests if the observed counts in each category varies from its expected "theoretical" population, whereas t-tests evaluate whether two sample means (or one sample mean and a fixed value) are statistically equivalent.

Interpreting results

The chi-square p value tests if the observed counts are consistent with the expected counts. You would interpret chi-square value figures below your significance threshold (often 0.05) as "evidence that the data were not sampled from the distribution you expected". If a P value is greater than your significance threshold, there is no evidence that the observed values were different from the expected, theoretical distribution.

Note that P values are easy to misinterpret, but large P values are not evidence that no difference exists; it could be that you don't have enough data to detect a difference.

This calculator performs a two-tailed chi-square test and assumes a P value significance threshold of 0.05.

The results page also includes the chi-squared statistic and its degrees of freedom. Notice the category names are not involved at all in the interpretation. See this example for help with interpreting a chi-square P value.

Graphing chi-square results

This calculator does not create a graphic of the chi-square results. A grouped bar chart is commonly used to visualize the difference between observed and expected counts, and is one of the many custom graphics offered with Prism.

Ready for more advanced analyses?

Start your 30 day free trial of Prism and get access to:

  • Step by step guides on how to perform the most common analysis
  • Sample data to save you time
  • More tips on how Prism can help your research

With Prism, in a matter of minutes you learn how to go from entering data to performing statistical analyses and generating high-quality graphs.

Analyze, graph and present your scientific work easily with GraphPad Prism. No coding required.