Chi-Square Calculator

This free chi square calculator runs a chi-square test of independence on any contingency table up to 12 × 12, a chi-square goodness-of-fit test against equal, custom-count or ratio expectations (like 9:3:3:1), and finds the p-value from a chi-square statistic or the critical value for any df and α. You get χ², degrees of freedom, the p-value, a reject or fail-to-reject decision, a table of expected counts with each cell’s contribution and adjusted residual, Cramér’s V, a Yates correction and Fisher exact p-value for 2 × 2 tables, a shaded chi-square curve, full step-by-step working and the exact TI-84 keystrokes for χ²-Test and χ²GOF-Test.

Contents

How to Use the Chi-Square Calculator

  1. Pick the test. Test of independence for a two-way table, Goodness of fit for one list of counts, or P-value / critical value if you already have χ² and df.
  2. Enter counts. For a table, type one row per line with columns separated by spaces, commas or tabs. You can paste a block straight from Excel or Google Sheets. For goodness of fit, list the observed counts and choose equal expected values, expected counts, or proportions, percentages or a ratio.
  3. Choose α. Type any significance level or tap 0.10, 0.05, 0.025, 0.01 or 0.001.
  4. Read the answer. The results update as you type: p-value, χ², df, critical value, the decision, an expected-count table with a heat map of contributions, and the TI-84 steps. Copy share link saves your exact inputs in the URL.

Chi-Square Formula and Degrees of Freedom

Every chi-square test compares observed counts O with the counts E you would expect if the null hypothesis were true:

χ² = Σ (O − E)² / E

TestExpected count EDegrees of freedomH₀
Goodness of fitEi = n × pik − 1The data follow the stated distribution
Independence / homogeneityEij = (row total × column total) / n(r − 1)(c − 1)The two variables are independent

The p-value is the right-tail area P(χ²df ≥ your χ²). Chi-square tests are always right-tailed, because any mismatch between O and E makes χ² bigger.

Chi-Square Goodness-of-Fit Test (Worked Example)

Is a die fair? It is rolled 60 times and gives 8, 9, 19, 5, 8 and 11 for faces 1–6. If it is fair, each face is expected 60 / 6 = 10 times.

Face123456
Observed O89195811
Expected E101010101010
(O − E)²/E0.40.18.12.50.40.1

χ² = 0.4 + 0.1 + 8.1 + 2.5 + 0.4 + 0.1 = 11.6 with df = 6 − 1 = 5. The p-value is P(χ²5 ≥ 11.6) = 0.0407. Because 0.0407 ≤ 0.05 (and 11.6 > the critical value 11.070), we reject H₀: there is evidence the die is not fair. Face 3 contributes most of the statistic.

Ratio example (Mendel’s peas): observed 315, 108, 101, 32 against a 9:3:3:1 ratio. Expected counts are 312.75, 104.25, 104.25 and 34.75, so χ² = 0.470, df = 3, p = 0.9254. We fail to reject H₀; the data fit the 9:3:3:1 ratio well. Tap Mendel 9:3:3:1 example in the calculator to see it.

Chi-Square Test of Independence (Worked Example)

A survey asks 395 people (two groups) which of four options they prefer:

ABCDTotal
Group 160544641201
Group 240445357194
Total100989998395
  1. Expected counts: E = row total × column total / n. For Group 1, A: 201 × 100 / 395 = 50.886.
  2. Contribution: (60 − 50.886)² / 50.886 = 1.632. Repeat for all 8 cells.
  3. Add them: χ² = 8.006, df = (2 − 1)(4 − 1) = 3.
  4. P-value: P(χ²3 ≥ 8.006) = 0.0459, below α = 0.05, so reject H₀: preference is associated with group.
  5. Strength: Cramér’s V = √(8.006 / (395 × 1)) = 0.142, a small association.

This is the default example in the calculator, so you can check each cell’s expected count and adjusted residual there. The same test is called the chi-square test of homogeneity when the rows are separate samples; the arithmetic is identical.

How to Find the P-Value from a Chi-Square Statistic

Already have the statistic? Open the P-value / critical value tab, enter χ² and df, and read the right-tail p-value, the left area and a row of critical values. By hand or on a TI-84, p-value = χ²cdf(χ², 1E99, df). For example, χ² = 7.815 with df = 3 gives p ≈ 0.0500, and χ² = 3.841 with df = 1 gives p ≈ 0.0500.

Chi-Square Critical Value Table

Reject H₀ when your χ² is greater than or equal to the critical value for your df and α (right-tail area).

dfα = 0.10α = 0.05α = 0.025α = 0.01α = 0.005α = 0.001
12.7063.8415.0246.6357.87910.828
24.6055.9917.3789.21010.59713.816
36.2517.8159.34811.34512.83816.266
47.7799.48811.14313.27714.86018.467
59.23611.07012.83315.08616.75020.515
610.64512.59214.44916.81218.54822.458
712.01714.06716.01318.47520.27824.322
813.36215.50717.53520.09021.95526.124
914.68416.91919.02321.66623.58927.877
1015.98718.30720.48323.20925.18829.588
1218.54921.02623.33726.21728.30032.909
1522.30724.99627.48830.57832.80137.697
2028.41231.41034.17037.56639.99745.315
2534.38237.65240.64644.31446.92852.620
3040.25643.77346.97950.89253.67259.703

How to Do a Chi-Square Test on a TI-84

χ² test of independence (χ²-Test)

  1. Press 2nd x⁻¹ (MATRIX), go to EDIT, choose 1:[A] and set its size to rows × columns.
  2. Type the observed counts row by row.
  3. Press STAT, go to TESTS, choose C:χ²-Test. Observed: [A], Expected: [B].
  4. Choose Calculate. The calculator shows χ², p and df, and stores the expected counts in [B].

χ² goodness of fit (χ²GOF-Test)

  1. Press STAT 1:Edit. Put the observed counts in L1 and the expected counts (not proportions) in L2.
  2. Press STAT, go to TESTS, choose D:χ²GOF-Test. Observed: L1, Expected: L2, df: k − 1.
  3. Choose Calculate to see χ², p, df and the CNTRB list of contributions. χ²GOF-Test needs a TI-84 Plus OS 2.30 or later; the TI-83 does not have it.

For a p-value only, use 2nd VARS χ²cdf(lower, 1E99, df). Practice on our TI-84 Plus CE calculator online.

Assumptions: Expected Counts, Yates and Fisher

  • Counts, not percentages. Enter raw frequencies. Percentages or means give wrong answers.
  • Independent observations. Each person or item belongs in exactly one cell.
  • Expected counts of at least 5. A common rule is that all expected counts are ≥ 1 and no more than 20% are below 5. The calculator flags low cells for you.
  • Yates continuity correction subtracts 0.5 from each |O − E| in a 2 × 2 table. It is more conservative. The TI-84 does not apply it, so leave it off to match your calculator.
  • Fisher’s exact test is shown automatically for 2 × 2 tables of whole numbers. Use it when expected counts are small.

Effect Size: Cramér’s V

A small p-value says an association exists, not how strong it is. Cramér’s V = √(χ² / (n · (min(r, c) − 1))) runs from 0 (no association) to 1 (perfect association). For a 2 × 2 table it equals the phi coefficient. As a rough guide with df* = 1: 0.1 is small, 0.3 medium and 0.5 large. The calculator labels the size for your table.

Why This Chi-Square Calculator Is Different

  • All three chi-square tools in one place: independence, goodness of fit, and p-value or critical value from χ².
  • Paste a whole table from a spreadsheet, up to 12 × 12, with optional row and column labels.
  • Goodness of fit accepts expected counts, proportions, percentages or ratios like 9:3:3:1, and rescales them to your total.
  • Expected-count table with a heat map of each cell’s contribution plus adjusted residuals, so you can see which cells drive the result.
  • Cramér’s V, Yates correction and Fisher exact p-value for 2 × 2 tables, with automatic low-expected-count warnings.
  • Shaded chi-square curve, step-by-step working, a plain-English conclusion and TI-84 keystrokes with the exact screen output.
  • Checked against SciPy on more than 11,000 values. Share links, dark mode and a phone-friendly layout. See all tools on the math and statistics calculators page, or run z and t tests with the hypothesis test calculator.

Chi-Square Calculator FAQ

It tells you whether the differences between observed and expected counts are bigger than chance would explain. Goodness of fit checks one variable against a stated distribution; the test of independence checks whether two categorical variables are related.

Find the expected count for every category or cell, compute (O − E)² / E for each one and add them up. For a table, E = row total × column total / grand total.

For goodness of fit, df = k − 1 where k is the number of categories. For an r × c contingency table, df = (r − 1)(c − 1).

Use the right-tail area of the chi-square distribution: p = P(χ²df ≥ χ²). Enter the statistic and df in the P-value tab above, or use χ²cdf(χ², 1E99, df) on a TI-84.

The chi-square test of independence and goodness of fit are right-tailed, because larger values of χ² mean a worse fit to H₀.

The chi-square approximation becomes unreliable. Combine small categories if it makes sense, collect more data, or use Fisher’s exact test for a 2 × 2 table, which this calculator shows automatically.

The calculation is the same. Independence uses one sample classified by two variables; homogeneity compares the distribution of one variable across several separate samples.

Yes. With Yates correction off, χ², p and df match the TI-84 χ²-Test and χ²GOF-Test to every digit shown, and the calculator lists the keystrokes for your numbers.

Ti84CalcPro is not affiliated with or endorsed by Texas Instruments. TI-84 Plus CE is a trademark of Texas Instruments.