t-test vs z-test: when to use each

By Jude Wallis · Published

Use a z-test when you are testing a proportion (categorical data), and a t-test when you are testing a mean (quantitative data). Means use t because the population standard deviation is almost always unknown, so you estimate it with the sample standard deviation, which adds uncertainty.

In the Fall 2026 AP Statistics course, proportion inference lives in Unit 3 and uses z procedures, while mean inference lives in Unit 4 and uses t procedures because sigma is unknown; this guide spans both.

The quick answer: t-test vs z-test

Here is the whole decision in one line: test a proportion with a z-test, and test a mean with a t-test. That rule covers nearly every inference question you will meet in AP Statistics, so if you remember nothing else, remember that.

The reason comes down to a single quantity, the population standard deviation, written σ\sigma (the Greek letter sigma). When you test a mean, σ\sigma is unknown, so you replace it with the sample standard deviation ss computed from your own data. Estimating σ\sigma adds extra uncertainty, and the t distribution is built to absorb it. When you test a proportion, there is no separate standard deviation to estimate, so the normal (z) distribution applies directly.

Put another way: data summarized as a sample proportion p^\hat{p} (p-hat, the sample proportion) use z, and data summarized as a sample mean xˉ\bar{x} (x-bar, the sample mean) use t.

When to use a t-test

Use a t-test whenever the parameter you care about is a population mean μ\mu (mu, the population mean) and you do not know the true population standard deviation σ\sigma. That last condition is the deciding factor, and in practice it is almost always met, because knowing σ\sigma exactly would mean you already understand the spread of the whole population you are trying to study.

Since you cannot use σ\sigma, you estimate the spread from the sample and build the standard error from ss:

SE=snSE = \frac{s}{\sqrt{n}}

where ss is the sample standard deviation and nn is the sample size. Plugging an estimate into the denominator of the test statistic makes that statistic bounce around more than a clean z-score would, and the t distribution with n1n - 1 degrees of freedom is the exact correction for that extra bounce.

There is one textbook exception. If σ\sigma were known, the statistic (xˉμ0)/(σ/n)(\bar{x} - \mu_0)/(\sigma/\sqrt{n}) would follow a standard normal distribution and you could use z for a mean. Real datasets rarely hand you σ\sigma, so means are tested with t.

The difference between the t and z distribution

The difference between the t and z distribution is shape. Both curves are symmetric and bell-shaped, and both are centered at 0, but the t distribution has heavier tails, meaning more of its area sits far from the center. Those heavier tails produce larger critical values, so a t-based confidence interval comes out a little wider than a z-based one at the same confidence level. That extra width is the honest cost of estimating σ\sigma instead of knowing it.

How heavy the tails are depends on the degrees of freedom, which equal n1n - 1 for a one-sample t procedure. A small sample has few degrees of freedom and the heaviest tails. As nn grows, ss becomes a steadier estimate of σ\sigma, the degrees of freedom rise, and the t curve tightens toward the standard normal curve. With infinite degrees of freedom the two are identical.

By the time nn reaches the low hundreds the gap is tiny, which is why t works as a safe default for means at any sample size. See standard error vs standard deviation if the s/ns/\sqrt{n} step is still fuzzy.

z-test or t-test: a side-by-side comparison

This table lines up the two tests on the features that actually decide which one you run. In the standard error row, p0p_0 is the proportion assumed under the null hypothesis.

Featurez-testt-test
Parameter testedPopulation proportion ppPopulation mean μ\mu
Data typeCategorical (counts, yes/no)Quantitative (measurements)
StatisticSample proportion p^\hat{p}Sample mean xˉ\bar{x}
DistributionStandard normal (z)t with n1n - 1 df
WhySD of p^\hat{p} depends only on ppσ\sigma unknown, estimated by ss
Standard errorp0(1p0)/n\sqrt{p_0(1-p_0)/n}s/ns/\sqrt{n}
AP unitUnit 3Unit 4

Two-sample versions follow the same rule

The same logic extends to comparing two groups. To compare two proportions (for example, the approval rate in two cities), you run a two-sample z-test. Under the null hypothesis that the two proportions are equal, you pool the data into a combined proportion p^c=n1p^1+n2p^2n1+n2\hat{p}_c = \frac{n_1\hat{p}_1 + n_2\hat{p}_2}{n_1 + n_2} (p-hat-c, the combined sample proportion) and build the standard error p^c(1p^c)(1n1+1n2)\sqrt{\hat{p}_c(1-\hat{p}_c)\left(\frac{1}{n_1} + \frac{1}{n_2}\right)}. To compare two means (for example, average test scores under two teaching methods), you run a two-sample t-test, with standard error s12n1+s22n2\sqrt{\frac{s_1^2}{n_1} + \frac{s_2^2}{n_2}} and no pooling, since each group's spread is estimated from its own sample.

The tie-breaker never changes. Proportions stay with z because their standard deviation is fixed by the proportion itself, and means stay with t because each group's spread is estimated from its own sample. For the finer points of comparing proportions, see one-proportion vs two-proportion z-test.

How t-tests and z-tests map to the AP exam

On the Fall 2026 AP Statistics course, the split is clean. Unit 3, Inference for Categorical Data: Proportions, uses z procedures for one proportion and for the difference between two proportions. Unit 4, Inference for Quantitative Data: Means, uses t procedures for one mean and for the difference between two means, because the population standard deviation is unknown and the sample standard deviation is used instead.

Formulas and tables are provided during both sections of the exam, so you do not have to recall critical values from memory, but you are expected to choose the correct procedure yourself. When you are deciding, ask first whether the response is categorical or quantitative, then apply the rule.

You can check your work with the one-sample t-test calculator or the proportion z-test calculator, and see the full menu of options in which statistical test to use.

Decide-which scenario: a voter poll (proportion, so z)

A campaign polls 200 randomly selected voters and finds that 116 say they support a ballot measure. Is there evidence that more than half of all voters support it? Which test applies, and what is the test statistic?

  1. Identify the data type. Each voter gives a categorical response, support or not support, summarized as a sample proportion. Inference about a proportion uses a z-test.

  2. Sample proportion: p^=116200=0.58\hat{p} = \frac{116}{200} = 0.58.

  3. State the parameter and hypotheses. Let pp be the population proportion of voters who support the measure. Null hypothesis p=0.50p = 0.50, alternative p>0.50p > 0.50.

  4. Standard deviation of p^\hat{p} using the hypothesized value p0=0.50p_0 = 0.50: p0(1p0)n=0.50×0.50200=0.25200=0.00125=0.035355\sqrt{\frac{p_0(1-p_0)}{n}} = \sqrt{\frac{0.50 \times 0.50}{200}} = \sqrt{\frac{0.25}{200}} = \sqrt{0.00125} = 0.035355.

  5. Test statistic: z=p^p00.035355=0.580.500.035355=0.080.035355=2.263z = \frac{\hat{p} - p_0}{0.035355} = \frac{0.58 - 0.50}{0.035355} = \frac{0.08}{0.035355} = 2.263.

The data are a proportion, so the correct procedure is a one-sample z-test. The test statistic is z2.263z \approx 2.263.

Decide-which scenario: seedling growth (mean, so t)

A greenhouse records the two-week growth, in centimeters, of 5 randomly chosen seedlings: 11, 13, 12, 15, 14. The seed packet claims the mean growth is 12 cm. You want to test whether the true mean growth differs from 12 cm. Which test applies, and what is the test statistic?

  1. Identify the data type. Growth is a quantitative measurement, summarized as a sample mean, and the population standard deviation is unknown. Inference about the mean uses a t-test.

  2. Sample mean: xˉ=11+13+12+15+145=655=13\bar{x} = \frac{11 + 13 + 12 + 15 + 14}{5} = \frac{65}{5} = 13 cm.

  3. Deviations from the mean and their squares: (1113)=24(11-13)=-2 \rightarrow 4; (1313)=00(13-13)=0 \rightarrow 0; (1213)=11(12-13)=-1 \rightarrow 1; (1513)=24(15-13)=2 \rightarrow 4; (1413)=11(14-13)=1 \rightarrow 1. Sum of squares =4+0+1+4+1=10= 4 + 0 + 1 + 4 + 1 = 10.

  4. Sample variance s2=1051=104=2.5s^2 = \frac{10}{5-1} = \frac{10}{4} = 2.5, so the sample standard deviation s=2.5=1.5811s = \sqrt{2.5} = 1.5811.

  5. Standard error: sn=1.58115=1.58112.2361=0.7071\frac{s}{\sqrt{n}} = \frac{1.5811}{\sqrt{5}} = \frac{1.5811}{2.2361} = 0.7071.

  6. Degrees of freedom =n1=4= n - 1 = 4. Test statistic: t=xˉμ00.7071=13120.7071=10.7071=1.414t = \frac{\bar{x} - \mu_0}{0.7071} = \frac{13 - 12}{0.7071} = \frac{1}{0.7071} = 1.414.

The data are a mean with unknown σ\sigma, so the correct procedure is a one-sample t-test with 4 degrees of freedom. The test statistic is t1.414t \approx 1.414.

Frequently asked questions

Can you use a z-test for a mean?

Only if you know the population standard deviation σ\sigma exactly, which almost never happens with real data. When σ\sigma is unknown you estimate it with the sample standard deviation ss and use a t-test instead. That is why mean inference in AP Statistics is done with t procedures.

At what sample size does the t-test become a z-test?

There is no exact cutoff. As the sample size and degrees of freedom increase, the t distribution moves steadily toward the standard normal, and the two match only in the limit of infinite degrees of freedom. Some textbooks treat about 30 as a rough point where the difference stops mattering, but the t procedure stays valid at every sample size, so you can always use it for a mean.

Why don't proportions use a t-test?

The standard deviation of a sample proportion depends only on the proportion itself, so there is no separate spread parameter to estimate from the data. Because nothing extra is estimated, no degrees-of-freedom correction is needed and the normal (z) distribution applies once the sample is large enough.