Chi-Square Calculator
Chi-square test of independence and goodness-of-fit with cell contribution table, df, and p-value
This free online chi-square calculator provides instant results with no signup required. All calculations run directly in your browser — your data is never sent to a server. Supports both metric (SI) and imperial units with built-in unit selection dropdowns on every input field, so you can work in whatever units your problem provides. Designed for engineering students and professionals working through coursework, design projects, or quick reference calculations.
Chi-Square Calculator
Chi-square goodness-of-fit and test of independence with contribution table.
| R1 | |||
| R2 |
Cell Contributions to χ²
| Cell | Observed | Expected | (O-E)²/E |
|---|---|---|---|
| R1C1 | 20 | 13.5 | 3.1296 |
| R1C2 | 15 | 18 | 0.5 |
| R1C3 | 10 | 13.5 | 0.9074 |
| R2C1 | 10 | 16.5 | 2.5606 |
| R2C2 | 25 | 22 | 0.4091 |
| R2C3 | 20 | 16.5 | 0.7424 |
| Total | — | — | 8.2492 |
How to Use This Calculator
Enter your input values
Fill in all required input fields for the Chi-Square Calculator. Most fields include unit selectors so you can work in your preferred unit system — metric or imperial, whichever matches your problem.
Review your inputs
Double-check that all values are correct and that you have selected the right units for each field. Incorrect units are the most common source of calculation errors and can produce results that are off by factors of 2, 10, or more.
Read the results
The Chi-Square Calculator instantly computes the output and displays results with units clearly labeled. All calculations happen in your browser — no loading time and no data sent to a server.
Explore parameter sensitivity
Try adjusting individual input values to see how the output changes. This is a quick and effective way to develop intuition about how different parameters influence the result and to identify which inputs have the largest effect.
Formula Reference
Chi-Square Calculator Formula
See calculator inputs for the governing equation
Variables: All variables and their units are labeled in the calculator interface above. Input fields accept values in multiple unit systems — select your preferred unit from the dropdown next to each field.
When to Use This Calculator
- •Use the Chi-Square Calculator when solving homework or exam problems that require quick numerical verification of your hand calculations — instant feedback helps identify arithmetic errors before they propagate.
- •Use it during the early design phase to rapidly iterate on parameters and narrow down feasible configurations before committing time to detailed finite element simulations or full design packages.
- •Use it when reviewing a colleague's calculation or checking a vendor's data sheet for plausibility — a quick sanity check can prevent costly downstream errors.
- •Use it to generate reference data for a technical report or presentation without manual computation, ensuring consistent, reproducible numbers throughout the document.
- •Use it in the field when a quick estimate is needed and a full engineering software package is not available.
About This Calculator
The Chi-Square Calculator is a precision engineering calculation tool designed for students, engineers, and technical professionals. Chi-square test of independence and goodness-of-fit with cell contribution table, df, and p-value All calculations are performed using established engineering formulas from the relevant scientific literature and standards. Inputs support both metric (SI) and imperial unit systems, with unit conversion handled automatically — simply select your preferred unit from the dropdown next to each field. Results are computed instantly in the browser without sending data to a server, ensuring both speed and privacy. This calculator is intended as a supplementary tool for learning and design exploration; always verify results against authoritative references for safety-critical applications.
The Theory Behind It
The chi-square (χ²) test compares observed frequencies to expected frequencies in categorical data. Two common applications are: (1) goodness-of-fit test — whether an observed frequency distribution matches a theoretical distribution (e.g., testing whether dice are fair, whether genotype frequencies follow Hardy-Weinberg, whether data follow a normal distribution); (2) test of independence — whether two categorical variables are associated (e.g., whether smoking status is associated with disease, whether purchase choice is associated with age group). The test statistic is χ² = Σ((O − E)² / E), where O is observed frequency and E is expected frequency under the null hypothesis. Under H₀, χ² follows a chi-square distribution with appropriate degrees of freedom: (k − 1) for goodness-of-fit with k categories, (rows − 1)(cols − 1) for independence tests on a contingency table. Large χ² values (small p-values) lead to rejection of H₀. Assumptions: expected frequencies should be at least 5 in each cell (Yates' continuity correction for 2×2 tables); observations should be independent; data should be counts, not proportions. For small expected frequencies, Fisher's exact test is preferred. The calculator handles both goodness-of-fit and independence tests with configurable tables up to 10×10.
Real-World Applications
- •Genetics research: test whether observed phenotype frequencies match Mendelian inheritance ratios (3:1 for monohybrid cross, 9:3:3:1 for dihybrid, etc.).
- •Marketing and survey analysis: test whether customer preferences differ significantly across demographic groups.
- •Quality control: test whether defect rates are consistent across different machines, shifts, or batches.
- •Epidemiology: test whether disease incidence is associated with exposure factors in observational studies.
- •A/B testing with categorical outcomes: test whether conversion rates differ between treatment groups.
Frequently Asked Questions
What is the chi-square test?
A statistical test that compares observed frequencies to expected frequencies in categorical data. The test statistic is χ² = Σ((O − E)²/E), which follows the chi-square distribution under the null hypothesis. Small p-values indicate observed frequencies differ significantly from expected. Used for goodness-of-fit (comparing data to a theoretical distribution) and independence tests (whether two categorical variables are related).
What's the difference between goodness-of-fit and independence tests?
Goodness-of-fit: tests whether a single variable's observed distribution matches a hypothesized distribution. One-way table of observed counts. Independence: tests whether two variables are related, using a two-way contingency table. Different degrees of freedom calculation: (k − 1) for goodness-of-fit with k categories; (rows − 1)·(cols − 1) for independence with a two-way table.
What if some expected counts are small?
The chi-square test assumes expected counts are at least 5 in each cell for the chi-square approximation to be valid. For 2×2 tables with small counts, use Fisher's exact test instead. For larger tables with some small cells, consider combining adjacent categories, or use a simulation-based approach (Monte Carlo chi-square). Avoid applying chi-square when many cells have expected counts below 5.
How do I compute the degrees of freedom?
Goodness-of-fit: df = k − 1, where k is the number of categories. If parameters are estimated from data (e.g., mean for normal distribution test), subtract one df for each estimated parameter. Contingency table independence test: df = (r − 1)(c − 1), where r and c are the numbers of rows and columns. For a 2×3 table, df = 1·2 = 2.
What's the chi-square distribution?
A family of distributions indexed by degrees of freedom, arising from the sum of squared standard normal variables. It is right-skewed (especially at low df) and approaches normal as df increases. Critical values are tabulated: for 95% confidence (α = 0.05), χ²_crit for df = 1 is 3.84; for df = 5, 11.07; for df = 10, 18.31; for df = 20, 31.41. Chi-square tests reject H₀ if the computed χ² exceeds the critical value.
Related Calculators
Normal Distribution Calculator
Compute P(X < x), P(X > x), P(a < X < b), z-scores, and inverse normal with an interactive bell curve
t-Distribution Calculator
Compute p-values (one-tail and two-tail) and critical t-values for Student's t-distribution with any degrees of freedom
Confidence Interval Calculator
Compute confidence intervals using z or t distribution with margin of error, SE, and visual interval bar
Hypothesis Testing Calculator
Step-by-step one-sample z-test, one-sample t-test, and two-sample Welch t-test with rejection region chart
ANOVA Calculator
One-way ANOVA for 2–5 groups: SSB, SSW, MSB, MSW, F-statistic, p-value, and pairwise post-hoc comparisons
Linear Regression Calculator
Simple linear regression with slope, intercept, R², adjusted R², residuals, predictions, and scatter/residual plots