Chi-Square Test Calculator

StatisticsLast updated: August 17, 2026

The chi-square (χ²) test of independence, developed by Karl Pearson, is a nonparametric hypothesis test that checks whether there is a statistically significant association between two categorical variables. The observed frequencies in a contingency table are compared with the expected frequencies that would arise if the variables were independent; the larger the gap, the larger χ² becomes and the weaker the independence hypothesis gets.

From a contingency table in which you paste one group's (category's) frequencies per line, this calculator returns the χ² statistic, the degrees of freedom, the p-value, and the Cramér V coefficient that expresses the strength of the association. It also produces the expected frequency table and warns you if any expected frequency falls below 5. It is built for researchers analyzing survey and thesis data.

Write each row of the contingency table on its own line; separate the cell frequencies with commas or spaces. At least 2 rows and 2 columns are required.

Formula

Expected frequency: E = (Row Total × Column Total) / N
χ² = Σ (Observed − Expected)² / Expected
Degrees of freedom: df = (number of rows − 1) × (number of columns − 1)
Cramér V = √( χ² / (N × min(rows − 1, columns − 1)) )

The most common mistake is entering percentages or means in the cells instead of frequencies (counts); chi-square applies to counts only. The test also loses its reliability when more than 20% of the cells have an expected frequency below 5.

How to Calculate

  1. Write each row of your contingency table on its own line in the box; separate the cell frequencies with commas or spaces.
  2. Press Calculate: χ², the degrees of freedom, the p-value, and Cramér V are computed instantly.
  3. Review the expected frequency table; the calculator warns you if any expected frequency is below 5.
  4. Decide from the p-value: if p < 0.05 there is a significant association between the variables.
  5. Use the ready-made finding sentence in the interpretation line (χ², df, N, p, V) in the results section of your thesis.

Worked Examples

Gender and product preference (2x2)

In a sample of 100 people, 30 women chose product A and 20 chose B, while 20 men chose A and 30 chose B. The result: χ²(1, N = 100) = 4.00, p = 0.046, Cramér V = 0.20 (a weak association). Every expected frequency is 25.00, so the conditions of the test are met; because p < 0.05, there is a significant association between gender and product preference.

Chi-square statistic (χ²): 4.000 · Degrees of freedom (df): 1 · p-value (two-tailed): p = 0.046

Education level and smoking (3x2)

Entering the smoker/non-smoker frequencies for three education levels (a total of N = 150) gives χ²(2, N = 150) = 9.38, p = 0.009, V = 0.25. Because p < 0.05, education level and smoking are associated; by Cramér V the association is weak.

Chi-square statistic (χ²): 9.375 · Degrees of freedom (df): 2 · p-value (two-tailed): p = 0.009

A non-significant result (2x3)

When two groups are spread almost evenly across three categories, the test comes out non-significant: χ²(2, N = 120) = 0.35, p = 0.840, V = 0.05. Because p ≥ 0.05, the independence hypothesis cannot be rejected; no association was found between the variables.

Chi-square statistic (χ²): 0.349 · Degrees of freedom (df): 2 · p-value (two-tailed): p = 0.840

Frequently Asked Questions

What kind of data is the chi-square test for?
It applies only to categorical (nominal or ordinal) variables and to frequency (count) data. What is analyzed is the number of people falling into categories such as gender, occupational group, or yes/no answers. For continuous variables such as age, income, or test scores, use a t-test, ANOVA, or correlation analysis instead.
What should I do if an expected frequency is below 5?
There are three options: merge similar categories to reduce the number of cells, enlarge the sample, or use Fisher's exact test instead of chi-square for 2x2 tables. The common rule is that cells with an expected frequency below 5 must not exceed 20% of all cells, and no cell may fall below 1.
How is a chi-square result reported in APA format?
The standard notation is χ²(df, N = total) = value, p = ..., V = ...; for example χ²(1, N = 100) = 4.00, p = 0.046, V = 0.20. The interpretation line of this calculator produces that sentence automatically. Reporting the effect size (Cramér V) alongside the p-value is the current APA recommendation.
What is Cramér V and how is it interpreted?
Cramér V is the effect size that measures the strength of the association in a chi-square test on a scale from 0 to 1. The common thresholds are: below 0.10 negligible, 0.10 to 0.29 weak, 0.30 to 0.49 moderate, and 0.50 and above strong. Because even tiny differences can come out significant in large samples, the p-value alone is not enough; V should always be reported with it.
What is the difference between the test of independence and the goodness-of-fit test?
The test of independence uses a contingency table to check whether two categorical variables measured on the same sample are associated; that is the test this calculator computes. The goodness-of-fit test examines whether the observed distribution of a single variable matches a theoretical one (a uniform distribution, for instance). The test of homogeneity checks whether a distribution is the same across different populations; its computation is identical to the test of independence.
Can chi-square be used for repeated measures (before and after)?
No. The chi-square test of independence requires each participant to be counted in exactly one cell. If the same people were measured twice (their opinion before and after a training, for example), use McNemar's test for a 2x2 design. If the independence of observations is violated, the p-value is invalid.