Test chi-square statistics for categorical data. Part of the DevTools Surf developer suite. Browse more tools in the Statistics collection.
Use Cases
Test whether two categorical variables are independent (e.g., gender vs product preference)
Verify that survey response distributions match expected demographics
Analyze A/B test results with categorical outcomes (clicked, not clicked)
Check whether dice or random number generators are producing fair outcomes
Tips
Enter your contingency table directly (rows = categories, columns = groups) — the tool computes expected frequencies and the chi-square statistic automatically
Check degrees of freedom in the output: (rows-1) * (columns-1). The critical value depends on both df and your significance level
Use the goodness-of-fit mode (one variable) when testing whether observed frequencies match an expected distribution, not independence between two variables
Fun Facts
The chi-square test was developed by Karl Pearson in 1900 and published in the Philosophical Magazine. It was one of the first formal statistical significance tests — predating t-tests, ANOVA, and most of modern statistics.
The chi-square distribution has an interesting property: it is the distribution of the sum of k squared standard normal variables. This mathematical fact links it directly to the normal distribution and underlies its widespread use.
In genetics, chi-square tests were used by early Mendelian geneticists to verify that observed inheritance ratios (3:1 for dominant traits) matched Mendel's predicted ratios — connecting statistics to biology before either field was fully formalized.
FAQ
When should I use chi-square vs a t-test?
Chi-square is for categorical data (counts in categories). T-tests are for continuous numerical data (means). If your outcome variable is 'clicked vs did not click' use chi-square; if it is 'time on page in seconds' use a t-test.
What is the minimum sample size for chi-square?
Each expected cell count should be at least 5. If any cell has expected count < 5, use Fisher's Exact Test instead. Very small samples make chi-square unreliable.
What does a p-value of 0.03 mean in a chi-square test?
There is a 3% probability of observing a chi-square statistic this large (or larger) if the two variables are truly independent. Below the conventional 5% threshold, we reject the null hypothesis of independence.