• Skip to main content
  • Skip to primary sidebar
  • Skip to footer
QuestionPro

QuestionPro

questionpro logo
  • Products
    survey software iconSurvey softwareEasy to use and accessible for everyone. Design, send and analyze online surveys.research edition iconResearch SuiteA suite of enterprise-grade research tools for market research professionals.CX iconCustomer ExperienceExperiences change the world. Deliver the best with our CX management software.WF iconEmployee ExperienceCreate the best employee experience and act on real-time data from end to end.
  • Solutions
    IndustriesGamingAutomotiveSports and eventsEducationGovernment
    Travel & HospitalityFinancial ServicesHealthcareCannabisTechnology
    Use CaseAskWhyCommunitiesAudienceContactless surveysMobile
    LivePollsMember ExperienceGDPRPositive People Science360 Feedback Surveys
  • Resources
    BlogeBooksSurvey TemplatesCase StudiesTrainingHelp center
  • Features
  • Pricing
Language
  • English
  • Español (Spanish)
  • Português (Portuguese (Brazil))
  • Nederlands (Dutch)
  • العربية (Arabic)
  • Français (French)
  • Italiano (Italian)
  • 日本語 (Japanese)
  • Türkçe (Turkish)
  • Svenska (Swedish)
  • Hebrew IL (Hebrew)
  • ไทย (Thai)
  • Deutsch (German)
  • Portuguese de Portugal (Portuguese (Portugal))
  • Español / España (Spanish / Spain)
Call Us
+1 800 531 0228 +1 (647) 956-1242 +55 9448 6154 +49 030 9173 9255 +44 01344 921310 +81-3-6869-1954 +61 (02) 6190 6592 +971 529 852 540
Log In Log In
SIGN UP FREE

Home Market Research Research Tools and Apps

Chi-Square Test: What It Is and How to Calculate It

Chi-square test analyses the differences between categorical variables from a sample to assess if observed findings are well-fitting.

A chi-square test is a statistical method researchers use to compare categorical data, such as survey responses or demographic groups, against what would be expected if no relationship existed. It works with counts rather than averages, which makes it a go-to tool for survey research, market research, and social science studies.

Unlike tests built around numeric averages, a chi-square test tells you whether the differences between your categories are meaningful or just noise. That distinction matters when you are deciding whether a campaign actually shifted preferences or whether device type genuinely affects survey completion.

In this blog, we’ll break down the types of chi-square tests, the formula behind them, and a step-by-step way to calculate and interpret one using real data.

Content Index hide
1. What is a chi-square test?
2. Chi-square test vs. t-test, ANOVA, and Fisher’s exact test
3. Types of chi-square test
4. Chi-square test formula and key terms
5. How to calculate a chi-square test step by step
6. Chi-square test example: Does device type affect survey completion?
7. When to use a chi-square test in survey and market research
8. Common mistakes to avoid when running a chi-square test
9. From raw counts to confident decisions
10. Frequently Asked Questions (FAQs)

What is a chi-square test?

A chi-square test measures whether observed frequencies in categorical data differ significantly from the frequencies expected under a null hypothesis, a starting assumption that no relationship exists between the variables being studied. Categorical data refers to information sorted into named groups, such as yes/no answers, regions, or product types, rather than measured on a numeric scale, and you can read more in this guide to categorical data.

Researchers run a chi-square test when they want to know if two categorical variables are connected, or if one variable’s distribution matches a known pattern. The test compares actual counts to calculated expected counts, then checks how large that gap is compared to what random chance would produce.

This differs from simply eyeballing percentages in a report. Two groups can look different on the surface and still fall well within normal sampling variation, which is exactly the gap a chi-square test is built to check.

This makes the chi-square test especially useful in survey and market research, where most responses are categorical rather than numeric. It also sits inside the broader idea of hypothesis testing, the general framework for deciding whether evidence supports or contradicts a starting assumption.

Chi-square test vs. t-test, ANOVA, and Fisher’s exact test

The chi-square test often gets confused with other statistical tests, especially by anyone searching for the fastest way to compare two groups. Each test below answers a different question, and picking the wrong one can produce an invalid conclusion.

Test Data type What it compares Typical use case
Chi-square test Categorical Observed vs. expected frequencies Survey response patterns, demographic breakdowns
t-test Continuous (numeric) Means of two groups Comparing average ratings or spend between two segments
ANOVA Continuous (numeric) Means of three or more groups Comparing satisfaction scores across several segments
Fisher’s exact test Categorical, small samples Same relationship as chi-square, exact probability 2×2 tables where expected cell counts fall below 5

The chi-square test and Fisher’s exact test are related but not interchangeable, even though some articles use the names loosely. Fisher’s exact test calculates an exact probability rather than an approximation, which makes it the more reliable choice once your sample gets small.

Types of chi-square test

Not every chi-square test asks the same question. Picking the right type depends on how many variables you are studying and whether you are comparing one sample or several.

  • Goodness of fit test: Checks whether a single categorical variable matches an expected distribution, such as whether survey respondents are evenly split across four answer options.
  • Chi-square test of independence: Checks whether two categorical variables within the same sample are related, such as whether region affects product preference. This is a common form of inferential statistics, since it draws conclusions about a population from sample data.
  • Homogeneity test: Checks whether the distribution of one categorical variable stays consistent across two or more separate populations or groups.

The independence test and homogeneity test share the same formula and calculations. The difference is conceptual: independence asks about a relationship within one population, while homogeneity asks whether separate populations look the same on one variable.

Chi-square test formula and key terms

The chi-square formula compares what you actually observed to what you expected, then scales that difference by the expected value. The result is a single number called the chi-square statistic, shown below as one of the most widely used statistical methods for categorical data.

χ² = Σ (O − E)² / E

Where:

  • O is the observed frequency in a category
  • E is the expected frequency in that category, calculated under the null hypothesis

Degrees of freedom (df) represent the number of values in a calculation that are free to vary once the totals are fixed. For a chi-square test of independence, df equals (rows − 1) × (columns − 1). For a goodness-of-fit test, df equals the number of categories minus one.

The chi-square statistic and its degrees of freedom are then compared against a chi-square distribution to produce a p-value, the probability of seeing a difference this large if the null hypothesis were true. A small p-value, typically below 0.05, suggests the categories are genuinely related rather than different by chance.

How to calculate a chi-square test step by step

Calculating a chi-square test by hand follows the same sequence every time, whether you are testing one variable or two. Here is the process from start to finish.

  1. State the null and alternative hypotheses.
    Define what “no relationship” looks like for your categories before you look at the data.
  2. Choose a significance level.
    Most researchers set alpha at 0.05, meaning a 5% risk of a false positive.
  3. Check your assumptions.
    Confirm your observations are independent, your sample is random, and most expected cell counts are at least 5.
  4. Calculate the expected frequency for each cell.
    Multiply the row total by the column total, then divide by the overall sample size.
  5. Apply the chi-square formula.
    Sum the squared difference between observed and expected values, divided by the expected value, across every cell.
  6. Compare your result to a critical value or p-value.
    If your chi-square statistic exceeds the critical value for your degrees of freedom, reject the null hypothesis.

Chi-square test example: Does device type affect survey completion?

A worked example makes the formula easier to apply. Here is a chi-square test of independence using survey completion data from 800 respondents.

Completed Abandoned Total
Mobile 240 160 400
Desktop 300 100 400
Total 540 260 800

The expected count for each cell equals (row total × column total) divided by the overall total. For mobile respondents who completed the survey, that is (400 × 540) / 800 = 270. Repeating this across all four cells gives expected values of 270, 130, 270, and 130.

Applying the formula to each cell and summing the results gives a chi-square statistic of 20.51, with 1 degree of freedom: (2 rows − 1) × (2 columns − 1). At an alpha of 0.05, the critical value for 1 degree of freedom is 3.84, according to standard chi-square distribution tables published by the National Institute of Standards and Technology. Because 20.51 is far larger than 3.84, the result is statistically significant, and the null hypothesis of no relationship is rejected.

In plain terms, device type and survey completion are related in this sample. Mobile respondents abandoned the survey at a noticeably higher rate than expected, which points to a usability issue worth investigating on smaller screens.

When to use a chi-square test in survey and market research

Chi-square tests show up constantly in survey and market research because most survey questions produce categorical answers rather than numeric scores. A few common scenarios show where the test adds real value.

A retail brand might use a chi-square test to check whether product preference differs by age group, turning a simple cross-tab into a statistically defensible finding rather than a guess. CX teams often test whether NPS category, meaning promoter, passive, or detractor, varies by support channel, which can reveal where service breakdowns are concentrated.

Academic and social researchers commonly apply the test to demographic questions, checking whether opinions or behaviors differ across gender, region, or income bracket. In each case, the test turns a table of percentages into a defensible statement about whether a pattern is real.

Running these calculations by hand across large datasets is slow and easy to get wrong. QuestionPro’s Advanced Cross-Tabulation report calculates the chi-square statistic, p-value, and degrees of freedom automatically whenever you compare two survey questions, so researchers can test relationships without leaving their results dashboard.

Common mistakes to avoid when running a chi-square test

A chi-square test is simple to calculate, which makes it easy to misuse. These are the mistakes that show up most often in research reports and dashboards.

Mistake Why it matters
Running chi-square on numeric data without binning it The test only works on categorical data, not raw averages or scores
Ignoring expected cell counts below 5 Low expected counts make the test unreliable and inflate false positives
Treating a significant result as a strong relationship Significance shows a relationship exists, not how strong it is; pair it with an effect size like Cramér’s V, a 0 to 1 measure of association strength
Testing non-random or dependent samples The test assumes independent observations, so repeated responses from the same person can distort results

Most of these mistakes are avoidable by checking assumptions before running the test, rather than after seeing a low p-value that looks convincing. It also helps to report the sample size, degrees of freedom, and p-value together, since a chi-square statistic on its own tells a reader very little without that context.

From raw counts to confident decisions

A chi-square test turns a table of percentages into a defensible answer about whether a pattern is real or coincidental. That distinction matters whenever a decision, a budget, or a product change rests on survey data.

The formula itself is straightforward once you know what observed and expected values represent. The harder part is checking assumptions and reading the result honestly, rather than stopping at whichever number happens to confirm what you already believed.

Businesses that run frequent studies often manage this kind of analysis inside a dedicated market research software platform, from data collection through statistical testing, instead of exporting everything to a separate stats tool.

Create memorable experiences based on real-time data, insights and advanced analysis. Request Demo

Frequently Asked Questions (FAQs)

Is a chi-square test the same as Fisher’s exact test?

No. Both test relationships between categorical variables, but Fisher’s exact test calculates an exact probability and works better for small samples. The chi-square test relies on an approximation that needs larger expected cell counts to stay accurate.

Can a chi-square test be used on ordinal data?

Yes, but it treats ordinal categories as unordered, so it ignores the ranking between them. If the order of your categories matters, a trend test or ordinal regression captures more information than a standard chi-square test.

What sample size do I need for a reliable chi-square test?

There is no fixed minimum, but most guidelines recommend an expected frequency of at least 5 in each cell of your table. Samples with several low expected counts should use Fisher’s exact test instead of the standard chi-square formula.

Does a chi-square test tell you how strong a relationship is?

No, it only tells you whether a relationship is statistically significant. To measure strength, pair the test with an effect size such as Cramér’s V or the phi coefficient alongside the p-value you calculated.

Which tools can calculate a chi-square test automatically?

Excel, SPSS, R, and Python all include built-in chi-square functions for quick calculations on any dataset. Many survey platforms with cross-tabulation reporting also calculate the statistic directly from response data, so you never have to build the formula by hand.

SHARE THIS ARTICLE:

About the author
Anas Al Masud
Digital Marketing Lead at QuestionPro. SEO-driven content strategist specializing in content that ranks, engages, and converts, while boosting online visibility through hands-on digital marketing expertise.
View all posts by Anas Al Masud

Primary Sidebar

Gain insights with 80+ features for free

Create, Send and Analyze Your Online Survey in under 5 mins!

Create a Free Account

RELATED ARTICLES

HubSpot - QuestionPro Integration

Synthetic Data in Healthcare: Uses, Benefits, and Risks

Sep 22,2023

HubSpot - QuestionPro Integration

Your IDIs, focus groups and usability tests are now calendar invites, not project plans

Jul 27,2026

HubSpot - QuestionPro Integration

All You Need to Know About eNPS: Interpretation, Improvement Strategies & Industry Benchmarks

Mar 11,2025

BROWSE BY CATEGORY

Footer

MORE LIKE THIS

Conference Polling Software: Turning Passive Audiences Into Participants

Sep 18, 2026

Live Polling for Lectures: How It Changes Student Engagement

Sep 18, 2026

Classroom Polling Software for K-12: A Teacher’s Guide

Sep 18, 2026

Live Polling for Fundraising Events: Engaging Donors in Real Time

Sep 18, 2026

Other categories

questionpro-logo-nw
Help center Live Chat SIGN UP FREE
  • Sample questions
  • Sample reports
  • Survey logic
  • Branding
  • Integrations
  • Professional services
  • Security
  • Survey Software
  • Customer Experience
  • Workforce
  • Communities
  • Audience
  • Polls Explore the QuestionPro Poll Software - The World's leading Online Poll Maker & Creator. Create online polls, distribute them using email and multiple other options and start analyzing poll results.
  • Research Edition
  • LivePolls
  • InsightsHub
  • Blog
  • Articles
  • eBooks
  • Survey Templates
  • Case Studies
  • Training
  • Webinars
  • All Plans
  • Nonprofit
  • Academic
  • Qualtrics Alternative Explore the list of features that QuestionPro has compared to Qualtrics and learn how you can get more, for less.
  • SurveyMonkey Alternative
  • VisionCritical Alternative
  • Medallia Alternative
  • Likert Scale Complete Likert Scale Questions, Examples and Surveys for 5, 7 and 9 point scales. Learn everything about Likert Scale with corresponding example for each question and survey demonstrations.
  • Conjoint Analysis
  • Net Promoter Score (NPS) Learn everything about Net Promoter Score (NPS) and the Net Promoter Question. Get a clear view on the universal Net Promoter Score Formula, how to undertake Net Promoter Score Calculation followed by a simple Net Promoter Score Example.
  • Offline Surveys
  • Customer Satisfaction Surveys
  • Employee Survey Software Employee survey software & tool to create, send and analyze employee surveys. Get real-time analysis for employee satisfaction, engagement, work culture and map your employee experience from onboarding to exit!
  • Market Research Survey Software Real-time, automated and advanced market research survey software & tool to create surveys, collect data and analyze results for actionable market insights.
  • GDPR & EU Compliance
  • Employee Experience
  • Customer Journey
  • Synthetic Data
  • About us
  • Executive Team
  • In the news
  • Testimonials
  • Advisory Board
  • Careers
  • Brand
  • Media Kit
  • Contact Us

QuestionPro in your language

  • English
  • Español (Spanish)
  • Português (Portuguese (Brazil))
  • Nederlands (Dutch)
  • العربية (Arabic)
  • Français (French)
  • Italiano (Italian)
  • 日本語 (Japanese)
  • Türkçe (Turkish)
  • Svenska (Swedish)
  • Hebrew IL (Hebrew)
  • ไทย (Thai)
  • Deutsch (German)
  • Portuguese de Portugal (Portuguese (Portugal))
  • Español / España (Spanish / Spain)

Awards & certificates

  • survey-leader-asia-leader-2023
  • survey-leader-asiapacific-leader-2023
  • survey-leader-enterprise-leader-2023
  • survey-leader-europe-leader-2023
  • survey-leader-latinamerica-leader-2023
  • survey-leader-leader-2023
  • survey-leader-middleeast-leader-2023
  • survey-leader-mid-market-leader-2023
  • survey-leader-small-business-leader-2023
  • survey-leader-unitedkingdom-leader-2023
  • survey-momentumleader-leader-2023
  • bbb-acredited
The Experience Journal

Find innovative ideas about Experience Management from the experts

  • © 2022 QuestionPro Survey Software | +1 (800) 531 0228
  • Sitemap
  • Privacy Statement
  • Terms of Use