Chi-Square Test Calculator

Perform chi-square goodness-of-fit and independence tests online. Get χ² statistic, p-value, Cramér's V, expected frequencies, and standardized residuals.

Chi-Square Test Calculator

e.g. 30,20,50|45,35,20
χ² Statistic
19.9481
Chi-square test statistic with 2 degrees of freedom
p-Value
< 0.0001
Significant at α = 0.05
Degrees of Freedom
2
(r − 1)(c − 1)
Decision
Reject H₀
Variables are associated
Cramér\'s V
0.3158
Medium association
Total Observations
200
Sum of all observed frequencies

Observed Frequencies

Col 1Col 2Col 3Row Total
Row 1302050100
Row 2453520100
Col Total755570200

Expected Frequencies

Col 1Col 2Col 3
Row 137.5027.5035.00
Row 237.5027.5035.00

Standardized Residuals

Col 1Col 2Col 3
Row 1-1.225-1.4302.535
Row 21.2251.430-2.535
Planning notes, formulas, and examples

About the Chi-Square Test Calculator

The chi-square test is one of the most widely used statistical tests for categorical data. It comes in two main flavors: the goodness-of-fit test, which checks whether observed frequencies match an expected distribution, and the test of independence, which determines whether two categorical variables are associated in a contingency table.

This calculator handles both test types. For goodness of fit, enter your observed and expected frequencies. For independence, enter your contingency table data. The calculator returns the χ² statistic, p-value, degrees of freedom, Cramér's V effect size, expected frequencies, standardized residuals, and a clear accept/reject decision.

Chi-square tests appear everywhere: testing whether a die is fair, checking if genetics follow Mendelian ratios, analyzing survey cross-tabulations, evaluating A/B test results with categorical outcomes, and assessing whether customer preferences differ across demographic groups. Use the example to compare goodness-of-fit and independence setups, and check which cells contribute most through the residuals.

When This Page Helps

Computing chi-square by hand involves squaring differences between observed and expected frequencies for every cell, summing them, looking up critical values in a table, and manually assessing significance. This calculator does it quickly for any table size, plus computes Cramér's V effect size and standardized residuals to identify which cells deviate most. It eliminates errors and lets you focus on interpreting the results.

How to Use the Inputs

  1. Select your test type: Goodness of Fit or Test of Independence.
  2. For goodness of fit: enter observed frequencies and expected frequencies (comma-separated), or use a preset.
  3. For independence: enter the number of rows and columns, then the table data (rows separated by |).
  4. Set your significance level alpha.
  5. Review the χ² statistic, p-value, and decision.
  6. Examine expected frequencies and standardized residuals to see which cells drive the result.
  7. Check Cramér's V to assess the strength of association (independence test).
Formula used
Chi-Square Statistic: χ² = Σ (Oᵢ − Eᵢ)² / Eᵢ Degrees of Freedom: Goodness of Fit: df = k − 1 Independence: df = (r − 1)(c − 1) Expected Frequency (Independence): Eᵢⱼ = (Row Total × Col Total) / Grand Total Cramér's V: V = √(χ² / (n × min(r−1, c−1))) Standardized Residual: e = (O − E) / √E

Example Calculation

Result: χ²(2) = 16.8269, p = 0.0002

A 2×3 contingency table with 200 total observations yields a chi-square statistic of 16.83 with 2 degrees of freedom. The p-value of 0.0002 is far below 0.05, indicating a significant association between the row and column variables. Cramér's V = 0.29, suggesting a medium effect size.

Tips & Best Practices

  • All expected frequencies should be at least 5 for the chi-square approximation to be reliable. If any expected count is below 5, consider Fisher's exact test.
  • Standardized residuals exceeding ±2 indicate cells that deviate substantially from expectation — these drive the significant result.
  • Chi-square tests are always right-tailed: large χ² values indicate poor fit or strong association.
  • Cramér's V ranges from 0 (no association) to 1 (perfect association). Cohen's benchmarks: 0.1 small, 0.3 medium, 0.5 large.
  • For 2×2 tables, Yates' continuity correction is sometimes applied to improve the chi-square approximation.
  • Chi-square tests require data in frequency counts, not proportions or percentages. Convert before entering.

Chi-Square Goodness of Fit in Practice

The goodness-of-fit test is the go-to method for checking whether observed data matches an expected probability distribution. Geneticists use it to verify Mendelian ratios (e.g., 9:3:3:1 in dihybrid crosses), quality engineers check if defect counts follow Poisson distributions, and pollsters verify if demographic samples match census proportions.

Understanding the Contingency Table

In a test of independence, each cell of the contingency table represents the frequency of a specific combination of categories. Expected frequencies are computed under the assumption of independence: E = (row total × column total) / grand total. Large deviations between observed and expected values in specific cells drive the chi-square statistic upward. Standardized residuals help pinpoint exactly which combinations are surprising.

Assumptions and Limitations

Chi-square tests assume independent observations (each subject contributes to exactly one cell), adequate expected frequencies (usually ≥ 5 in each cell), and a fixed total sample size. Violating these can lead to unreliable p-values. For matched or paired data, use McNemar's test. For tables with small expected counts, Fisher's exact test is more appropriate.

Sources & Methodology

Last updated:

Frequently Asked Questions

  • Goodness of fit compares one categorical variable's observed distribution against a theoretical expected distribution. Independence tests whether two categorical variables are related in a contingency table. Both use the same χ² formula but differ in degrees of freedom and interpretation.