A test question hands you a sample mean and asks whether it differs from some claimed value. You know you need a hypothesis test — but a t-test or a z-test? Picking the wrong one costs easy points. This guide gives you a single decision rule, shows the two formulas side by side, and works one example with each so the choice becomes automatic.
The One Question That Decides It
For a test about a single mean, the choice between a t-test and a z-test comes down to one question: do you know the population standard deviation?
- If the population standard deviation (σ) is given, use a z-test.
- If you only have the sample standard deviation (s) computed from your data, use a t-test.
That is the whole rule for the most common case. The reason is that the z-test assumes you know exactly how spread out the population is. In real research you almost never do — you estimate the spread from the sample, and that estimate carries its own uncertainty. The t-test exists to account for that extra uncertainty.
A practical consequence: in genuine studies, the t-test is far more common, because σ is rarely known. The z-test shows up mostly in textbook problems that hand you σ, and in proportion tests, covered below.
Why Two Tests Exist: The t-Distribution
Both tests compute a test statistic with the same shape — how many standard errors your sample mean sits from the claimed mean — and compare it to a reference distribution. The difference is which distribution.
The z-test compares against the standard normal distribution. The t-test compares against the t-distribution, which looks like the normal curve but with heavier tails. Those fatter tails are the t-distribution's way of saying "because you estimated the spread, extreme results are a little more likely than the normal curve admits."
The t-distribution's exact shape depends on its degrees of freedom, which for a single-sample test is n − 1 (sample size minus one). With few data points the tails are noticeably heavy; as the sample grows, the t-distribution tightens. By about n = 30 it is nearly identical to the normal curve — which is why some textbooks let you use a z-test for large samples even when σ is unknown. The t-test is never wrong in that situation, so when in doubt, choose t.
The Two Formulas Side by Side
Both statistics have the same structure: (observed mean − claimed mean) ÷ standard error.
Z-statistic (σ known):
z = (x̄ − μ₀) ÷ (σ ÷ √n)
T-statistic (σ unknown):
t = (x̄ − μ₀) ÷ (s ÷ √n)
The only change is σ becoming s in the denominator. The numerator is identical. What changes more is what you do next: the z-statistic is read against the normal table, while the t-statistic is read against the t-table at n − 1 degrees of freedom.
A Worked Example of Each
Z-test. A bottling machine is supposed to fill bottles to 500 mL. From long experience the population standard deviation is known to be σ = 8 mL. A sample of 36 bottles averages x̄ = 503 mL. Test whether the machine is off target at α = 0.05.
The standard error is 8 ÷ √36 = 8 ÷ 6 = 1.333. The z-statistic is (503 − 500) ÷ 1.333 = 2.25. For a two-sided test the critical values are ±1.96. Because 2.25 exceeds 1.96, reject the null: there is significant evidence the machine is off target.
T-test. A study measures the resting heart rate of 16 students, claiming the population mean is 72 bpm. The sample gives x̄ = 75 bpm and a sample standard deviation s = 6 bpm. Test at α = 0.05.
The standard error is 6 ÷ √16 = 6 ÷ 4 = 1.5. The t-statistic is (75 − 72) ÷ 1.5 = 2.0. Degrees of freedom = 16 − 1 = 15. The two-sided critical t-value at df = 15 and α = 0.05 is about 2.131. Because 2.0 is less than 2.131, fail to reject the null. Notice that the same statistic value of 2.0 would have been significant against the z critical value of 1.96 — the t-test's higher bar is exactly the extra caution that estimating s demands.
One More Case: Z-Test for Proportions
There is a second setting where the z-test is standard regardless of any standard deviation: tests about a population proportion. When the data is counts of successes and failures — pass rates, defect rates, the share who agree — the test statistic uses the normal approximation to the binomial, so it is a z-test. There is no "t-test for a proportion." If the question is about a percentage or a proportion, reach for z.
Getting Help
Choosing a test is one step inside a full hypothesis test, so see how it fits the whole procedure in setting up a hypothesis test. Both tests end in a p-value, and p-values explained covers how to read that number once you have it.
Conclusion
The t-test vs. z-test decision is not really a judgment call — it is a lookup. Known population standard deviation means a z-test; an estimate from the sample means a t-test. The t-distribution's heavier tails build in the extra uncertainty of that estimate, which is why the t-test sets a slightly higher bar for significance. For proportions, use a z-test. When you genuinely cannot tell, the t-test is the safe default, because it is correct whenever the z-test is and forgiving when it is not.