Calculator Tools
Chi-Square Test Calculator
Run chi-square tests on raw data. Get the statistic, degrees of freedom, p-value, expected counts, residuals, Cramer's V effect size, and a distribution plot.
Test mode
Enter a contingency table of observed counts. The test asks whether the rows and columns are independent. Used for survey cross-tabs, A/B tests with categorical outcomes, and medical 2x2 tables.
Observed counts
Fill the cells with the number of observations. Use the label fields to name your rows and columns: those names show up in the breakdown and the copied report.
| Empty corner | ||
|---|---|---|
Rows
2 / 6Columns
2 / 6Examples
Load a textbook or real-world scenario. Replaces the current data for its mode.
Result
Chi-square (χ²)
5.769231
Degrees of freedom
1
p-value
0.0163092
1.6309% of the chi-square distribution lies above the observed statistic.
Alpha = 0.10
Reject H₀
Alpha = 0.05
Reject H₀
Alpha = 0.01
Fail to reject H₀
Phi (φ)
0.2402
Effect size for 2x2 tables. |φ| = sqrt(χ² / N).
Cramer's V
0.2402 (Small)
Effect size for any R x C table. Ranges 0 to 1.
Contingency coefficient
0.2335
Pearson's C. Sensitive to table size, ranges 0 to <1.
With χ² = 5.7692 on 1 degree(s) of freedom, the p-value is about 0.0163092. At α = 0.05 we reject independence: rows and columns appear to be associated. Cramer's V = 0.2402 (small effect).
Expected counts
Eᵢⱼ = (row total × column total) / grand total.
| Yes | No | Total | |
|---|---|---|---|
| Group A | 24 | 26 | 50 |
| Group B | 24 | 26 | 50 |
| Total | 48 | 52 | 100 |
Standardized residuals
zᵢⱼ = (O - E) / sqrt(E(1 - row p)(1 - col p)). Cells outside ±2 are large contributors to the chi-square statistic.
| Yes | No | |
|---|---|---|
| Group A | 2.4 | -2.4 |
| Group B | -2.4 | 2.4 |
How to use
- Pick a mode: Independence for an R x C contingency table of observed counts, or Goodness of fit for a single list of observed counts vs a hypothesized distribution.
- Independence: type observed counts into the table. Rename rows and columns to match your variables. Use Add row, Remove row, Add column, Remove column to resize the table (2 to 6 in each direction).
- Goodness of fit: enter one row per category, the observed count, and either the hypothesized probability (decimal, percent, fraction, or ratio) or the expected count. Add or remove categories with the row controls.
- Read the chi-square statistic, degrees of freedom, p-value, percent of distribution above the observed statistic, decision verdicts at alpha 0.10, 0.05, 0.01, and (Independence only) the phi, Cramer's V, and contingency coefficient effect sizes.
- Check the expected-counts and residuals tables. Cells with |residual| above 2 are highlighted: positive means observed exceeds expected, negative means observed falls short.
- Use the example chips to load classic scenarios (treatment vs control, Mendelian 9:3:3:1, fair die, voter share vs poll), or Copy summary or Copy full report to paste the results into homework, a spreadsheet, or a launch doc.
About this tool
Chi-Square Test Calculator runs both standard chi-square tests directly on raw data, not just on a precomputed statistic. Pick Independence (R x C) to test whether two categorical variables are associated (treatment vs outcome, gender vs preference, region vs channel, A/B variant vs conversion bucket), or Goodness of fit to test whether observed counts come from a hypothesized distribution (a fair die, Mendelian ratios, voter share vs poll, channel mix vs forecast). For Independence, type observed counts into a contingency table up to 6 x 6, add or remove rows and columns on the fly, and the page returns the chi-square statistic, the degrees of freedom (R - 1)(C - 1), the upper-tail p-value, the table of expected frequencies (row total times column total divided by grand total), the Pearson residuals (O - E) / sqrt(E), the standardized residuals corrected for marginal proportions (cells outside +/- 2 are highlighted as large contributors), and three effect-size measures: phi for 2 x 2 tables, Cramer's V for any R x C table with a qualitative small/medium/large label, and the contingency coefficient. For Goodness of fit, enter observed counts in 2 to 20 categories and pick how to specify the hypothesized distribution: Probability / ratio accepts decimals, percents, fractions, and integer ratios (a 9, 3, 3, 1 Mendelian ratio just works), while Expected count accepts raw expected frequencies and rescales them to the observed total before the test runs. Either way you get the chi-square statistic, df = categories - 1, the p-value, a per-category breakdown with O - E, (O - E)^2 / E, and Pearson residual, and a flag on cells whose residual exceeds 2. Both modes share a live SVG chi-square distribution plot for the matching df with the upper tail shaded and the observed statistic marked, decision verdicts at alpha 0.10, 0.05, and 0.01, a plain-English interpretation, and a sample-size warning if more than zero expected cells fall below 5 (the rule of thumb where the chi-square approximation gets unreliable and an exact test is preferred). The numerics use the regularized lower incomplete gamma function with series expansion for x below a + 1 and continued fraction otherwise, backed by the Lanczos log-gamma approximation. This gives roughly 1e-9 accuracy in the useful range, with values below 1e-7 reported as < 1e-7 so the displayed precision is never overstated. Everything runs locally in your browser, so the counts you type for class, work, or research stay on your device. Useful for AP Statistics and college statistics homework, A/B test analysis when the outcome is categorical (not just a proportion), survey cross-tabs, medical 2 x 2 tables with treatment vs control vs outcome, quality control with defect categories, biology dihybrid crosses, channel-mix sanity checks against a forecast, and any time you have observed counts and need a defensible significance decision. Pair this tool with the P-Value Calculator when you only have a chi-square statistic in hand, with the Binomial Distribution Calculator when there are two outcomes and a fixed sample size, with the Poisson Distribution Calculator for rare-event count data, or with the Confidence Interval Calculator when you also want an interval estimate.
Free to use. Works in your browser. No signup, no login.
Related tools
You may also like
P-Value Calculator
p-values for z, t, chi-square, and F tests with one-tailed or two-tailed regions.
Open tool
CalculatorBinomial Distribution Calculator
Binomial PMF and CDF for n trials at success probability p, with a live bar chart.
Open tool
CalculatorPoisson Distribution Calculator
Poisson PMF and CDF for rate lambda, with a live bar chart and full moments.
Open tool
CalculatorNormal Distribution Calculator
Bell curve probability calculator with P(X<a), P(X>a), P(a<X<b), and inverse normal.
Open tool
CalculatorConfidence Interval Calculator
Build a confidence interval for a mean, a proportion, or a dataset with full working.
Open tool
CalculatorA/B Test Significance Calculator
Two-proportion z-test for A/B and split tests with p-value, lift, and confidence interval.
Open tool