Home Templates Calculators Videos Academy Software About Contact Login
Tables & Categorical Data

Chi-Square Test Calculator

Enter your contingency table counts, test whether two categorical variables are associated, and get χ², degrees of freedom, p-value, and Cramér's V — all in your browser.

Was this useful?

Contingency table

Enter the count in each cell. All values must be whole numbers ≥ 0.
All cells must be non-negative whole numbers with a total > 0.
📊

Ready to test

Fill in your contingency table and press Calculate to run the chi-square test.

Watch: Chi-Square Tests and Non-Parametric Methods

Simulation Lab

Chi-Square Association Test

A supervisor suspects the type of defect depends on which shift made the part. Enter the lab to see whether the counts back that up — or whether shift and defect are unrelated.

How the chi-square test works

1

Enter your counts

Set the number of rows and columns, then type the count in each cell of your table. Row and column totals are calculated automatically.

2

Expected counts computed

For each cell, the calculator works out what you'd expect to see if the categories were completely unrelated — using just the row and column totals.

3

Test and interpret

It compares what you actually got to what was expected. The bigger the gap, the stronger the evidence of a real link. The result tells you whether the categories are genuinely connected, and how strong that connection is.

Complete guide

Chi-Square Test Guide

Use the calculator above to test whether two categorical variables are related. The chi-square test of independence is one of the most widely used statistical tests in quality and operations — it tells you whether the pattern you see in your data is likely to be genuine or just random chance.

What it is

What is the chi-square test?

The chi-square test of independence asks: could the pattern in this contingency table have arisen by chance if the two variables were unrelated? You compare observed cell counts to expected counts — the counts you would see if the variables were independent. A large χ² means the observed pattern is far from what chance predicts, giving a small p-value and evidence of a real association.

Calculation logic

How the calculation works

The test first works out the counts you would expect in each cell if the two categories had no connection at all, based purely on the row and column totals. It then compares those expected counts with the counts you actually observed. The bigger the gaps between observed and expected, the larger the chi-square statistic and the smaller the p-value. A p-value below 0.05 says the two categories really are linked. Cramér's V then rates how strong that link is on a simple 0-to-1 scale.

Worked example

Worked example: does shift affect defect type?

A quality team wonders if the type of defect (scratch, dent, or misalignment) varies by shift. They count defects across three shifts over a month and build a simple table of counts.

The Chi-Square test gives p = 0.03. Because that's below 0.05, there is a real link — defect type is not the same across all shifts.

What to do with this: Dig into which shift has the unusual pattern. Maybe the afternoon shift rushes the final 30 minutes, causing more scratches. Now you know where to focus.

Why it matters

Operational impact

The chi-square test turns a table of counts into a statistical decision. Instead of eyeballing percentages and debating whether a difference is "real", you get an objective p-value and effect size. This prevents both over-reacting to noise and ignoring genuine patterns in your categorical data.

Decision making

When to use it

Use the chi-square test when both variables are categorical (e.g. shift vs defect type, supplier vs product grade, department vs complaint category). It is ideal in the Analyse phase of DMAIC to test whether a suspected categorical X is truly associated with Y, before investing in a corrective action.

Lean Six Sigma

Link to Six Sigma

Chi-square is the standard hypothesis test for categorical data in Six Sigma. It sits alongside t-tests (for means) and F-tests (for variances) in the Analyse phase toolkit. A significant result identifies a candidate root cause; a follow-up Pareto or fishbone analysis then focuses the improvement work.

Industry examples

Where the chi-square test is used

ManufacturingTest whether defect type is associated with supplier, shift, machine, or production line to target root-cause investigation.
HealthcareAssess whether patient outcomes (improved/stable/worse) differ by treatment group, ward, or time of admission.
Product & R&DCompare pass/fail rates across formulations, test conditions, or material batches to identify which factor drives failures.
Software & servicesTest whether customer satisfaction rating is associated with agent, channel, or complaint category to prioritise service improvement.
Common mistakes

Common Chi-Square mistakes to avoid

  • Using Chi-Square when expected cell counts are below 5 — results become unreliable. Combine categories or use Fisher's Exact Test instead.
  • Confusing statistical significance with practical importance — a p-value below 0.05 just means the pattern is real, not that it's big enough to matter.
  • Running Chi-Square on percentages rather than raw counts — always use actual counts, not proportions.
  • Assuming the test tells you which cells are driving the result — it only confirms a relationship exists. Look at residuals to find where the pattern is strongest.
  • Forgetting that Chi-Square only works for independent categories — if the same person appears in multiple cells, the test is invalid.
What to do next

After a significant result

If χ² is significant, examine which cells contributed most to the statistic — the cells with the largest (O−E)²/E are where the categories diverge most. Build a Pareto chart or bar chart to visualise the pattern, then investigate the operational reason behind the cells that stand out. If the result is not significant, the variables may genuinely be independent — or your sample may be too small to detect a real effect.

Resources

Templates, videos and learning

Combine the chi-square test with Pareto analysis, fishbone diagrams, and a DMAIC structure for a complete categorical data investigation.

Frequently asked questions

What is a chi-square test of independence?

A chi-square test of independence tests whether two categorical variables are related or independent. You collect counts of observations that fall into combinations of categories (a contingency table), then compare the observed counts to what you would expect if the variables had no relationship. A low p-value (below your chosen significance level, typically 0.05) means the association is statistically significant.

What is the difference between observed and expected counts?

Observed counts are the actual counts you measured. Expected counts are the counts you would get if the two variables were completely independent — calculated as (row total × column total) divided by the grand total for each cell. The chi-square statistic measures how far the observed counts are from the expected counts; a large departure gives a large χ² and a small p-value.

What is the 'expected count ≥ 5' rule?

The chi-square distribution approximation works well when expected cell counts are 5 or more. If any expected count is below 5, the approximation can be unreliable and you may get a misleading p-value. In that situation, consider combining categories to increase counts, collecting more data, or using Fisher's exact test (which works for any sample size but is limited to 2×2 tables).

What is Cramér's V and what does it mean?

Cramér's V is an effect size measure for chi-square tests, ranging from 0 (no association) to 1 (perfect association). It tells you how strong the relationship is, independent of sample size. As a rough guide: V below 0.10 is negligible, 0.10–0.20 is weak, 0.20–0.40 is moderate, and above 0.40 is strong. A statistically significant chi-square result does not guarantee a practically meaningful association — always check Cramér's V alongside the p-value.

Want to master hypothesis testing with categorical data inside a structured improvement project? The Black Belt course covers advanced statistics, hypothesis testing, and the full analytical toolkit.

View Black Belt →