The t-test and z-test answer the same kind of question — "is this mean different from that one?" — and their formulas look nearly identical. The confusion is understandable. But choosing between them comes down to one thing: do you know the population standard deviation?

The core difference

Both tests compute a standardized distance between your sample mean and a hypothesized value. The difference is which distribution you compare it against:

The deciding question: Is the population standard deviation known? If yes → z-test. If no (you're estimating it from the data) → t-test. In practice, σ is almost never known, so the t-test is the default in real research.

The "n > 30" rule of thumb

You'll often hear "use a z-test when n > 30." The reason: as the sample grows, the t-distribution converges to the normal distribution, so the two tests give almost the same answer. By df ≈ 30 the difference in critical values is tiny (t = 2.04 vs z = 1.96 at 95%). So for large samples it barely matters — but the t-test is never wrong, whereas the z-test assumes something you usually can't justify. When in doubt, use the t-test.

Z-TestT-Test
Population SD (σ)KnownUnknown (estimated)
Reference distributionNormalStudent's t (df)
Best forLarge n, known σAny n, unknown σ
Real-world useRareThe default

Worked intuition

Suppose a factory's bolts have a historically known σ = 0.5 mm, and you're checking whether a new batch's mean length drifted. Because σ is known from years of data, a z-test is defensible. But if you're testing a brand-new process with no history, you must estimate the SD from your 25 samples — that uncertainty is exactly what the t-test accounts for.

Which calculator do I use?

Our T-Test Calculator covers one-sample, two-sample, and paired designs — the situations you'll actually meet. For a pure standard-normal lookup (a known-σ scenario, or converting a value to a percentile), use the Z-Score Calculator or the z-table.

Run a T-Test →One-sample, two-sample, or paired — with an interpreted p-value.

Related: Choosing a statistical test · Interpreting p-values · T-table.