Chi Square Calculator

A free tool by DeepRit, a Google Ads agency that does PPC and nothing else. We build and run Google Ads accounts so every click is accounted for. Book a free audit call

Free chi square calculator. Paste a table of counts for a test of independence, or observed and expected counts for goodness of fit, to get χ², df and p.

p-value
0
Degrees of freedom
0
Total count
0
Cramér's V
0

Free, no sign-up. Runs in your browser: nothing you type is uploaded or saved.

How to use the chi square calculator

The chi square calculator runs two common tests.

Test of independence (a table of counts):

  1. Choose "Test of independence".
  2. Paste your table of counts, one row per line, with the numbers in each row separated by spaces, commas or tabs. You can copy a block of cells straight from a spreadsheet.

Goodness of fit:

  1. Choose "Goodness of fit".
  2. Enter the observed counts for each category.
  3. Enter the expected counts or proportions, in the same order. Leave the box blank to test whether all categories are equally likely.

The chi square calculator shows the chi-square statistic (χ²), the p-value, the degrees of freedom, the total count, Cramér's V for tables, and a table of expected counts.

What is a chi-square test?

A chi-square test compares observed counts with the counts you'd expect if a hypothesis were true. It's used with categorical data: things you count, such as how many customers chose each plan, how many people in each age group answered yes, or how many times each number came up on a die.

The test statistic adds up how far each observed count is from its expected count, scaled by the expected count:

χ² = Σ (observed − expected)² ÷ expected

The larger χ² is, the further the data are from what the hypothesis predicts. The p-value tells you how likely a χ² this large would be if the hypothesis were true.

Test of independence

The test of independence asks whether two categorical variables are related. For example, is the choice of product related to the region a customer lives in? You arrange the counts in a table, with one variable in the rows and the other in the columns.

The expected count for each cell, if the variables were independent, is:

Expected = row total × column total ÷ grand total

The degrees of freedom are (rows − 1) × (columns − 1).

For example, suppose 100 people are split into two groups and asked a yes-or-no question:

Yes No
Group A 20 30
Group B 30 20

Every row and column total is 50, so every expected count is 50 × 50 ÷ 100 = 25. χ² = (20 − 25)²/25 + (30 − 25)²/25 + (30 − 25)²/25 + (20 − 25)²/25 = 4 × 1 = 4.0, with 1 degree of freedom. The p-value is about 0.046, so the difference between the groups is significant at the 5% level. Enter "20 30" and "30 20" on two lines in the chi square calculator to check.

Goodness of fit

The goodness of fit test asks whether counts in one categorical variable match an expected pattern. Is a die fair? Do website visitors spread evenly across the days of the week? Do survey responses match the known make-up of the population?

For example, a die is rolled 60 times and gives counts of 8, 12, 9, 11, 6 and 14 for the faces 1 to 6. If it's fair, each face is expected 10 times. χ² = (4 + 4 + 1 + 1 + 16 + 16) ÷ 10 = 4.2, with 5 degrees of freedom. The p-value is about 0.52, so there's no evidence the die is unfair.

If your expected values are proportions, such as 50%, 30% and 20%, the chi square calculator scales them to the total of your observed counts automatically.

Effect size: Cramér's V

A significant chi-square result tells you there's probably a relationship, but not how strong it is. With a very large sample, even a weak relationship can be significant. Cramér's V measures the strength of the relationship in a table, from 0 (no relationship) to 1 (perfect relationship):

V = √(χ² ÷ (n × (k − 1))), where k is the smaller of the number of rows and columns.

As a rough guide, values around 0.1 are often described as small, 0.3 as medium and 0.5 as large, although the right interpretation depends on the field and the table size. In the yes-or-no example, V = √(4 ÷ 100) = 0.2.

Assumptions

The chi-square test relies on an approximation that works well when the expected counts are large enough. Common rules of thumb are:

  • Every expected count should be at least 5, or at least 80% of them should be, with none below 1.
  • Observations must be independent: each person or item counted once, in one cell.
  • Use counts, not percentages or averages.

The chi square calculator warns you when expected counts are below 5. If they are, consider combining small categories, collecting more data, or using Fisher's exact test for 2 × 2 tables.

A worked example

A shop tracks which of three plans new customers choose, split by whether they arrived from an ad or from search:

Basic Plus Pro
Ad 30 20 10
Search 20 25 15

The chi square calculator gives χ² ≈ 3.56 with 2 degrees of freedom and a p-value of about 0.17. There isn't enough evidence that plan choice depends on where customers came from. Cramér's V is about 0.17, a small effect.

Who uses a chi square calculator

Students use it for statistics coursework. Researchers use it to analyse survey data and experiments with categorical outcomes. Marketers use it to compare how different groups respond to campaigns, and quality teams use it to check whether defect types differ between production lines.

Need more customers from Google?

This tool is free and runs in your browser. If your business also needs more leads or sales, Google Ads is where people search with their wallet out. DeepRit is a Google Ads agency that does PPC and nothing else: we build the campaigns, block the searches that waste money, write the ads, set up conversion tracking and send you a short report every week. Request a free PPC audit and we will show you, in dollars, what we would fix first.

Reporting a chi-square test

A typical report includes the statistic, degrees of freedom, sample size and p-value, plus an effect size. For example: "Plan choice did not differ significantly by traffic source, χ²(2, N = 120) = 3.56, p = .17, Cramér's V = .17." Including the table of counts, or percentages, helps readers see where any differences lie.

Common mistakes

  • Entering percentages instead of counts. The test needs raw counts.
  • Counting the same person in more than one cell.
  • Ignoring small expected counts.
  • Reading a significant result as a strong relationship without checking the effect size.

Finding where the difference is

A significant chi-square test of independence tells you the variables are related somewhere in the table, but not which cells drive the result. To find out, compare each observed count with its expected count in the table the chi square calculator shows. Cells where the observed count is much higher or lower than expected contribute most to χ². Many analysts also calculate standardised residuals, (observed − expected) ÷ √expected, for each cell; values beyond about ±2 point to cells that differ noticeably from what independence would predict. Looking at row or column percentages is another simple way to see the pattern, for example the share of each group that chose each option.

Chi-square for A/B tests

A chi-square test of independence on a 2 × 2 table is a common way to compare conversion rates in an A/B test: one row per version, with columns for converted and not converted. For example, if version A had 120 conversions out of 2,000 visitors and version B had 150 out of 2,000, the table would be "120 1880" and "150 1850". The result is equivalent to a two-proportion z-test, because for a 2 × 2 table the chi-square statistic equals the square of the z statistic. The A/B test calculator is designed for this situation and also shows the relative lift.

Larger tables

The chi square calculator accepts tables of any size, as long as every row has the same number of counts. Larger tables need larger samples, because the counts are spread across more cells and expected counts can fall below 5. If several categories are small, consider merging similar ones before running the test, and decide how to merge them before looking at the results.

Chi-square and the p value calculator

If you already have a chi-square statistic from software or a paper, you don't need to re-enter the table. Use the p value calculator with the statistic and its degrees of freedom to get the exact p-value.

Sources and further reading

Frequently asked questions

How do I calculate chi-square?

For each cell, square the difference between observed and expected counts and divide by the expected count, then add them up.

How do I find the expected counts?

For a table: row total × column total ÷ grand total. For goodness of fit: total × the expected proportion for each category.

What are the degrees of freedom?

(rows − 1) × (columns − 1) for a table; categories − 1 for goodness of fit.

What if expected counts are below 5?

Combine categories, collect more data, or use an exact test.

Can I paste data from a spreadsheet?

Yes. Copy the block of counts and paste it; tabs are treated as separators.

Is the chi square calculator free?

Yes. It's free, needs no sign-up, and works in your browser.

Free PPC audit

See where your ad budget leaks.

We look at your Google Ads account before the call, then walk you through what we'd fix first, in dollars. No obligation, no hard sell.

Book a free audit call 30-minute call · Free · The audit is yours to keep