Math

Chi-Square Test Calculator

Run a chi-square test of independence on a contingency table or a goodness of fit test against expected frequencies, with expected counts, residuals, effect size and assumption checks.

Last reviewed by the Radiatus Cloud team

Result appears here.

Need this done properly for your business?

Radiatus delivers secure cloud, DevOps & compliance engineering.

Book a free consult

Two different tests share one statistic

The test of independence asks whether two categorical variables are related, using a contingency table of counts. The goodness of fit test asks whether one set of observed counts matches a set of expected proportions. Both compute the same statistic, the sum of squared differences between observed and expected counts divided by the expected, and both compare it to the same distribution. Only the degrees of freedom differ, which is where most mistakes in applying it originate.

Expected counts must be large enough

The chi-square distribution is an approximation to the true distribution of the statistic, and it works when the expected counts are reasonably large. The standard requirement is that every expected count is at least 5, or that at most twenty percent are below 5 with none below 1. When cells are sparser than that, the p-value is unreliable and Fisher's exact test is the correct alternative. This is the single most commonly violated assumption in published chi-square results.

Significance says nothing about strength

The statistic scales directly with the sample size, so any real deviation from independence eventually becomes significant given enough data. Cramér's V rescales it to a value between 0 and 1 that does not grow with the sample, which is what to report alongside the p-value. Examining the standardised residuals then shows which cells are actually driving the result, which the overall statistic alone never reveals.

Related tools

  • Percentage Calculator — Calculate percentages, percentage change, increase and decrease, and reverse percentages, with the working shown for each result.
  • Statistical Calculator — Calculate mean, median, mode, standard deviation, and more.
  • Probability Calculator — Calculate probabilities for single and combined events, including conditional probability and Bayes' theorem.
  • Scientific Calculator — Perform advanced mathematical operations including trig, log, and exponents.

Frequently Asked Questions

What is the difference between the two tests?

The independence test uses a contingency table and asks whether two categorical variables are related. The goodness of fit test compares one set of counts against expected proportions. The statistic is the same and only the degrees of freedom differ.

What is the expected count rule?

Every expected count should be at least 5, or at most twenty percent below 5 with none below 1. Below that the chi-square distribution is a poor approximation and the p-value cannot be trusted. Fisher's exact test is the alternative for sparse tables.

What is Cramér's V?

An effect size between 0 and 1 that measures the strength of the association without growing with sample size. The chi-square statistic itself scales with n, so any real deviation eventually becomes significant given enough data and the statistic cannot tell you whether it matters.

What are standardised residuals?

The difference between observed and expected in each cell, scaled so it can be compared across cells. Values beyond about ±2 mark the cells driving the result, which the overall statistic never shows on its own.

Can I use percentages instead of counts?

No. The test depends on the actual number of observations, so entering percentages makes the result meaningless: the same percentages from 50 observations and 5000 give very different evidence, and only raw counts carry that information.

Privacy & Security

Everything runs in your browser; nothing is uploaded.

Data: None
Client-side-Side
Active
v1.0

How to Use

Paste a contingency table or observed and expected counts to run the test.

Disclaimer: This tool is provided "as is" without warranty of any kind. Results are for educational and utility purposes.