Free to use No registration 100% private Instant results Metric & Imperial

Chi-Square Test Calculator

Test whether two categorical variables are related with a chi-square test of independence. Enter the observed counts in a contingency table; the calculator computes the chi-square statistic, expected counts, degrees of freedom, and the exact p-value — no table lookups.

Contingency Table

The Chi-Square Statistic

For each cell, compare what you observed with what independence predicts:

E = (row total × column total) ÷ grand total
χ² = Σ (O − E)² / E

Degrees of freedom are (rows − 1) × (columns − 1). The p-value comes from the chi-square distribution with that df — the probability of seeing a statistic this extreme if the variables were truly independent. This calculator evaluates it directly via the incomplete gamma function, so you get an exact p-value for any df, not just the classic table values.

Critical Values at a Glance

dfCritical χ² (α=0.05)Common Use

Critical values are the 5% upper-tail cutoffs of the chi-square distribution for each df. df = (rows − 1) × (columns − 1).

How to Use This Calculator (3 Steps)

1
Set the table dimensions
Choose rows and columns for your two categorical variables. A 2×2 table covers classic A/B tests; larger tables work for surveys with more categories.
2
Enter observed counts
Type the raw counts (not percentages) in every cell. Expected counts are computed for you and shown in the results.
3
Read the verdict
p < 0.05 means association. Check the expected counts first: if many cells fall below 5, consider Fisher's exact test instead.

Case Study

📊
Case Study #1

Did the New Landing Page Lift Conversions?

A marketer runs an A/B test: 100 visitors see the old page and 100 see the new page. They track clicks versus no-clicks and run a chi-square test of independence.

Chi-Square
4.800
df
1
p-value
0.028
Critical (0.05)
3.841

Frequently Asked Questions

What is the chi-square test of independence?

It tests whether two categorical variables are related by comparing observed counts with independence-expected counts.

How do I calculate the chi-square statistic?

E = row×col÷grand per cell, then sum (O−E)²/E. A 2×2 [[45,55],[30,70]] table gives 4.8 with 1 df.

What does the p-value mean?

Probability of a statistic this extreme under independence. p < 0.05 is the usual significance threshold.

What are the assumptions?

Counts (not percentages), independent observations, expected counts ≥ 5 in most cells. Otherwise use Fisher's exact.

What is the critical value of chi-square?

The 5% upper-tail cutoff per df: 1 df → 3.841, 2 df → 5.991, 4 df → 9.488.

B
BuildFormulas Statistics Team
Statistical Methods

The BuildFormulas Statistics Team builds statistical test calculators using exact numerical methods (incomplete gamma and beta functions), following standard hypothesis-testing practice.

Reviewed by BuildFormulas Editorial Review Board, Editorial Review
Last updated: August 2026