Chi-Square Test Calculator: Independence, Goodness of Fit and Fisher's Exact Test
Test whether two categorical variables are related, such as gender and preferred treatment or variety and disease status, or whether observed counts match what you expected. Edit the table, and the results update as you type.
| Category | Observed | Expected % (optional) |
|---|
Leave the expected % empty to test against equal proportions. If you fill them in, they should add up to 100.
- PriceFree, no login or sign-up needed
- Your dataProcessed in your browser, never uploaded
- Works onPhone, tablet or computer, any modern browser
- Made byDr. Muhammad Aammar Tufail, Codanics
- Published14 November 2026
- Last updated16 November 2026
📚 How to cite this tool
This tool is free. If it helped your thesis, paper, report or assignment, please cite it. It keeps the tools free and helps other students find them.
Tufail, M. A. (2026). Chi-square calculator [Online tool]. Codanics. Retrieved 16 November 2026, from https://codanics.com/tools/chi-square-calculator/
In-text citation: (Tufail, 2026) · Narrative: Tufail (2026)
The access date is today’s date, filled in automatically. Author: Muhammad Aammar Tufail. Published 14 November 2026.
How to use the chi-square calculator
- For two categorical variables, stay on Test of independence. Choose the number of rows and columns and rename the labels.
- Type the counts (frequencies, not percentages) into the cells, or use Paste from Excel or Upload CSV / Excel. You can load a table of counts, or raw data with one row per person, which is cross-tabulated for you. Results update as you type.
- Check the expected counts. If many are below 5 in a 2×2 table, report Fisher’s exact test, which is calculated for you.
- For one variable compared with known or equal proportions, use the Goodness of fit tab.
- Copy the APA sentence and look at the residuals to see which cells drive the association.
When to use a chi-square test
Use the chi-square test of independence when both variables are categorical and each person or sample is counted once, for example smoker or non-smoker against lung disease yes or no. Use the goodness-of-fit test when you have one categorical variable and want to compare it with a theoretical distribution, such as a 9:3:3:1 Mendelian ratio or equal preference for four brands.
Formulas
Assumptions
- The data are counts, not percentages or means.
- Each observation falls in exactly one cell, and observations are independent. For before-and-after yes/no data, use McNemar’s test instead.
- No more than 20% of expected counts are below 5, and none is below 1.
Frequently asked questions
Can I enter percentages in a chi-square test?
No. The chi-square test needs raw counts. If you only have percentages, multiply them by the group size to get counts first.
When should I use Fisher's exact test instead of chi-square?
Use Fisher’s exact test for a 2×2 table when any expected count is below 5, which usually happens with small samples. This calculator shows Fisher’s p automatically for every 2×2 table.
Should I use Yates' continuity correction?
Yates’ correction makes the 2×2 chi-square more conservative. Many statisticians now prefer to report the uncorrected chi-square for large samples and Fisher’s exact test for small ones. If your supervisor or journal asks for Yates, tick the box.
How do I report a chi-square test in APA format?
Write χ²(df, N = total) = value, p = value, followed by an effect size, for example: χ²(1, N = 80) = 11.43, p < .001, φ = .38.
What do the standardized residuals mean?
They show which cells contribute most to a significant result. A residual above +1.96 means more observations than expected, and below −1.96 means fewer, at roughly the 5% level.
Is my data private?
Yes. All calculations happen in your browser.
Do I need to log in or create an account to use the chi-square calculator?
No. There is no login, no sign-up and no email required. Open the page and start using it straight away, for free, on any device.
How do I cite this tool in my thesis or paper?
Use the citation box on this page. In APA 7th edition: Tufail, M. A. (2026). Chi-square calculator [Online tool]. Codanics. Retrieved [date you used it], from https://codanics.com/tools/chi-square-calculator/. BibTeX, RIS (EndNote, Mendeley, Zotero), MLA, Harvard, Chicago and Vancouver formats are also available.
Free guides and courses from Codanics
More free tools
See all free Codanics tools → · Codanics on YouTube · WhatsApp channel

