t-test vs z-test: Which One Do You Actually Use?

September 4, 2026

Statistics · Inference
t-test vs z-test: Which One Do You Actually Use?
One question decides it, and almost everyone overcomplicates the answer. Here’s the rule, why the t-distribution exists at all, and the flowchart you can keep.
You’re staring at an assignment. Compare two means. Do you reach for a t-test or a z-test? The textbook gave you a page of conditions and now they’re a blur.
Good news: for almost every real situation you’ll ever meet, the answer is the same, and it comes down to one question. Let’s make it simple, then explain why the rule is what it is — because the “why” is genuinely interesting and it’ll make you remember it.

The one question that decides it

Do you know the population standard deviation (σ)?
Yes, you know σ → z-test.
No, you’re estimating it from your sample (using s) → t-test.
And here’s the practical punchline: you almost never know σ. In real research, if you knew the population’s standard deviation, you’d probably know its mean too, and you wouldn’t be running a test. So in practice, the answer is nearly always the t-test.
🔑 Key term
The t-test is what you use when you’ve estimated the standard deviation from your own data — which is virtually always. The z-test assumes you already know the population’s true standard deviation, a luxury real data rarely gives you.
💡 Insight — the “n > 30” rule is a shortcut, not the real rule
You’ve probably heard “use z if n > 30.” That’s a rough approximation, not the actual principle. It works because the t-distribution converges to the z (normal) distribution as the sample grows — by n = 30 they’re nearly identical, so it barely matters which you use.
But “barely matters” isn’t “correct.” If you’re estimating σ from data, the t-test is always technically right, at any sample size. Software defaults to t for exactly this reason. When in doubt, use t — it’s never wrong, and it self-corrects to z when n is large.

Why the t-distribution exists at all

The t-distribution looks like the normal bell curve but with fatter tails. Those fat tails aren’t decoration — they’re paying for an extra piece of ignorance.
💡 Insight — the t is wider because you know less
When you use a z-test, you’re only uncertain about one thing: the mean. When you use a t-test, you’re uncertain about two things: the mean and the standard deviation, which you had to estimate from the same small sample.
That extra uncertainty has to show up somewhere, and it shows up as fatter tails — the t-distribution is more cautious, more willing to admit extreme values are possible. As your sample grows, your estimate of σ gets reliable, the extra caution is no longer needed, and the tails slim down until t becomes z. The fat tails are the price of estimating the spread.
A lovely bit of history: the t-distribution was invented by William Gosset, a chemist at the Guinness brewery, who needed to draw conclusions from tiny samples of barley and hops. Guinness wouldn’t let employees publish under their own names, so he wrote as “Student” — which is why, to this day, it’s called Student’s t-test. Small-sample statistics was a beer problem before it was a textbook one.

Which t-test? A quick map

SituationTest
One sample vs a known valueOne-sample t-test
Two separate groups (e.g. treatment vs control)Independent-samples t-test
Same subjects measured twice (before/after)Paired t-test
Three or more groupsANOVA (not a t-test — see below)
⚠ Common error — three groups, three t-tests
Got three groups? Do not run three separate t-tests. Every test carries a false-positive risk, and stacking them inflates your overall error rate — run enough pairwise tests and you’ll “find” a difference that isn’t there. Use ANOVA, which tests all groups at once while controlling the error rate. Choosing paired vs independent trips people up too — we cover that fully in the paired vs independent t-test guide.

Practice questions

Q1. You have 18 exam scores and want to test whether the class mean differs from 60. You don’t know the population SD. Which test?
Q2. A factory’s machine has a documented, long-established population SD of 0.4mm. You take 50 parts to check the mean. z or t?
Q3. Why does it barely matter which you pick when n = 200, but matter a lot when n = 8?
Q4. A student measures the same 20 patients’ blood pressure before and after a drug and runs an independent-samples t-test. What did they get wrong?

Worked answers

A1. One-sample t-test. You’re estimating the SD from your 18 scores, so it’s a t-test — and with only 18 observations, the difference between t and z is real, so getting this right matters.
A2. This is the rare genuine z-test case: the population SD is known independently (documented from long production history, not estimated from your 50 parts). Quality-control settings like this are one of the few places z-tests legitimately appear.
A3. Because the t-distribution converges to the normal as n grows. At n = 200, your estimate of σ is rock-solid and the two distributions are visually identical — the fat tails have vanished. At n = 8, your SD estimate is shaky, the t-distribution’s tails are noticeably fatter, and using z would understate your uncertainty and give you falsely confident (too-small) p-values.
A4. The measurements are paired — the same 20 patients measured twice. Each “after” reading has a natural partner in its “before” reading. They should have run a paired t-test, which analyses the before/after differences. Treating paired data as two independent groups throws away the pairing and usually makes the test far less powerful.

The short version

• Know σ? → z. Estimating it from data? → t.
• You almost never know σ, so it’s almost always t.
• “n > 30 use z” is a shortcut — t is always technically correct and self-corrects to z.
• The t is wider because you’re uncertain about the mean and the SD.
• Three+ groups → ANOVA, not a pile of t-tests.

References

1. Student [Gosset, W.S.] (1908) “The Probable Error of a Mean,” Biometrika, 6(1), pp. 1–25.
2. Moore, D.S., McCabe, G.P. & Craig, B.A. (2021) Introduction to the Practice of Statistics. 10th edn. New York: W.H. Freeman.
Choosing the right test is a whole chapter in Statistics Made Simple.
Complete with a master decision tree that takes you from “what kind of data do I have?” to the exact procedure.

Related Posts

Simpson’s Paradox Explained: When Aggregate Data Lies to You

Treatment A beats Treatment B in every single subgroup of patients — and yet, combine all the subgroups together, and Treatment B wins overall. This isn't a contradiction or a calculation error. It's a real, well-documented phenomenon called Simpson's Paradox, and the...

Outlier Detection: The IQR Method, Z-Scores and What to Do Next

A single data-entry typo — a salary of $5,000,000 instead of $50,000 — can single-handedly move a mean, inflate a standard deviation, and quietly wreck a regression model. The Statistics Made Simple Complete Bundle covers exactly how to catch outliers like this before...