Statistics
Chi-Square Test Calculator
Test whether observed counts match an expected pattern (goodness of fit) or whether two categorical variables are related (independence).
Paste counts or a contingency table; mathcheck computes expected counts, each cell's contribution, χ², degrees of freedom, the p-value, the critical value, and Cramér's V.
Counts only. Separate columns with spaces or commas; put each row on its own line.
Try an example
Result
χ² statistic
—
- p-value
- —
- Degrees of freedom
- —
- Decision
- —
- Critical value
- —
Student quick launch
Grade planning, algebra checks, and formulas students reach for most.
Study path
Use this calculator with
Follow these when you want the formula behind the answer, a short lesson, or nearby tools in the same topic.
What the chi-square test calculator solves
Chi-square tests compare counted data with what a hypothesis predicts. Goodness of fit checks one categorical variable against expected proportions (is this die fair? do colors follow the advertised mix?). The test of independence checks whether two categorical variables in a contingency table are associated (does preference depend on age group?). Both use the same statistic: the sum of squared differences between observed and expected counts, scaled by the expected counts.
Formulas
How to use it
- Choose goodness of fit for one list of counts, or independence for a table.
- Enter counts, not percentages. For a table, put each row on its own line with columns separated by spaces or commas.
- For goodness of fit, keep 'equal' for a uniform expectation or enter custom expected counts or percentages (one per category).
- Set α and read χ², df, the The chance of seeing results this extreme if nothing real were going on., and the decision. The table shows every expected count and contribution.
How to read the answer
A large χ² relative to its degrees of freedom means the observed counts are far from what H0 predicts. If p ≤ α (equivalently χ² exceeds the critical value), reject H0. The contribution column shows which categories or cells drive the result: a cell with O much larger than E happened more often than expected. Cramér's V (0 to 1) describes the strength of an association in an independence test; a tiny p-value with a small V means a weak but detectable relationship in a big A smaller group taken from a population, used to estimate facts about the whole group..
Common mistakes and edge cases
- Using percentages or averages as observed values; the test only works on raw counts.
- Expected counts below 5 in some cells make the approximation unreliable. Combine categories or use an exact test.
- Expected counts that do not add to the observed total in a custom goodness-of-fit test; the calculator warns when they differ.
- A row or column of zeros gives expected counts of 0 and an undefined statistic; drop that row or column.
- A chi-square test shows association, not causation, and does not say which direction the relationship runs.
Worked examples
2×3 contingency table
Preference by group
χ² statistic
9.8636
2×2 table
Classic four-cell test
χ² statistic
0.7937
Goodness of fit: fair die
96 rolls with equal expected counts
χ² statistic
2.5
Goodness of fit with custom percentages
Candy colors claimed as 30/20/20/30
χ² statistic
1.3889
Perfect fit
Observed equals expected, so χ² = 0 and p = 1
χ² statistic
0
Undefined: empty column
A column of zeros has expected counts of 0
χ² statistic
Error
Frequently asked questions
What is the difference between goodness of fit and a test of independence?+
Goodness of fit compares one categorical variable's counts with expected proportions you specify (equal, or a claimed mix). Independence tests whether two categorical variables in a table are related; the expected counts come from the row and column totals instead of from you.
How do I find expected counts in a contingency table?+
Multiply the cell's row total by its column total and divide by the grand total: E = (row total × column total) / n. The calculator lists every expected count in the results table.
What degrees of freedom does a chi-square test use?+
Goodness of fit uses k - 1, where k is the number of categories. Independence uses (rows - 1) × (columns - 1); a 2×2 table has 1 degree of freedom.
Is a chi-square test one-tailed or two-tailed?+
The p-value is always the upper tail of the chi-square distribution, because squared differences can only make the statistic larger. That single upper tail already covers deviations in every direction.
What if some expected counts are less than 5?+
The chi-square approximation gets rough. Common fixes are combining small categories, collecting more data, or using Fisher's exact test for 2×2 tables. The calculator flags cells below 5.
What does Cramér's V tell me?+
It converts χ² into an effect size between 0 (no association) and 1 (perfect association) that does not grow with sample size. Roughly, 0.1 is small, 0.3 medium, and 0.5 large.
About this calculator
- Written by
- mathcheck editorial team
- Last reviewed
- September 4, 2026
Method
- Uses the values entered by the user and stable formulas documented on the page.
Related calculators
Chi-Square Distribution Calculator
Find P(χ² ≤ x) and P(χ² ≥ x) for any degrees of freedom, invert a probability to get x, or look up the critical chi-square value for a significance level. Includes mean, variance, mode, and density.
T-Test Calculator
Run a one-sample, two-sample (Welch or pooled), or paired t test from raw data, summary statistics, or a t value you already have. Get t, df, one- or two-tailed p-value, confidence interval, Cohen's d, a hypothesized difference Δ, and a decision at your α.
P-Value Calculator
Convert a z or t test statistic into a p-value with two-tailed, left, or right tails — includes reject/fail-to-reject decisions at alpha = 0.05 and 0.01 plus the full CDF work.
Relative Frequency Calculator
Calculate how often a target value appears in a data list as a count and percentage.
Probability Calculator
Calculate event probability, complement probability, odds, and repeated independent event probabilities.
Root Mean Square Calculator
Calculate root mean square from a list of positive, negative, or mixed values.
Last updated: September 4, 2026