Calculate Chi-Square

Compute Pearson’s chi-square statistic for an observed contingency table and compare it with a 5% critical value.

freeworks offlinenothing uploaded
ToolChi-Square Calculator
Input
Output
Put this on your own site

The frame below runs the same code as this page, in the reader's own browser. Nothing is sent to us, and nothing is sent to you.

Pick a dark background and the text and panels follow it, so the frame stays readable on a dark page.

Preview

How it works

Each expected cell is row total × column total ÷ grand total, and the statistic sums (observed − expected)² ÷ expected across all cells. Degrees of freedom are (rows − 1)(columns − 1); stored 5% critical values cover one through ten degrees, with a Wilson–Hilferty approximation above ten.

  • The significance level is fixed at 0.05.
  • The asymptotic comparison assumes independent count observations and sufficiently large expected cells.

Worked example

A 2 by 2 table
Each line is a row of observed counts
Input
											10 20,20 10
										
Output
												Chi square: 6.6667
Degrees of freedom: 1
Critical value05: 3.841
Significant: yes
Sample size: 60
											

When to use this

Survey tables test response by region, experiments compare outcome counts across treatments, and quality tables compare defect type by production line.

Edge cases

  • A row or column containing no observations makes expected cells zero and is rejected.
  • Small expected counts make the asymptotic chi-square comparison unreliable even when arithmetic succeeds.
  • Paired observations or continuous measurements do not satisfy the contingency-table structure.

References