Core Concepts April 8, 2026 8 min read

When to Use Z-Test vs T-Test vs Chi-Square

Not sure which test to use? Compare the z-test, t-test, and chi-square test side by side. Decision rules, examples, and a quick flowchart.

StatsMasters Team

Choosing the wrong statistical test is one of the most common mistakes in data analysis. This guide compares the three tests students encounter most — z-test, t-test, and chi-square — and gives you clear rules for picking the right one.

Quick Decision Table

QuestionTestExample
Is this sample mean different from a known value? (σ known, large n)Z-testIs the average height of recruits different from 170 cm?
Is this sample mean different from a known value? (σ unknown or small n)One-sample t-testDo students at this school score differently from the national mean?
Are two group means different?Two-sample t-testDo men and women differ in reaction time?
Did a treatment change scores?Paired t-testDid the training program improve test scores?
Is there a relationship between two categorical variables?Chi-square testIs there an association between gender and voting preference?
Does observed data match expected frequencies?Chi-square goodness of fitDoes a die roll follow a uniform distribution?

The Z-Test

What it does

Compares a sample mean to a known population mean when you know the population standard deviation (σ).

Formula

z=xˉμσ/nz = \frac{\bar{x} - \mu}{\sigma / \sqrt{n}}

When to use it

  • Population σ is known (rare in practice)
  • Sample size is large (n ≥ 30)
  • Data is approximately normal (or n is large enough for CLT)

Real-world example

A factory produces bolts with a known σ = 0.5 mm. You sample 50 bolts and find xˉ\bar{x} = 10.2 mm. Are they different from the target μ = 10 mm?

z=10.2100.5/50=0.20.0707=2.83z = \frac{10.2 - 10}{0.5 / \sqrt{50}} = \frac{0.2}{0.0707} = 2.83

Look up z = 2.83 in the Z-Table: p = 0.0023 (one-tailed) or 0.0046 (two-tailed). Reject H₀ at α = 0.05.

Tool

Use our Z-Score Calculator to compute z-values and look up probabilities.

The T-Test

What it does

Compares means when the population σ is unknown (the usual case). The t-distribution is wider than the z-distribution, accounting for extra uncertainty.

Three flavors

One-sample t-test:

t=xˉμs/nt = \frac{\bar{x} - \mu}{s / \sqrt{n}}

Independent two-sample t-test:

t=xˉ1xˉ2sp2(1/n1+1/n2)t = \frac{\bar{x}_1 - \bar{x}_2}{\sqrt{s_p^2(1/n_1 + 1/n_2)}}

Paired t-test:

t=dˉsd/nt = \frac{\bar{d}}{s_d / \sqrt{n}}

When to use it

  • Population σ is unknown (you estimate it from the sample)
  • Comparing means (not proportions or frequencies)
  • Data is continuous and approximately normal (or n > 30)

Real-world example

You want to know if a new drug lowers blood pressure. You test 20 patients (before and after):

  • Mean difference: d̄ = −8.5 mmHg
  • SD of differences: s_d = 6.2
  • t = −8.5 / (6.2 / √20) = −8.5 / 1.387 = −6.13
  • df = 19, critical t = 2.093

Result: |−6.13| > 2.093, so the drug significantly lowers blood pressure.

Tool

Our T-Test Calculator handles all three types with step-by-step output.

See also: How to Perform a Paired T-Test

The Chi-Square Test

What it does

Tests relationships between categorical variables (not means). There are two main types.

Chi-square test of independence

Tests whether two categorical variables are associated.

χ2=(OE)2E\chi^2 = \sum \frac{(O - E)^2}{E}

Where O = observed count, E = expected count.

Chi-square goodness of fit

Tests whether observed frequencies match expected frequencies.

When to use it

  • Your data is categorical (counts/frequencies)
  • You have a contingency table (rows × columns)
  • Expected frequencies are ≥ 5 in each cell (rule of thumb)

Real-world example

Is there an association between smoking status and lung disease?

Lung diseaseNo diseaseTotal
Smoker9060150
Non-smoker30120150
Total120180300

Expected values: E = (row total × column total) / grand total

  • E(Smoker, Disease) = 150 × 120 / 300 = 60

χ2=(9060)260+(6090)290+(3060)260+(12090)290\chi^2 = \frac{(90-60)^2}{60} + \frac{(60-90)^2}{90} + \frac{(30-60)^2}{60} + \frac{(120-90)^2}{90}

=15+10+15+10=50= 15 + 10 + 15 + 10 = 50

With df = (2−1)(2−1) = 1, look up in the Chi-Square Table: critical value at α = 0.05 is 3.841. Since 50 > 3.841, there is a significant association between smoking and lung disease.

Tool

Use the Bartlett’s Test Calculator for variance homogeneity checks or look up critical values in the Chi-Square Table.

Z-Test vs T-Test: What’s the Difference?

FeatureZ-testT-test
Population σKnownUnknown
Sample sizeUsually large (n ≥ 30)Any size
Distribution usedStandard normal (z)t-distribution (wider tails)
Degrees of freedomNot applicablen − 1 (or pooled)
Use in practiceRareVery common

Rule of thumb: If you don’t know σ, use a t-test. With large n, the t and z distributions converge, so the results will be nearly identical.

Decision Flowchart

  1. What type of data do you have?

    • Categorical (counts) → Chi-square
    • Continuous (measurements) → Go to 2
  2. How many groups?

    • One group vs. known value → Go to 3
    • Two groups → Go to 4
    • Three or more groups → ANOVA (not covered here)
  3. Do you know the population σ?

    • Yes → Z-test
    • No → One-sample t-test
  4. Are the groups independent or paired?

    • Independent → Independent t-test
    • Paired/matched → Paired t-test

What About ANOVA?

If you’re comparing three or more group means, none of these tests work — you need ANOVA (Analysis of Variance). Running multiple t-tests inflates your Type I error rate. ANOVA compares all groups simultaneously using the F-distribution.

Summary

TestData typeComparesKey assumption
Z-testContinuousOne mean vs. known valueσ known
T-testContinuous1 or 2 meansσ unknown
Chi-squareCategoricalFrequencies / proportionsExpected counts ≥ 5
Tags: z-test t-test chi-square hypothesis testing statistical test choosing test decision guide

Free Statistics Cheat Sheet

Get the formulas, decision rules, and table values you actually need — in a single printable PDF. Join 1,000+ students and analysts.

No spam. Unsubscribe anytime.