Chi-Square Calculator

Independence Test Goodness of Fit Cramér’s V Free · No Signup

Free online chi-square calculator for test of independence and goodness of fit. Compute chi-square statistic, expected frequencies, p-value, degrees of freedom, critical value, and Cramér’s V with interactive distribution chart and Python scipy export.

Chi-Square Test
Enter observed frequencies in each cell

Result

📊

Enter data and click Calculate

Compute chi-square statistic, p-value, degrees of freedom, and effect size.

Chi-Square Distribution

Python Compiler

What Is a Chi-Square Test?

A chi-square test (χ²) is a statistical hypothesis test used to determine whether there is a significant association between categorical variables or whether observed frequencies differ from expected frequencies. It is one of the most widely used non-parametric tests in statistics.

Observed (O) 30 20 10 40 vs Expected (E) 24 26 16 34
📊

Categorical Analysis

Analyze relationships between categorical variables such as gender, preference, treatment group, or survey response.

🔄

Expected vs Observed

Compare what you observed in your data against what you would expect under the null hypothesis of no association.

Statistical Significance

Determine if the difference between observed and expected frequencies is large enough to reject the null hypothesis.

Chi-Square Formula

Chi-Square Statistic:  χ² = Σ (O − E)² / E
Expected Frequency (Independence):  Eij = (Row Totali × Column Totalj) / Grand Total
Degrees of Freedom (Independence):  df = (r − 1)(c − 1)
Degrees of Freedom (Goodness of Fit):  df = k − 1  (k = number of categories)
Worked Example: Gender & Product Preference (2×2 contingency table)
Observed: [[30, 10], [20, 40]]   Grand Total = 100
E11 = (40 × 50) / 100 = 20,   E12 = (40 × 50) / 100 = 20
E21 = (60 × 50) / 100 = 30,   E22 = (60 × 50) / 100 = 30
χ² = (30−20)²/20 + (10−20)²/20 + (20−30)²/30 + (40−30)²/30 = 5 + 5 + 3.33 + 3.33 = 16.67
df = (2−1)(2−1) = 1,   p-value < 0.001 → Reject H₀

Interpreting Results

❌ Reject H₀

When p-value < α, the observed frequencies differ significantly from expected. There is a statistically significant association between the variables.

✅ Fail to Reject H₀

When p-value ≥ α, there is insufficient evidence to conclude an association. The observed differences could be due to chance.

📏 Effect Size (Cramér’s V)

Measures strength of association: V ≈ 0.1 is small, V ≈ 0.3 is medium, and V ≥ 0.5 indicates a large effect size.

🎯 Practical Significance

A statistically significant result may not be practically meaningful. Always consider effect size, sample size, and real-world context alongside the p-value.

Assumptions & Limitations

Tip: When expected frequencies are too small (especially in 2×2 tables), use Fisher’s exact test instead. For ordinal data with a natural ordering, consider the Cochran-Armitage trend test.

Applications

FieldExample Use Case
MedicineTest whether treatment outcome is associated with patient group
MarketingAnalyze if product preference differs by demographic segment
GeneticsTest if observed genotype ratios match Mendelian expected ratios
EducationDetermine if pass/fail rates differ across teaching methods
Quality ControlCheck if defect rates are independent of production line
Social SciencesExamine if voting preference is related to age group or region

Frequently Asked Questions

Use a chi-square test of independence to check if two categorical variables are associated. Use a goodness of fit test to determine if observed frequencies match an expected distribution, such as equal proportions or Mendelian ratios.
For independence tests, the expected frequency equals row total times column total divided by the grand total. For goodness of fit, it is the total count times the hypothesized proportion for each category.
Cramér’s V measures the strength of association between categorical variables, ranging from 0 (no association) to 1 (perfect association). Values around 0.1 are considered small, 0.3 medium, and 0.5 or above large effect sizes.
The rule of thumb is that expected frequencies should be at least 5 in 80% of cells and no cell should have an expected frequency below 1. With very small expected counts, consider Fisher’s exact test instead.
No, chi-square tests are for categorical or count data only. For continuous data, use t-tests, ANOVA, or correlation. You can bin continuous data into categories, but this loses information.
Standard chi-square tests handle two variables. For three or more variables, use log-linear models or stratified analysis like the Cochran-Mantel-Haenszel test.

Support This Free Tool

Every coffee helps keep the servers running. Every book sale funds the next tool I'm dreaming up. You're not just supporting a site — you're helping me build what developers actually need.

500K+ users
200+ tools
100% private
Privacy Guarantee: Private keys you enter or generate are never stored on our servers. All tools are served over HTTPS.