Chi-Square Test Calculator
Run goodness-of-fit and independence tests with full per-cell working.
Enter observed and expected frequencies (one row per category)
Free Chi-Square Test Calculator
Testing whether your data fits an expected pattern, or whether two categorical variables are related? Our free chi-square test calculator handles both goodness-of-fit and independence (contingency table) tests, giving you the chi-square statistic, degrees of freedom, and p-value instantly.
For goodness-of-fit, enter your observed and expected frequencies; for independence, build a contingency table and the expected frequencies are calculated automatically from the row and column totals. Every cell's contribution to the chi-square statistic is shown, so you can see exactly where the biggest deviations come from, not just the final number.
Built for statistics coursework, survey analysis, and research. No sign-up, no downloads, completely free.
About the Chi-Square Test Calculator
How It Works & Methodology
The Chi-Square Test Calculator runs both major chi-square tests: goodness-of-fit, comparing observed frequencies against an expected distribution, and independence, testing whether two categorical variables are related via a contingency table. Expected frequencies for the independence test are computed automatically from row and column totals.
Features
Two test modes
Goodness-of-fit and independence, each with its own input layout.
Dynamic contingency table
Flexible row and column counts for common table sizes.
Per-cell working
Every category or cell's contribution to χ² shown individually.
Accurate p-value
Computed from the chi-square distribution CDF across arbitrary degrees of freedom.
Mathematical Basis & Practical Verification
The Chi-Square Test Calculator is built on parametric and non-parametric probability distributions, hypothesis test statistics (Z, t, χ²), and descriptive quartile/dispersion formulas. Runs chi-square goodness-of-fit and independence tests from observed vs expected data, returning the chi-square statistic, degrees of freedom, p-value, and significance verdict. Key capabilities built into this tool include goodness-of-fit test, independence test, dynamic contingency table, and per-cell working.
All computations for the Chi-Square Test Calculator follow the definitions established in NIST/SEMATECH e-Handbook of Statistical Methods (National Institute of Standards and Technology (NIST)) and ISO 3534-1: Statistics — Vocabulary and Symbols (International Organization for Standardization (ISO)). Because the solver evaluates inputs locally in IEEE 754 double-precision arithmetic (53-bit significand, ~15–17 significant decimal digits) and is regression-tested against deterministic reference fixtures in tests/chi-square-calculator.spec.ts, you can inspect boundary conditions, verify dimensional consistency across statistics units, and cross-check each intermediate step against textbook solutions.
Related Calculators & Tools
Calculate population and sample standard deviation with full step-by-step working, plus mean, variance, and more from your data set.
Paste a data set and get all descriptive statistics plus a histogram.
Convert between a z-score and a percentile with a shaded bell curve.
Calculate a confidence interval for a mean (z or t interval) or proportion, with margin of error and critical value shown step by step.
Authoritative Sources & Standards
- NIST/SEMATECH e-Handbook of Statistical Methods — National Institute of Standards and Technology (NIST)
- ISO 3534-1: Statistics — Vocabulary and Symbols — International Organization for Standardization (ISO)
Frequently Asked Questions
What's the difference between goodness-of-fit and independence tests?
Goodness-of-fit checks whether observed frequencies match an expected distribution; independence checks whether two categorical variables are related, using a contingency table.
How is the chi-square statistic calculated?
By summing (observed − expected)² / expected across all categories or cells.
How are expected frequencies found in an independence test?
From (row total × column total) / grand total for each cell, computed automatically from your entered data.
How are degrees of freedom determined?
k − 1 for goodness-of-fit with k categories; (rows − 1) × (columns − 1) for an independence test.
What does a significant result mean?
For goodness-of-fit, that observed data significantly deviates from the expected distribution; for independence, that the two variables are likely related, not independent.
What size contingency table can I use?
The tool supports flexible row/column counts for common table sizes.
What if an expected frequency is zero?
Expected frequencies must be greater than zero for the chi-square formula to be valid; the calculator flags this case.
Does it show the per-cell working?
Yes, each category or cell's contribution to the chi-square statistic is shown individually.