Chi-Square Calculator

Calculate chi-square statistics, p-values, and test significance instantly

Open Chi-Square Calculator

What is the Chi-Square Test?

The chi-square (X²) test is a statistical test used to determine if there is a significant association between two categorical variables. It compares observed frequencies in a contingency table to the frequencies we would expect if there were no association.

Chi-Square Formula

X² = Σ (O - E)² / E

Where O = observed frequency and E = expected frequency

When to Use Chi-Square Test

Chi-Square Test Assumptions

  1. Random sampling from the population
  2. Categorical (nominal or ordinal) data
  3. Expected frequency in each cell should be at least 5
  4. Observations are independent

For a full discussion of each assumption and what to do when they're violated, see the Assumptions guide.

Example

A researcher wants to test if there's an association between smoking status and lung disease. They collect data from 200 patients:

Using CrossTabs.com, upload your data and select the row and column variables. The calculator instantly provides X², degrees of freedom, and p-value.

Interpreting Results

P-value < 0.05: There is a statistically significant association between the variables (reject null hypothesis)

P-value ≥ 0.05: No significant association found (fail to reject null hypothesis)

For a detailed step-by-step interpretation workflow, see Interpreting Results.

Effect Sizes for Chi-Square

CrossTabs.com automatically calculates effect sizes. Learn more about bias-corrected Cramér's V and all available effect size measures:

Try the Chi-Square Calculator

CrossTabs.com offers a full-featured free chi-square calculator online:

Start Calculating

Step-by-Step Example

Suppose you're testing whether a new drug is associated with recovery. You survey 120 patients. (For the full mathematical derivation, see the Chi-Square Test documentation.)

RecoveredNot RecoveredTotal
Drug402060
Placebo253560
Total6555120

Step 1: Calculate expected frequencies. For the Drug + Recovered cell: E = (60 × 65) / 120 = 32.5. Repeat for all cells.

Step 2: Compute χ². χ² = (40−32.5)²/32.5 + (20−27.5)²/27.5 + (25−32.5)²/32.5 + (35−27.5)²/27.5 = 1.73 + 2.05 + 1.73 + 2.05 = 7.56

Step 3: Find the p-value. With df = 1, χ² = 7.56 gives p = 0.006. Since p < 0.05, the association is statistically significant.

Step 4: Report effect size. Cramér's V = √(7.56/120) = 0.25 (small-to-medium effect).

Common Mistakes to Avoid

When to Use Chi-Square vs. Other Tests

Your DataRecommended Test
Two categorical variables, all expected counts ≥ 5Chi-square test (this calculator)
Any expected count < 5 or small sampleFisher's exact test
Paired/matched categorical dataMcNemar's test
Need to quantify the strength of associationCramér's V or odds ratio
Ordinal categoriesGamma or Kendall's tau
Need to determine sample size before collecting dataPower analysis

Frequently Asked Questions

What p-value is significant for chi-square?

A p-value less than 0.05 is the conventional threshold for statistical significance. However, you should also report the effect size (such as Cramér's V) because large samples can produce significant p-values even for trivially small associations.

How do I calculate degrees of freedom?

Degrees of freedom (df) for a chi-square test of independence equal (number of rows − 1) × (number of columns − 1). For a 2×2 table, df = 1. For a 3×4 table, df = 6.

What's the difference between chi-square and Fisher's exact test?

Chi-square uses a large-sample approximation to calculate p-values, while Fisher's exact test computes the exact probability. Use Fisher's exact test when any expected cell count is below 5 or the total sample size is less than 20. See the assumptions guide for details.