Skip to main content
statistics

Chi-Square Test Calculator

Calculate the chi-square test statistic from observed and expected frequencies. Used for goodness-of-fit tests and tests of independence in contingency tables across all fields of research.

Reviewed by Chase FloiedUpdated

This free online chi-square test calculator provides instant results with no signup required. All calculations run directly in your browser — your data is never sent to a server. Enter your values below and see results update in real time as you type. Perfect for everyday calculations, homework, or professional use.

Observed frequency for the first category.

Expected frequency for the first category.

Observed frequency for the second category.

Expected frequency for the second category.

How to Use This Calculator

1

Enter your input values

Fill in all required input fields for the Chi-Square Test Calculator. Most fields include unit selectors so you can work in your preferred unit system — metric or imperial, whichever matches your problem.

2

Review your inputs

Double-check that all values are correct and that you have selected the right units for each field. Incorrect units are the most common source of calculation errors and can produce results that are off by factors of 2, 10, or more.

3

Read the results

The Chi-Square Test Calculator instantly computes the output and displays results with units clearly labeled. All calculations happen in your browser — no loading time and no data sent to a server.

4

Explore parameter sensitivity

Try adjusting individual input values to see how the output changes. This is a quick and effective way to develop intuition about how different parameters influence the result and to identify which inputs have the largest effect.

Formula Reference

Chi-Square Test Calculator Formula

See calculator inputs for the governing equation

Variables: All variables and their units are labeled in the calculator interface above. Input fields accept values in multiple unit systems — select your preferred unit from the dropdown next to each field.

When to Use This Calculator

  • Use the Chi-Square Test Calculator when you need accurate results quickly without the risk of manual computation errors or unit conversion mistakes.
  • Use it to verify calculations made by hand or in spreadsheets — an independent check can catch errors before they lead to costly decisions.
  • Use it to explore how changing input parameters affects the output — a quick way to develop intuition and identify the most influential variables.
  • Use it when collaborating with others to ensure everyone is working from the same numbers and applying the same assumptions.

About This Calculator

The Chi-Square Test Calculator is a free, browser-based calculation tool for engineers, students, and technical professionals. Calculate the chi-square test statistic from observed and expected frequencies. Used for goodness-of-fit tests and tests of independence in contingency tables across all fields of research. It implements standard formulas and supports both metric (SI) and imperial unit systems with automatic unit conversion. All calculations are performed instantly in your browser with no data sent to a server. Use this calculator as a quick reference and sanity-check tool during design, analysis, and learning. Always verify results against primary engineering references and applicable standards for any safety-critical application.

About Chi-Square Test Calculator

The chi-square test calculator computes the chi-square statistic from observed and expected frequencies, which is then compared to critical values from the chi-square distribution to assess statistical significance. The chi-square test is one of the most commonly used nonparametric tests in statistics. It comes in two main forms: the goodness-of-fit test (testing whether observed data matches a theoretical distribution) and the test of independence (testing whether two categorical variables are related in a contingency table). It is used in genetics to test Mendelian ratios, in marketing to analyze survey responses, in epidemiology to compare disease rates, and in quality control to evaluate defect categories.

The Math Behind It

The chi-square statistic is computed as chi^2 = sum((O_i - E_i)^2/E_i), where O_i is the observed count and E_i is the expected count for each category. Under the null hypothesis (observed = expected), this statistic approximately follows a chi-square distribution with degrees of freedom equal to (number of categories - 1) for goodness-of-fit, or (rows-1)*(columns-1) for independence tests. The approximation is valid when all expected frequencies are at least 5; otherwise, Fisher's exact test or simulation-based methods should be used. Large chi-square values indicate a significant discrepancy between observed and expected, leading to rejection of the null hypothesis. The chi-square distribution is the distribution of the sum of squared standard normal variables, and its shape depends on the degrees of freedom: it is right-skewed with mean equal to df and variance equal to 2*df. Yates' continuity correction (subtracting 0.5 from each |O-E| before squaring) is sometimes applied for 2x2 tables to improve the approximation. Effect size can be measured using Cramer's V or the contingency coefficient.

Formula Reference

Chi-Square Statistic

chi^2 = sum((O_i - E_i)^2 / E_i)

Variables: O_i = observed frequency; E_i = expected frequency; sum over all categories

Worked Examples

Example 1: Fair die test

A die is rolled 120 times with results: 25, 17, 22, 18, 20, 18 for faces 1-6. Expected: 20 each.

Step 1:Cell 1: (25-20)^2/20 = 25/20 = 1.25.
Step 2:Cell 2: (17-20)^2/20 = 9/20 = 0.45.
Step 3:Continuing for all 6 cells gives chi^2 = 2.6.

chi^2 = 2.6 with 5 df. Critical value at 5% is 11.07, so we fail to reject; the die appears fair.

Example 2: Gender and product preference

50 males and 30 females prefer Product A. Expected under independence: 40 and 40.

Step 1:Cell 1: (50-40)^2/40 = 100/40 = 2.5.
Step 2:Cell 2: (30-40)^2/40 = 100/40 = 2.5.
Step 3:chi^2 = 5.0.

chi^2 = 5.0 with 1 df. Critical value at 5% is 3.841; result is significant.

Common Mistakes & Tips

  • !Using the chi-square test with expected frequencies less than 5, which violates the approximation assumption.
  • !Applying the test to percentages or means instead of raw counts.
  • !Using the wrong degrees of freedom, which changes the critical value and conclusion.

Related Concepts

Used in These Calculators

Calculators that build on or apply the concepts from this page:

Frequently Asked Questions

What is the minimum expected frequency for the chi-square test?

A common rule is that all expected frequencies should be at least 5. When this is not met, combine categories or use Fisher's exact test.

Can I use chi-square for continuous data?

The chi-square test is designed for categorical (count) data. For continuous data, you would first need to bin the data into categories, but other tests like the t-test or ANOVA are usually more appropriate.

What is the difference between goodness-of-fit and independence tests?

Goodness-of-fit tests whether one variable's distribution matches a theoretical expectation. Independence tests whether two categorical variables are related in a contingency table.