# Chi-Square Test Calculator

Run chi-square goodness-of-fit or independence tests from observed counts or contingency tables

> Canonical page: https://elysiatools.com/en/tools/chi-square-test-calculator

- **Category:** Math & Numbers

- **Keywords:** chi-square test, goodness of fit, independence test, contingency table, p value, calculator

## Overview

The Chi-Square Test Calculator is a statistical utility designed to perform goodness-of-fit and independence tests. By inputting observed counts, expected counts, or a contingency table, users can quickly calculate the chi-square statistic, degrees of freedom, and p-value to determine whether to reject the null hypothesis at a specified significance level.

## Inputs

- **Test Type** (select)
- **Observed Counts** (textarea): e.g. 18, 22, 20, 16, 24
- **Expected Counts** (textarea): e.g. 20, 20, 20, 20, 20
- **Contingency Table** (textarea): One row per line, e.g. 30, 20 15, 35
- **Alpha** (number)
- **Decimal Places** (number)

## When to use

- When comparing observed categorical data against expected distributions to check for goodness of fit.
- When analyzing a contingency table to determine if two categorical variables are independent.
- When conducting hypothesis testing for academic research, market analysis, or survey data requiring a chi-square statistic.

## How it works

- Select the test type: Goodness of Fit or Independence.
- Enter your data as comma-separated observed and expected counts, or input a multi-row contingency table.
- Adjust the alpha level (significance level) and preferred decimal places for the output.
- The calculator computes the chi-square value, degrees of freedom, and p-value, indicating whether the null hypothesis should be rejected.

## Use cases

- Evaluating whether customer preferences across different product categories match historical sales distributions.
- Testing if there is a significant relationship between demographic groups and voting preferences in survey data.
- Checking if the outcomes of a random event, like rolling a die, follow a uniform expected distribution.

## Frequently asked questions

### What is the difference between goodness-of-fit and independence tests?

A goodness-of-fit test compares one categorical variable to an expected distribution, while an independence test evaluates whether two categorical variables are related using a contingency table.

### How do I format the contingency table?

Enter one row per line with comma-separated values. For example, type '30, 20' on the first line and '15, 35' on the second line for a 2x2 table.

### What does the alpha value mean?

Alpha represents the significance level, typically set to 0.05. It is the probability threshold used to determine whether to reject the null hypothesis.

### What outputs does the calculator provide?

The tool outputs the chi-square statistic, degrees of freedom, p-value, and a boolean result indicating whether to reject the null hypothesis.

### Can I change the precision of the results?

Yes, you can adjust the decimal places setting to round the calculated chi-square and p-value to your preferred precision, up to 10 decimal places.

## Related tools

- [Absolute Value Calculator](https://elysiatools.com/en/tools/absolute-value-calculator): Calculate the absolute value of positive, negative, or decimal numbers and explain the sign relationship
- [Condensing / Evaporating Temperature Calculator](https://elysiatools.com/en/tools/condensing-temperature-calculator): Estimate the saturated condensing temperature (T_cond) and evaporating temperature (T_evap) of a refrigeration circuit. Three modes: (1) from coil approach — T_cond = T_ambient + condenser ΔT approach, T_evap = T_medium − evaporator ΔT approach; (2) from measured saturated pressures — given P_cond and P_evap for a known refrigerant (R-22 / R-134a / R-410A), invert the Antoine fit; (3) from subcooling & superheat — T_cond = T_liquid − SC, T_evap = T_suction − SH. Temperature in °C/K/°F; pressure in bar/MPa/kPa/PSI absolute or gauge (atmospheric default 1.01325 bar). Results reported in °C.
- [DC Motor Back-EMF & Torque Calculator (E=kω, T=kI)](https://elysiatools.com/en/tools/dc-motor-back-emf): Compute the back-EMF and electromagnetic torque of a DC motor from its machine constant: E=k·ω, T=k·I. In SI units the back-EMF constant equals the torque constant (k_e=k_t=k, V·s/rad=N·m/A). Also returns the mechanical (air-gap) power P=T·ω=E·I. Speed accepted in rad/s or RPM.
- [Dew Point Calculator HVAC (Magnus Equation)](https://elysiatools.com/en/tools/dew-point-calculator-hvac): Compute the air dew-point temperature from dry-bulb temperature and a humidity reading using the Magnus saturation-pressure equation: P_ws(T) = 0.6108·exp(17.27·T/(T+237.3)), P_w = φ·P_ws, T_dp = 237.3·ln(P_w/0.6108) / (17.27 − ln(P_w/0.6108)). Also returns the saturation vapour pressure P_ws, actual partial pressure P_w, and absolute humidity ρ_v (kg/m³). Three input modes: relative humidity φ (natural ventilated), August natural-ventilated wet-bulb T_w, or aspirated (Assmann) wet-bulb T_wa. Temperature in °C/K/°F; all reported temperatures are in the selected Temperature Unit.
- [F Distribution Calculator](https://elysiatools.com/en/tools/f-distribution-calculator): Calculate F distribution density, cumulative probability, and right-tail probability from numerator and denominator degrees of freedom
- [Flywheel Energy Storage Calculator](https://elysiatools.com/en/tools/flywheel-energy-storage): Calculate the kinetic energy stored in a flywheel. E = ½·I·ω², ω = 2π·n/60. Enter the moment of inertia directly, or compute it from flywheel mass and radius (I = ½·m·r²). Supports J/kJ/Wh.
- [Gear Module Calculator](https://elysiatools.com/en/tools/gear-module-calculator): Calculate the gear module m. m = d/z = p/π. Solve the module from the pitch diameter d and tooth count z, or from the circular pitch p. Also returns the pitch diameter, circular pitch and addendum.
- [Line of Best Fit Calculator](https://elysiatools.com/en/tools/line-of-best-fit-calculator): Find the linear trend line of best fit for paired data and predict y values from x

## Samples

- [Web Image Processing Python Samples](https://elysiatools.com/en/samples/web-image-processing-python): Web Python image processing examples using PIL/Pillow including reading, saving, resizing, and format conversion
- [Android Image Processing Java Samples](https://elysiatools.com/en/samples/android-image-processing-java): Android Java image processing examples including reading/saving images, scaling, and format conversion
- [Android Image Processing Kotlin Samples](https://elysiatools.com/en/samples/android-image-processing-kotlin): Android Kotlin image processing examples including reading/saving images, scaling, and format conversion
- [Web Image Processing Rust Samples](https://elysiatools.com/en/samples/web-image-processing-rust): Web Rust image processing examples including image read/save, scaling, and format conversion
