What a chi-square test checks
A chi-square test checks whether counts match what you expected. You roll a die 60 times and count how often each face lands; you survey 200 people and count how many prefer each of four brands; you cross-tabulate gender against product choice. In each case you have observed counts and expected counts, and the chi-square statistic measures how far apart they are.
The statistic itself is a single number, and on its own it means little. A chi-square of 5 could be damning or harmless depending on the degrees of freedom. That is why this calculator needs both inputs: the statistic and the degrees of freedom. From those two it returns the p-value, the critical value at the 0.05 level, and a yes-or-no verdict.
This calculator takes your chi-square statistic and degrees of freedom and gives you all three answers live. It runs entirely in your browser, so nothing is uploaded and nothing is stored.
How the chi-square p-value is worked out
The p-value is the area under the chi-square curve beyond your statistic. That area comes from the regularised lower incomplete gamma function, written P(a, x), with a set to half the degrees of freedom and x set to half the statistic. The p-value is then 1 − P(df ÷ 2, chi-square ÷ 2). The calculator works this out with the Numerical Recipes series and continued-fraction methods, which are accurate to far more digits than a p-value needs.
The critical value is found the other way round: it is the statistic whose p-value is exactly 0.05. The calculator finds it by bisection, narrowing a bracket sixty times until the value settles. For 1 degree of freedom the critical value is 3.84; for 2 it is 5.99; for 3 it is 7.81. If your statistic is bigger than the critical value, the result is significant at 0.05.
Degrees of freedom are where the test gets its shape. For a goodness-of-fit test with k categories, the degrees of freedom are k − 1. For a table with r rows and c columns, they are (r − 1) × (c − 1). Get this number wrong and both the p-value and the critical value are wrong, so count the categories first and check the rule for your test.
Degrees of freedom, explained
Degrees of freedom are the number of counts free to vary once the totals are fixed. Roll a die 60 times and count the six faces: once you know five of the counts, the sixth is forced by the total of 60, so there are 5 degrees of freedom. A table with 2 rows and 3 columns has (2 − 1) × (3 − 1) = 2 degrees of freedom. The more freedom, the larger the statistic has to be before it counts as surprising.
This is the input people get wrong most often, and it changes everything. A statistic of 5 with 1 degree of freedom gives p = 0.03 and is significant; the same statistic of 5 with 5 degrees of freedom gives p = 0.42 and is nowhere near significant. The curve spreads out as the degrees of freedom grow, so a bigger statistic is needed to reach the same tail area.
A quick sense check helps. With 1 degree of freedom, anything above 3.84 is significant at 0.05. With 2, the line is 5.99. With 3, it is 7.81, and with 5 it is 11.07. If your statistic is below the line for your degrees of freedom, the counts fit the expected pattern well enough that chance alone could explain them.
A worked example: chi-square 5 with 1 degree of freedom
Take the default numbers on this page: a chi-square statistic of 5 with 1 degree of freedom. The p-value is 1 − P(0.5, 2.5), which works out to 0.03. The critical value at 0.05 is 3.84. Since 5 is bigger than 3.84 and the p-value of 0.03 is below 0.05, the result is significant — the counts differ from expectation more than chance alone would usually produce.
A second example shows a non-significant result. A statistic of 2 with 2 degrees of freedom gives a p-value of 0.37, against a critical value of 5.99. The statistic is far below the line, and a p-value of 0.37 means differences this big happen more than a third of the time by chance. There is no evidence here of anything but noise.
A third example sits in between. A statistic of 10 with 3 degrees of freedom gives a p-value of 0.02 and a critical value of 7.81, so it is significant. Notice the pattern across the three cases: 5 on 1 degree of freedom is significant, 2 on 2 is not, and 10 on 3 is. The statistic alone never decides — the degrees of freedom set the bar, and the bar rises with them.
Where chi-square tests do real work
In genetics, the chi-square goodness-of-fit test checks whether observed ratios match Mendel's predictions. Cross two heterozygous plants and expect a 3:1 ratio; count the offspring and test whether the counts fit. A non-significant result means the data is consistent with the theory, and a significant one sends the researcher back to check the cross or the counting.
In market research, the chi-square test of independence checks whether two categories are linked. Cross-tabulate age group against brand preference and test whether the pattern could be chance. If the result is significant, the brand really does appeal differently to different ages, and the marketing can be split accordingly. If not, the apparent pattern is noise.
In quality control and medicine, the test checks whether defect rates or side-effect rates differ across groups. A factory compares defect counts across three shifts; a trial compares side effects across treatment and control. A probability calculator handles single chances; the chi-square test handles whole tables of counts at once.
Chi-square vs t-test vs p-value: what is the difference?
These tests answer different questions, and picking the wrong one is the most common error in student projects. The chi-square test works on counts in categories — how many people chose each option, how many parts failed on each shift. The t-test works on means of measured numbers — average blood pressure, average test score. If your data is counts, use chi-square; if it is measurements with an average, use a t-test.
The p-value is not a test at all. It is the output that all these tests share: the probability of data this extreme if the null were true. A chi-square p-value of 0.03 and a t-test p-value of 0.03 mean the same thing in plain language — surprising under the null — but they come from different curves and different inputs. Never compare a chi-square statistic with a t-statistic; they live on different scales.
The critical value plays the same role in each test: it is the line your statistic must cross. For chi-square with 1 degree of freedom the line is 3.84; for a t-test with 10 degrees of freedom it is 2.23. An average calculator summarises the measurements a t-test would use, while the counts a chi-square test needs come straight from a tally.
Common chi-square mistakes
The first mistake is using chi-square on numbers that are not counts. Averages, percentages and rates do not belong in a chi-square test — the formula expects whole counts of things. Feeding it percentages gives a statistic that looks precise and means nothing. If your data is already a percentage, go back to the raw counts first.
The second mistake is small expected counts. The chi-square approximation breaks down when expected counts fall below 5 in a cell. With tiny expected numbers, the p-value is unreliable and the test can cry wolf. The fix is to combine small categories, collect more data, or use an exact test instead. Check the expected counts before you trust the p-value.
The third mistake is the wrong degrees of freedom. Forgetting the minus-one in a goodness-of-fit test, or multiplying rows by columns instead of (rows − 1) by (columns − 1), shifts the whole curve and can flip the verdict. Count the categories, apply the rule for your test type, and double-check it — this single number decides the answer.
The fourth mistake is reading a significant result as a big effect. Chi-square says the counts differ from expectation more than chance explains; it does not say by how much or why. A huge sample can make a trivial difference significant. Report the counts and the size of the gap alongside the p-value, so readers can judge whether the difference matters in practice.
How to use this chi-square calculator
Type your chi-square statistic into the first box — the number you worked out from observed and expected counts, or from your software output. Then type the degrees of freedom: categories minus one for a goodness-of-fit test, or (rows − 1) times (columns − 1) for a table. The p-value, the critical value at 0.05 and the verdict update live.
Read the verdict with the p-value beside it. If the statistic is above the critical value, the p-value is below 0.05 and the answer is Yes. If it is below, the answer is No. Borderline cases — a statistic just above or just below the line — deserve a second look at the counts before you claim anything.
Everything runs in your browser. No account, no upload, no data sent anywhere. Pair it with the percentage calculator when you want the shares behind your counts, and with the standard deviation calculator when your data is measurements rather than counts and a different test is the right tool.