Chi Square Calculator

Enter observed and expected counts to instantly compute the chi-square statistic, degrees of freedom, and p-value.

χ² = Σ (O − E)² ÷ E, added up over every cell.

Use the Chi Square Calculator

Test Configuration

Leave Expected blank to assume equal distribution.

Enter your data and click Calculate to see results.

Copied!

Quick answer

χ² = Σ (O − E)² ÷ E, added up over every cell. Degrees of freedom are categories − 1 for a goodness-of-fit test and (rows − 1) × (columns − 1) for a contingency table, and the p-value is the upper-tail chi-square probability. Getting 60 heads in 100 coin flips gives χ² = 4.0000 with 1 df and p = 0.0455, which is significant at 0.05.

Examples

Observedχ² (df)p-value
Coin 60, 404.0000 (1)0.0455
Die 8,9,12,11,6,144.2000 (5)0.5210
Die 30,10,10,10,10,2023.3333 (5)0.0003
Mendel 9:3:3:10.4700 (3)0.9254
2×2: 20,30/30,204.0000 (1)0.0455
2×3: 10,20,30/20,20,205.3333 (2)0.0695

Enter your observed counts and click Calculate χ².

Summary

This chi-square calculator computes the χ² statistic and its associated p-value from your observed and expected frequency counts. It supports both goodness-of-fit tests (one row of categories) and contingency-table independence tests (multiple rows and columns). Click Calculate to update the results and see a clear interpretation of statistical significance.

How it works

  1. Choose between Goodness-of-Fit or Independence (contingency table) mode.
  2. Enter the number of categories or table dimensions.
  3. Fill in your observed counts (and expected counts for goodness-of-fit).
  4. The calculator computes χ² = Σ (O − E)² / E across all cells.
  5. Degrees of freedom are calculated automatically from your table size.
  6. The p-value is derived from the chi-square cumulative distribution function.

Use cases

  • Test whether a die is fair by comparing rolled outcomes to expected uniform distribution.
  • Analyze survey responses to check if preferences differ by demographic group.
  • Validate genetics experiments against expected Mendelian ratios.
  • Check whether website conversion rates are independent of traffic source.
  • Assess whether observed frequency data fits a theoretical distribution.
  • Quality-control checks on manufacturing defect rates across production lines.

Frequently Asked Questions

Last updated: 2026-06-04 · Reviewed by Nham Vu