Beta Notice: TONTUF Tools is currently in public beta — we're actively refining features, squashing bugs, and rolling out new tools. Your feedback helps us improve!
Choose your test type, configure the significance level, and enter your observed data below.
Goodness of Fit — Data Input
Enter categories with observed and expected frequencies. Expected values can be raw counts or proportions (they will be auto-normalized to sum to the total observed count).
Category
Observed (O)
Expected (E)
Expected values must each be ≥ 5 for the Chi-Square approximation to be valid. If any expected value is less than 5, consider merging categories.
Independence — Contingency Table
Enter observed frequencies in each cell. Row and column totals are calculated automatically.
Ensure all expected cell frequencies are ≥ 5. For 2×2 tables with small samples, consider Fisher's Exact Test instead.
Result
—
—
Distribution Position
Visual comparison of your test statistic vs. the critical value on the Chi-Square distribution.
Step-by-Step Calculation
Follow every step of the Chi-Square computation to understand exactly how this result was reached.
Detailed Cell Contributions
Each cell's contribution to the overall χ² statistic: (O − E)² / E.
Assumption Checks
Verify that your data meets the requirements for a valid Chi-Square test.
How to Use This Tool
A complete walkthrough of the Chi-Square calculator — from data entry to interpreting your results.
Select Your Test
Choose Goodness of Fit when you want to compare one categorical variable's observed distribution against a hypothesized (expected) distribution.
Choose Test of Independence when you want to determine whether two categorical variables are associated using a contingency table.
Set Significance Level
The significance level (α) is the threshold for rejecting the null hypothesis. Common choices:
• α = 0.05 — Standard in most social sciences
• α = 0.01 — Stricter, used in medical studies
• α = 0.001 — Very strict, used in physics
Enter Your Data
Goodness of Fit: Enter a category name, observed frequency (actual count), and expected frequency (theoretical count) for each category.
Independence: Set the number of rows and columns, label them, then enter the observed count in each cell.
Interpret Results
The tool shows the χ² statistic, p-value, degrees of freedom, and critical value.
If p ≤ α → reject H₀ (significant result).
If p > α → fail to reject H₀ (not significant).
Formulas Used
The mathematical formulas behind every calculation in this tool.
Chi-Square Statistic Formula
χ² = Σ [ (O - E)² / E ]
Where:
O = Observed frequency (your actual data)
E = Expected frequency (theoretical / hypothesized)
Σ = Sum over all categories or cells
Each term (O−E)²/E measures how far off one category is from the expectation. Larger deviations contribute more to the final χ² value.
Degrees of Freedom
Goodness of Fit:
df = k − 1
(k = number of categories)
Test of Independence:
df = (r − 1) × (c − 1)
(r = rows, c = columns)
Expected Frequencies (Independence Test)
E(i,j) = (Row Total_i × Column Total_j) / Grand Total
For each cell (i,j), the expected frequency is calculated from the marginal totals, assuming independence between the two variables.
P-Value Calculation
The p-value is the area to the right of the χ² statistic in the Chi-Square distribution with the given degrees of freedom. It represents the probability of observing a result this extreme (or more) under the null hypothesis.
This tool uses the regularized incomplete gamma function for precise p-value computation:
V = √( χ² / (n × min(r−1, c−1)) )
Interpretation:
V ≈ 0.10 → Small effect
V ≈ 0.30 → Medium effect
V ≈ 0.50 → Large effect
Assumptions & Conditions
These conditions must be met for the Chi-Square test to produce valid results.
Expected ≥ 5: All expected cell frequencies should be at least 5. If not, merge categories or use Fisher's Exact Test.
Independent observations: Each data point must come from a different subject — no repeated measures.
Categorical data only: Variables must be nominal or ordinal, not continuous measurements.
Adequate sample size: A total sample size of at least 20 is generally recommended for reliable results.
Worked Examples
Click "Load into Calculator" on any example to pre-fill the tool and see the results instantly.
Fair Dice Test
Goodness of Fit · 6 categories
A die is rolled 120 times. We expect each face to appear 20 times if the die is fair. Observed results:
Face
Observed
Expected
1
25
20
2
17
20
3
15
20
4
23
20
5
19
20
6
21
20
Mendel's Genetics
Goodness of Fit · 4 categories
Mendel predicted a 9:3:3:1 ratio for seed phenotypes. Observed in 560 seeds:
Phenotype
Observed
Expected
Round Yellow
315
315
Round Green
108
105
Wrinkled Yellow
101
105
Wrinkled Green
36
35
Gender × Voting Preference
Independence Test · 2×3 table
Is voting preference associated with gender? Survey of 250 people:
Party A
Party B
Undecided
Male
40
55
30
Female
45
60
20
Drug Treatment Outcome
Independence Test · 2×2 table
Does a new drug improve recovery? Clinical trial results:
Recovered
Not Recovered
Treatment
45
15
Placebo
20
40
Key Facts
Essential facts about the Chi-Square test you should know.
1900
Year of Origin
Karl Pearson introduced the Chi-Square test in 1900, making it one of the oldest statistical tests still in widespread use.
df+
Right-Skewed Distribution
The Chi-Square distribution is always right-skewed and non-negative. It approaches a normal distribution as degrees of freedom increase.
χ²
Non-Negative Statistic
The Chi-Square statistic is always ≥ 0. A value of 0 means perfect agreement between observed and expected frequencies.
≥5
Minimum Expected Frequency
Each expected cell frequency must be at least 5 for the approximation to be valid — this is the most common violated assumption.
H₀
Null Hypothesis
The null hypothesis assumes no difference (GoF) or no association (Independence). You can only reject it — never "prove" it.
V
Cramér's V Effect Size
Statistical significance ≠ practical importance. Always report Cramér's V (or φ for 2×2) as the effect size alongside the p-value.
Advanced Tips
Pro tips from statisticians to help you use Chi-Square tests correctly.
Tip 1: Don't Confuse Significance with Importance
A statistically significant result (small p-value) only means your data would be unlikely if H₀ were true. With large samples, even tiny, meaningless differences become statistically significant. Always compute Cramér's V to assess practical (real-world) importance.
Tip 2: Merge Categories When E < 5
If any expected cell is below 5, try combining adjacent or conceptually similar categories. Alternatively, use Fisher's Exact Test (for 2×2 tables) or a Monte Carlo simulation-based Chi-Square test for more reliable results.
Tip 3: Chi-Square Cannot Show Causation
Even if two variables are significantly associated (Independence test), that does not mean one causes the other. Correlation and association do not imply causation. Always consider confounding variables and study design.
Tip 4: One-Tailed vs Two-Tailed
The Chi-Square test is inherently one-tailed (always right-tailed) because the statistic is squared and can only be positive. You're always testing whether the statistic is unusually large — which is why you always use the right tail of the distribution.
Tip 5: Check Cell Residuals for Insight
When you get a significant result, look at the standardized residuals for each cell: (O−E)/√E. Cells with |residual| > 2 are driving the significance — they tell you which specific categories differ most from expectation.
Tip 6: Yates' Continuity Correction
For 2×2 tables with small samples, Yates' correction adjusts the formula: χ² = Σ (|O−E|−0.5)² / E. This makes the test more conservative and is recommended when total N < 40 or any expected cell is between 5 and 10.
Real-World Use Cases
The Chi-Square test is one of the most versatile statistical tools — applied across virtually every field of science and industry.
Medical Research
Test whether a drug's effectiveness is associated with patient demographics. Compare treatment outcomes across multiple groups.
Market Research
Determine if customer preference varies by age group, region, or income level. Validate survey instrument categories.
Education Studies
Test whether pass/fail rates differ across teaching methods, schools, or demographic groups. Analyze exam score distributions.
Political Science
Examine whether voting patterns are independent of geographic region, education level, or other demographic factors.
Genetics & Biology
Test if offspring phenotype ratios match Mendelian inheritance predictions. Analyze population genetics data.
Quality Control
Determine if defect rates differ across production lines, shifts, or machine configurations. Monitor manufacturing processes.
A/B Testing
Compare click-through rates, conversions, or user behavior across different website designs or marketing campaigns.
Legal & Social Science
Analyze whether jury verdicts, sentencing, or legal outcomes are independent of defendant characteristics.
Environmental Science
Test if species distribution patterns differ across habitats. Compare pollution levels across multiple zones or time periods.
About This Tool
Everything you need to know about this Chi-Square calculator and the statistics behind it.
Purpose
This tool provides a professional, browser-based Chi-Square test calculator that requires no statistical software, no account, and no data upload. All calculations are performed locally in your browser using mathematically rigorous algorithms.
Privacy
Your data never leaves your device. All computations happen entirely in JavaScript within your browser. No server, no cookies, no tracking. Your research data remains completely private and secure.
Algorithms
P-values are computed using the regularized incomplete gamma function approximation, matching the precision of major statistical packages (R, SPSS, SAS). Critical values are derived from the Chi-Square quantile function.
Features
Goodness of Fit test (any number of categories)
Test of Independence (up to 10×10 tables)
Step-by-step calculation walkthrough
Cell contribution breakdown table
Assumption checker with warnings
Cramér's V effect size
Visual distribution position indicator
Export / print results
Chi-Square vs Other Tests
When to use Chi-Square and when to consider alternatives.
Situation
Recommended Test
Why
Categorical vs hypothesized distribution
Chi-Square GoF
Direct comparison of observed vs expected frequencies
Two categorical variables, large N
Chi-Square Independence
Standard for contingency table analysis
2×2 table, small N (<20)
Fisher's Exact Test
Chi-Square approximation breaks down for small samples
Ordinal categorical variable
Cochran-Armitage or Mann-Whitney
Captures the ordering of categories
Continuous data, normal distribution
t-test / ANOVA
Chi-Square is for counts, not measurements
Paired / repeated measures
McNemar's Test
Chi-Square assumes independent observations
Citation: Pearson, K. (1900). On the criterion that a given system of deviations from the probable in the case of a correlated system of variables is such that it can be reasonably supposed to have arisen from random sampling. Philosophical Magazine, Series 5, 50(302), 157–175.
Trusted by thousands of users worldwide for fast, reliable, and free utilities.
10 million+
tools used last year
35 000+
Monthly Active Users
40+
Tool Categories
5 000+
Daily Tool Runs
250%
Yearly Growth
99,9%
Uptime Guarantee
Ready to Supercharge Your Workflow?
Join thousands of satisfied users who rely on TONTUF Tools every day. Start exploring our growing collection of 100+ free online tools — no signup required.
"TONTUF Tools has been my go-to resource for quick online utilities. The SEO analyzer alone saved me hours of manual work!"
★★★★★
S
Sarah Chen
Content Creator
"I use the image and downloader tools daily. Clean interface, fast results, and absolutely free. Highly recommended!"
★★★★★
M
Michael Okafor
Digital Marketer
"The collection of SEO and finance tools is incredible. Everything I need in one place, and it keeps growing. Love the Python tools too!"
★★★★☆
FAQ
Frequently Asked Questions
Quick answers to the most common questions about TONTUF Tools and how everything works.
Yes, every tool on TONTUF Tools is 100% free with no hidden charges, subscriptions, or usage limits. We believe in making useful utilities accessible to everyone.
All tools run entirely on your device. Your files and data never leave your browser — we never store, upload, or share anything you process through our tools.
No account or sign-up is required. Just visit the site, pick a tool, and start using it instantly. No registration, no emails, no hassle.
We welcome suggestions! Reach out through our Contact Us page or connect with us on social media. We regularly add new tools based on user feedback.
TONTUF Tools works on all modern browsers — Chrome, Firefox, Edge, Safari, and Opera — across desktop, tablet, and mobile devices.
0 Comments