← Math & statistics

Statistics Inference

Chi-Square Test Calculator

Other languages English | 繁體中文 | 한국어 | Italiano | فارسی

Run chi-square goodness-of-fit and independence tests from observed counts. Review expected counts, per-cell contributions, warnings for small expected values, and Cramer's V without leaving your browser.

Use this general page when you need a flexible chi-square workflow. If you are testing classic genetics ratios such as 3:1 or 9:3:3:1, the Mendelian page below stays more specialized.

How to use

  1. Choose goodness-of-fit if one sample is compared with an expected ratio, or independence if you have a contingency table.
  2. Enter observed counts, keep alpha at the default if you want a standard 5% threshold, and load an example if you want a quick starting point.
  3. Press Run test or leave auto update on. Then review expected counts, χ², p-value, and the warnings together before interpreting the result.

Goodness-of-fit and independence in one page

Use one page for two chi-square workflows: goodness-of-fit, independence tests, optional Yates correction for 2×2 tables, expected-count warnings, and browser-side result copying.

Goodness-of-fit inputs

Enter one row per category: observed count plus the expected weight used to build the expected distribution.

Category Observed Expected weight Actions
Paste rows (optional)

Paste label, observed, expected weight or observed, expected weight. One row per line.

What the page computes

  1. Expected counts use N × (expected weight / total expected weight). Total N = 60.
  2. χ² = Σ (O − E)² / E = 2.1.
  3. Degrees of freedom = k − 1 = 2.
  4. Upper-tail p-value = 0.349938.

Detailed breakdown

CategoryObservedExpectedResidualContribution
Category 124200.89440.8
Category 221200.22360.05
Category 31520-1.1181.25

How to interpret the result

FAQ

When should I use goodness-of-fit versus independence?

Use goodness-of-fit when one sample is compared with a known ratio or expected distribution. Use independence when you have a contingency table and want to test whether rows and columns are associated.

What does the warning about small expected counts mean?

Chi-square tests rely on an approximation that can weaken when expected counts are very small. This page flags expected counts below 5 and below 1 so you know when the p-value should be treated more cautiously.

Does this calculator include Fisher's exact test?

No. This page focuses on chi-square workflows only. For very small 2×2 tables, consider an exact test in specialist software.

How is Cramer's V shown?

Cramer's V appears for independence tables only. It rescales chi-square by sample size and the smaller table dimension, which makes it easier to compare association strength across tables.

Does the share URL include my counts?

No. The share URL stores only lightweight page settings such as mode, alpha, Yates correction, and table size. Entered counts stay in your browser.

What to compare next

If you are still deciding how much data to collect, start with the sample-size calculator before using this page. If you need a specialized genetics workflow with ratio presets and domain-specific examples, switch to the Mendelian page. If you want mean-based hypothesis tests instead, move to the t-test page. For general context on p-values and distributions, the pages below are the most direct next steps.

Comments (optional)

To reduce load, comments are fetched only when needed.