Chi-Square Calculator – Test of Independence & P-Value in 3 Easy Steps
Chi-Square Calculator
Run a test of independence or a goodness of fit test and get the chi-square statistic, degrees of freedom and p-value.
Expected counts
All calculations run in your browser. Nothing you enter is stored or sent anywhere.
Use this free chi-square calculator to run a chi-square test of independence on a contingency table or a goodness of fit test on one variable. You get the chi-square statistic, degrees of freedom, p-value, critical value and the expected count for every cell.
Quick answer
A chi-square test compares observed counts with the counts you would expect if there were no effect. The statistic is χ² = Σ (O − E)² ÷ E. For a table with r rows and c columns, degrees of freedom are (r − 1)(c − 1). If the p-value is below your significance level (usually 0.05), you reject the null hypothesis.
Table of Contents
Survey results, A/B test conversions, genetics ratios and quality control counts all end up as categories with counts. The chi-square test tells you whether the pattern you see is likely real or just random noise.
Doing it by hand means working out every expected value, summing the terms and then looking up a p-value table. This chi-square calculator does all of that instantly and flags any expected count below 5, so you know when the result needs care.
What Is a Chi-Square Test?
A chi-square (χ²) test is a statistical test for categorical data. It measures how far the counts you observed are from the counts expected under a null hypothesis. A small χ² means observed and expected are close. A large χ² means they are far apart, and the p-value tells you how unusual that gap would be if the null hypothesis were true.
The calculator covers the two most common versions:
- Test of independence: checks whether two categorical variables are related, for example gender and product preference. Data goes in a contingency table.
- Goodness of fit: checks whether one variable follows an expected distribution, for example whether a die is fair or whether sales are spread evenly across four regions.
Chi-Square Formula
- Chi-square statistic: χ² = Σ (O − E)² ÷ E, summed over every cell
- Expected count (independence): E = (row total × column total) ÷ grand total
- Expected count (goodness of fit): E = total observed × expected proportion
- Degrees of freedom: (rows − 1) × (columns − 1) for independence, or categories − 1 for goodness of fit
- Cramér’s V (effect size): √[χ² ÷ (N × (k − 1))], where k is the smaller of rows or columns
The p-value is the area to the right of your χ² value under the chi-square distribution with the matching degrees of freedom. The calculator works this out exactly, so you do not need a printed table.
Chi-Square Critical Values Table
If you want to check a result by hand, compare your χ² with the critical value for your degrees of freedom. Values above the critical value are significant.
| Degrees of freedom | α = 0.10 | α = 0.05 | α = 0.01 |
|---|---|---|---|
| 1 | 2.706 | 3.841 | 6.635 |
| 2 | 4.605 | 5.991 | 9.210 |
| 3 | 6.251 | 7.815 | 11.345 |
| 4 | 7.779 | 9.488 | 13.277 |
| 5 | 9.236 | 11.070 | 15.086 |
| 6 | 10.645 | 12.592 | 16.812 |
| 8 | 13.362 | 15.507 | 20.090 |
| 10 | 15.987 | 18.307 | 23.209 |
How to Use the Chi-Square Calculator
The example below tests whether three product versions are preferred differently by two customer groups of 50 and 70 people.
Step 1: Choose the Test and Enter Your Counts
Keep Test of Independence selected, set the number of rows and columns, and type the observed count in each cell. Pick a significance level; 0.05 is the usual choice. Use raw counts, not percentages.

Step 2: Calculate and Read the Result
Press Calculate Chi-Square. Here χ² = 14.9143 with 2 degrees of freedom, so the p-value is 0.0006. That is far below 0.05 and above the 5.9915 critical value, so the two groups do not share the same preferences. Cramér’s V of 0.353 points to a moderate association. The expected counts table shows what each cell would hold if there were no relationship.

Step 3: Run a Goodness of Fit Test
Switch to Goodness of Fit to test one variable. Enter the observed counts, then choose whether the expected values are equal, raw counts or percentages. In this example 120 observations are tested against an expected split of 40%, 30%, 15% and 15%. The result is χ² = 1.4167 and p = 0.7016, so the data fit the expected pattern well.

When Can You Use a Chi-Square Test?
- Your data are counts (frequencies) in categories, not means or percentages.
- Each observation falls into exactly one cell and observations are independent of each other.
- Expected counts are 5 or more in at least 80% of cells, and none is below 1. The calculator warns you when expected counts are small.
- For a 2×2 table with very small counts, Fisher’s exact test is the safer option.
Chi-Square Test Example: A/B Test Conversions
Say version A of a page got 120 sign-ups from 1,000 visitors and version B got 150 from 1,000. Enter a 2×2 table with sign-ups and non-sign-ups (120, 880 and 150, 850). The calculator returns χ² ≈ 3.85 with 1 degree of freedom and p ≈ 0.0496. That is only just below 0.05, so B wins at the 5% level, but the margin is thin. Many teams would keep the test running a little longer before rolling out the change.
To measure the effect on revenue once you have a winner, try the CRO Calculator. For numeric data instead of counts, the ANOVA Solver or Pearson Correlation Calculator is the better fit.
Frequently Asked Questions
What does a chi-square calculator do?
It compares observed counts with expected counts and returns the chi-square statistic, degrees of freedom and p-value, so you can decide whether a pattern in categorical data is statistically significant.
What is a good p-value for a chi-square test?
A p-value below your chosen significance level, usually 0.05, means the result is statistically significant and you reject the null hypothesis. A p-value above it means the data do not give enough evidence against the null hypothesis.
How do I find degrees of freedom for a chi-square test?
For a test of independence, multiply (rows − 1) by (columns − 1). For a goodness of fit test, use the number of categories minus 1.
Can I enter percentages instead of counts?
Observed values must be raw counts. Percentages change the sample size and give the wrong answer. Expected values in the goodness of fit test can be entered as percentages.
What if an expected count is below 5?
The chi-square approximation becomes less reliable. Merge small categories if it makes sense, collect more data, or use Fisher’s exact test for a 2×2 table.
Does this calculator use Yates’ correction?
No. It reports the standard Pearson chi-square statistic, which matches most textbooks and statistics software when the correction is turned off.