Logo

MonoCalc

/

Chi-Square Test Calculator

Math
Comma-, space-, or newline-separated counts
Proportions per category (auto-normalized, need not sum to exactly 1)
Comma-separated, same order as data

About This Tool

Chi-Square Test Calculator – Testing Categorical Data with χ²

The chi-square (χ²) test is the standard statistical tool for analyzing categorical data — counts sorted into buckets rather than continuous measurements. Wherever a statistics course, survey, or lab report asks whether a set of frequencies matches an expectation, or whether two categorical variables are related, the chi-square distribution is the underlying math. This calculator covers the four situations that come up most often: goodness-of-fit, test of independence (including test of homogeneity), a variance test, and a standalone critical-value / p-value lookup.

Goodness of Fit

A goodness-of-fit test asks whether the observed counts in a single categorical variable match a hypothesized distribution. The statistic is χ² = Σ (Oᵢ − Eᵢ)² / Eᵢ, summed across every category, with df = k − 1 where kis the number of categories. Typical examples include checking whether dice rolls are uniformly distributed, whether a survey's demographic split matches census figures, or whether offspring ratios in a genetics experiment match the Mendelian prediction. Expected values can be entered directly as counts, or as proportions that the calculator automatically scales to the observed total.

Test of Independence & Homogeneity

The test of independence uses a contingency table — a cross-tabulation of two categorical variables — to check whether they are statistically associated. Expected counts for each cell are computed as Eᵢⱼ = (row total × column total) / grand total, and df = (rows − 1) × (columns − 1). The identical math also answers the "test of homogeneity" question: whether several populations share the same distribution across categories, just framed as comparing groups rather than testing association. For 2×2 tables, the calculator can optionally apply Yates' continuity correction, which shrinks each squared deviation by 0.5 before dividing by the expected count to reduce the bias introduced when approximating a discrete outcome with a continuous curve.

Variance Test

Beyond categorical counts, the chi-square distribution also underlies the classic test for a single population variance. Given a sample variance , sample size n, and a hypothesized population variance σ₀², the statistic is χ² = (n − 1)s² / σ₀² with df = n − 1. The calculator supports two-tailed (σ² ≠ σ₀²), upper-tailed (σ² > σ₀²), and lower-tailed (σ² < σ₀²) alternatives, each with the matching critical value(s).

Effect Size & Residuals

A significant χ² result tells you an association or deviation exists, but not how strong it is. Cramér's VV = √(χ² / (n × min(rows − 1, columns − 1))) — rescales the statistic to a 0–1 range that is comparable across table sizes; for 2×2 tables the equivalent φ coefficient is reported too. Standardized residuals ((O − E) / √E) highlight exactly which cells are driving a significant result, which is often more useful than the aggregate statistic alone.

How the Calculation Works

Under the null hypothesis, the χ² statistic follows a chi-square distribution with the computed degrees of freedom. The calculator derives the p-value and critical value from the regularized incomplete gamma function — the same mathematical object behind the textbook chi-square table — using a numerically stable series expansion combined with a continued-fraction approximation, so results stay accurate across a wide range of degrees of freedom without relying on lookup tables.

Watch for small expected counts
The chi-square approximation weakens when expected cell counts are small. A common rule of thumb flags results when more than 20% of expected cells fall below 5, or any cell is below 1 — in those cases, consider merging sparse categories or switching to Fisher's Exact Test.

Common Use Cases

Students verify textbook examples and homework answers; researchers test survey responses across demographic groups; quality-control teams check whether defect categories occur in expected proportions; and product teams compare conversion-category distributions between A/B/n test variants. In every case, the chi-square test converts a table of counts into a single, interpretable statistic — with this calculator handling the incomplete gamma function so you don't have to.

Frequently Asked Questions

Is the Chi-Square Test Calculator free?

Yes, Chi-Square Test Calculator is totally free :)

Can I use the Chi-Square Test Calculator offline?

Yes, you can install the webapp as PWA.

Is it safe to use Chi-Square Test Calculator?

Yes, any data related to Chi-Square Test Calculator only stored in your browser (if storage required). You can simply clear browser cache to clear all the stored data. We do not store any data on server.

What is a chi-square (χ²) test used for?

The chi-square test is a hypothesis test for categorical data. It checks whether observed counts differ significantly from what would be expected under a null hypothesis — either that a single variable follows a hypothesized distribution (goodness of fit), or that two categorical variables are unrelated (test of independence).

How does this Chi-Square Test Calculator work?

Choose a mode — Goodness of Fit, Test of Independence, Variance Test, or a standalone Distribution lookup — enter your observed data (and expected values or a contingency table), and the calculator computes the χ² statistic, degrees of freedom, p-value, critical value, and a plain-language decision on whether to reject the null hypothesis, along with an expected-values table and a distribution chart.

What is the difference between Goodness of Fit and Test of Independence?

Goodness of Fit compares one categorical variable's observed frequencies to a hypothesized/expected distribution (e.g., are dice rolls uniform?). Test of Independence uses a contingency table to check whether two categorical variables are associated (e.g., is smoking status related to disease outcome?). The Test of Homogeneity uses the same contingency-table math to compare distributions across several populations.

What does the p-value and critical value tell me?

The p-value is the probability of observing a χ² statistic at least as extreme as yours if the null hypothesis were true; a small p-value (below your significance level α) suggests rejecting H₀. The critical value is the χ² threshold at your chosen α and degrees of freedom — if your statistic exceeds it, the result is statistically significant.

Why does the calculator warn about low expected cell counts?

The chi-square approximation becomes unreliable when expected cell counts are too small — commonly cited rules flag when more than 20% of cells have an expected count below 5, or any cell is below 1. In these cases consider Fisher's Exact Test instead, or combine sparse categories.

What is Cramér's V and when should I use Yates' correction?

Cramér's V is an effect-size measure (0 to 1) showing the strength of association found by a Test of Independence, independent of sample size. Yates' continuity correction is a small adjustment applied only to 2×2 contingency tables to reduce the bias of approximating a discrete distribution with the continuous chi-square curve.