Skip to content

When do you use a t-test instead of a z-test

Use a t‑test when the population standard deviation is unknown and the sample is small (usually n < 30); use a z‑test when the population standard deviation is known or the sample is large enough for the Central Limit Theorem to justify approximating the sampling distribution with a normal curve.

Statistics · Hypothesis testing


A t‑test and a z‑test are both methods for testing a hypothesis about a population mean, but they differ in the information available about variability. The z‑test assumes you know the true population standard deviation σ, which is rare in practice. The t‑test replaces σ with the sample standard deviation s, accounting for extra uncertainty when the sample size is limited.

Key Conditions

Use a t‑test when:

  • σ is unknown and must be estimated from the data
  • Sample size is small (n < 30) or moderate with unknown σ
  • Data are approximately normally distributed

When the sample size grows, the sample standard deviation becomes a reliable estimator of σ, and the t‑distribution approaches the standard normal distribution. This is why many textbooks allow a z‑test for n ≥ 30 if σ is still unknown but the sample is large. However, the safest rule is to default to the t‑test unless you truly know σ from prior studies or physical measurement.

Choose the correct test by following these steps:

  1. 1Determine whether σ is known from theory or previous experiments.
  2. 2Check the sample size; if n ≥ 30 and σ is unknown, you may approximate with a z‑test.
  3. 3Assess normality; for small n, ensure the data are roughly bell‑shaped or use a non‑parametric alternative.

Comparison of t‑test and z‑test:

Aspectt‑testz‑test
σ knownNoYes
Typical nSmall to moderateLarge (≥30)
Distribution usedStudent's t with df = n‑1Standard normal (Z)

Worked example: A researcher measures the breaking strength of 12 steel rods and obtains a mean of 58.4 MPa with a sample standard deviation of 3.2 MPa. The population σ is unknown, so a one‑sample t‑test is appropriate. The test statistic is t=xˉμ0s/n=58.4603.2/121.73 t = \frac{\bar{x}-\mu_0}{s/\sqrt{n}} = \frac{58.4-60}{3.2/\sqrt{12}} \approx -1.73 . With 11 degrees of freedom, the two‑tailed p‑value is about 0.11, so the null hypothesis of a mean of 60 MPa is not rejected at the 0.05 level.

Check yourself

What is the primary reason to prefer a t‑test over a z‑test?

Get this as a lesson built for you

Describe what you are studying and Lernex writes the lesson and the questions around it. Free, and it takes about a minute.

Try it

No account needed to try it.

What people ask next