Chi-Square Test Calculator

Chi-Square Test Calculator

Test goodness of fit or independence between categorical variables.

Last updated: March 2026

χ² Statistic
2.0000
Degrees of Freedom
2
p-value
0.000e+0

Interpretation Guide: Chi-Square Critical Values

dfα = 0.10α = 0.05α = 0.01α = 0.001
12.713.846.6410.83
24.615.999.2113.82
36.257.8211.3516.27
47.789.4913.2818.47
59.2411.0715.0920.52

What is the Chi-Square Test?

The Chi-Square test is a statistical hypothesis test used to determine whether there is a significant association between categorical variables. It compares observed frequencies with expected frequencies under a null hypothesis of independence or goodness of fit.

The Chi-Square test has two main varieties: the Goodness of Fit test, which determines whether sample data follows an expected distribution, and the Test of Independence, which examines whether two categorical variables are independent of each other in a population.

The Chi-Square statistic (χ²) measures the discrepancy between observed and expected frequencies. A large χ² value suggests the variables are related or the data does not fit the expected distribution. The p-value indicates the probability of observing such a discrepancy by chance alone if the null hypothesis were true.

How to Use the Chi-Square Test

For Goodness of Fit Tests:

Step 1: Collect observed frequencies for each category
Step 2: Calculate or specify expected frequencies (usually based on a theoretical distribution)
Step 3: Calculate χ² = Σ((O - E)² / E) for each category
Step 4: Determine degrees of freedom (k - 1, where k = number of categories)
Step 5: Compare p-value to significance level (α = 0.05 typical)

For Tests of Independence:

Step 1: Organize data in a contingency table (rows × columns)
Step 2: Calculate row and column totals
Step 3: For each cell: E = (Row Total × Column Total) / Grand Total
Step 4: Calculate χ² = Σ((O - E)² / E)
Step 5: df = (rows - 1) × (columns - 1)

Assumptions:

  • Expected frequency in each cell should be ≥ 5
  • Data should be counts (frequencies), not percentages
  • Categories should be mutually exclusive
  • Sample should be random and representative

Example: Goodness of Fit Test

A fair die is rolled 60 times. Are the results consistent with a fair die?

Scenario:
For a fair die, each face should appear 10 times in 60 rolls (60 ÷ 6 = 10).
Observed:
8, 12, 9, 10, 11, 10 (total 60)
Expected:
10, 10, 10, 10, 10, 10
Calculation:
χ² = (8-10)²/10 + (12-10)²/10 + (9-10)²/10 + (10-10)²/10 + (11-10)²/10 + (10-10)²/10
χ² = 0.4 + 0.4 + 0.1 + 0 + 0.1 + 0 = 1.0
Interpretation:
With df = 5 and χ² = 1.0, the p-value is high (p ≈ 0.96), indicating no significant difference from a fair die.

Frequently Asked Questions

When should I use Chi-Square?

Use Chi-Square when testing hypotheses involving categorical data (e.g., colors, yes/no, categories). If your data is continuous (e.g., height, weight), use other tests like t-tests or ANOVA.

What's a 'significant' p-value?

Conventionally, p < 0.05 is considered statistically significant, suggesting the null hypothesis should be rejected. However, the threshold depends on your field and context.

What if expected frequencies are too low?

If any expected frequency is less than 5, the Chi-Square test may be unreliable. Consider combining categories or using Fisher's Exact Test for 2×2 tables.

What's the difference between the two tests?

Goodness of Fit tests one categorical variable against a theoretical distribution. Independence tests the relationship between two categorical variables in a cross-tabulation.

How do I interpret a high χ² value?

A high χ² value indicates a large discrepancy between observed and expected frequencies, suggesting either the variables are related (independence) or data doesn't fit the theoretical distribution (goodness of fit).

What are degrees of freedom?

For goodness of fit: df = k - 1 (number of categories - 1). For independence: df = (r - 1)(c - 1), reflecting how many values can vary freely given the constraints.

Related Tools