chi square test online calculator

Chi-Square Goodness-of-Fit Calculator

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

Use commas, spaces, or semicolons between values.
Must have the same number of categories as observed frequencies.

What this chi square test online calculator does

This page provides a simple, practical chi-square test calculator for the goodness-of-fit test. In plain English, it helps you answer this question: “Do my observed category counts differ from what I expected, beyond random chance?”

The calculator returns:

  • Chi-square statistic (χ²)
  • Degrees of freedom (df)
  • p-value
  • A decision at your chosen significance level (reject or fail to reject H₀)

When to use a chi-square goodness-of-fit test

Use this test when your data are counts in categories, such as:

  • Survey responses across choices (A, B, C, D)
  • Genetic inheritance counts by phenotype
  • Observed outcomes of a die, spinner, or lottery process
  • Customer selections across product categories

If you need to test association between two categorical variables in a contingency table, that is the chi-square test of independence, which is related but set up differently.

How to enter your data correctly

1) Observed frequencies

These are the actual counts from your data. Example: 18, 22, 25, 35

2) Expected frequencies

These are the counts you would expect under the null hypothesis. Example: 25, 25, 25, 25 for a uniform expectation across four categories.

3) Scaling option

If your expected frequencies do not sum to the same total as observed counts, the “scale expected frequencies” option will automatically adjust expected values proportionally. This is useful if your expected values come from ratios or probabilities converted to rough counts.

Formula used by the calculator

The chi-square goodness-of-fit test statistic is:

χ² = Σ ((Oᵢ - Eᵢ)² / Eᵢ)

where Oᵢ is observed frequency in category i and Eᵢ is expected frequency. Degrees of freedom are:

df = k - 1

where k is the number of categories.

How to interpret the result

  • Small p-value (typically < 0.05): evidence against the null hypothesis; observed pattern differs significantly from expected.
  • Large p-value: not enough evidence to say the observed pattern is different from expected.
  • The chi-square value itself has no universal “good” or “bad” threshold without df.

Assumptions and common mistakes

Key assumptions

  • Data are counts, not percentages entered directly as raw data.
  • Categories are mutually exclusive.
  • Observations are independent.
  • Expected counts are generally at least 5 in most categories.

Common mistakes

  • Mixing proportions and counts in the same input.
  • Using negative or zero expected frequencies.
  • Using this test for continuous data.
  • Forgetting that statistical significance is not always practical significance.

Quick worked example

Suppose a four-option poll should be evenly distributed under H₀ (25 each out of 100 total), but your observed counts are: 18, 22, 25, 35.

Enter those values and click Calculate Chi-Square. You will get χ², df = 3, and a p-value. If p < α (such as 0.05), reject H₀ and conclude the responses are not evenly distributed.

FAQ

Can I use decimals?

Yes, but in classical settings chi-square tests are based on count data and are usually integers.

What if expected totals do not match observed totals?

Keep the scaling option checked, and the calculator will normalize expected values to the observed total.

Is this calculator suitable for publication-grade analysis?

It is great for learning, quick checks, and exploratory work. For formal reporting, verify results in dedicated software and document assumptions.

🔗 Related Calculators