Docelora
ToolsAboutContact
Statistics

Chi-Square Calculator

Test whether two categorical variables are related, whether observed counts match expected ones, or simply get the p-value for a chi-square statistic.

Quick answer: for the table [[20, 30], [30, 20]], χ² = 4.00 with 1 degree of freedom and p = 0.0455 – significant at the 5% level. A χ² of 3.84 with 1 df has p ≈ 0.05.

Chi-Square Calculator

Enter your figures and select Calculate. Everything is worked out in your browser.

Result
Formula / method: Expected count Eᵢⱼ = row total × column total ÷ grand total. χ² = Σ (O − E)² ÷ E. df = (rows − 1)(columns − 1), or categories − 1 for goodness of fit. p = upper tail of the χ² distribution.

How to use the calculator

1. Choose the testIndependence, goodness of fit, or p-value only.
2. Enter the countsRaw counts, not percentages.
3. Read the resultχ², degrees of freedom, p-value and effect size.

Assumptions

dfCritical χ² at 5%Critical χ² at 1%
13.8416.635
25.9919.210
37.81511.345
49.48813.277
511.07015.086

Related calculators

Frequently asked questions

What is a chi-square test?

A test for whether observed counts differ from those expected under a hypothesis.

What is a test of independence?

It tests whether two categorical variables are related, using a contingency table.

What is goodness of fit?

It tests whether one categorical variable follows an expected distribution.

How are degrees of freedom calculated?

(rows − 1) × (columns − 1) for independence; categories − 1 for goodness of fit.

Can I use percentages?

No – use actual counts.

What if expected counts are small?

Use Fisher’s exact test or combine categories.

What is Cramér’s V?

An effect size from 0 (no association) to 1 (perfect association).

What is the critical value for 1 df?

3.841 at the 5% level.

Does chi-square show causation?

No – only association.

What is Yates’ correction?

An adjustment for 2 × 2 tables; this calculator reports the uncorrected statistic.

How is the p-value calculated?

From the upper tail of the χ² distribution using the incomplete gamma function.

How large can the table be?

Any reasonable size.

Can expected counts be scaled?

Yes – in goodness of fit they are scaled to the observed total.

What does p < 0.05 mean?

The data would be unlikely if there were no association.

Is my information stored?

No. Everything is calculated in your browser.

Does it work on a phone?

Yes. The calculator is designed for mobile and desktop browsers.

Is it free?

Yes, with no sign-up.

Can I copy the result?

Yes – use the Copy result button.

Can I paste from a spreadsheet?

Yes – copied rows separated by tabs work.

Who developed the test?

Karl Pearson, in 1900.

Docelora calculators give estimates for general information and planning. They are not financial, tax, legal or medical advice. Check important figures with the official source or a qualified professional.

Last reviewed: 7 November 2026.