Hypothesis Testing Inferential Statistics Statistical Tests 24 min read July 16, 2026
BY: Statistics Fundamentals Team
Reviewed By: Minsa A (Senior Statistics Editor)

T-Test vs Z-Test: Which Should You Use?

Both tests ask the same question — is my sample mean far enough from the hypothesized value to rule out chance? The test you choose depends on one primary factor: whether you know the population standard deviation. If you do, you run a z-test. If you don't (which covers the vast majority of real studies), you run a t-test. The interactive selector below will confirm the right choice for your situation.

This guide covers the exact decision rules, formula differences, distribution shapes, assumptions, and five fully worked examples across clinical research, manufacturing, marketing, education, and finance — each showing the complete 6-step hypothesis test with both tests where relevant.

What You'll Learn
  • ✓ The single most important question that decides which test to use
  • ✓ Why the t-distribution has heavier tails than the normal distribution
  • ✓ What degrees of freedom are and why the t-test needs them
  • ✓ The n ≥ 30 rule — what it means and when to ignore it
  • ✓ Side-by-side formulas, assumptions, and worked examples
  • ✓ An interactive calculator that runs both tests and compares results

The Core Difference in One Sentence

📌
Featured Snippet — T-Test vs Z-Test

A z-test uses the known population standard deviation (σ) and the standard normal distribution. A t-test estimates standard deviation from the sample (s) and uses the t-distribution, which has heavier tails to account for that uncertainty. Both test whether a sample mean differs significantly from a hypothesized value, but the t-test is correct for the vast majority of real research because σ is almost never known.

Think of it this way. Suppose you want to know whether a factory's output weighs what the label says. If you have years of historical records giving you the exact population-level variability, you can use a z-test. But in a new study — a clinical trial, a survey, a classroom experiment — you only have the data in front of you, so you estimate the variability from your sample. That estimation introduces an extra layer of uncertainty, and the t-distribution is the mathematical tool built to handle it.

The two tests share the same logic and nearly the same formula. The critical difference is in the denominator (which standard deviation you use) and the distribution you compare against to get a p-value.

σ known
Use the Z-Test
σ unknown
Use the T-Test
n < 30
Always use T-Test
n ≥ 30, σ known
Z-Test is valid

What Each Test Is

The T-Test

Definition — T-Test
A t-test is a parametric hypothesis test that compares a sample mean to a hypothesized value (or compares two sample means) using the t-distribution. It is appropriate when the population standard deviation is unknown and must be estimated from the sample using s.
t = (x̄ − μ₀) / (s / √n)

The t-test was developed by William Sealy Gosset, writing under the pseudonym "Student" at the Guinness brewery in 1908. He needed a method for drawing conclusions from small batches of barley and hops where population parameters were never known in advance. The resulting test — still called Student's t-test — remains one of the most widely used procedures in statistics.

What makes the t-distribution different from the normal distribution is its shape. Because you're estimating σ from your data, there's more variability in your estimate when sample sizes are small. The t-distribution accounts for this by having heavier tails — it assigns more probability to extreme values than the normal distribution does. As your sample size grows, this extra uncertainty shrinks, and the t-distribution gradually converges to the normal distribution.

The Z-Test

Definition — Z-Test
A z-test is a parametric hypothesis test that compares a sample mean to a hypothesized value using the standard normal (z) distribution. It requires that either the population standard deviation σ is known, or that the sample size is large enough for the central limit theorem to ensure an approximately normal sampling distribution.
z = (x̄ − μ₀) / (σ / √n)

The z-test relies on the central limit theorem: regardless of the population's original distribution, the distribution of sample means becomes approximately normal as n grows. When n is large (typically n ≥ 30 is the rule of thumb), the sample standard deviation s is a reliable estimate of σ, and the distinction between the two tests narrows significantly.

Z-tests are also used for comparing proportions — for example, whether the fraction of customers who click a button differs between two website designs. The z-test calculator handles both mean and proportion tests.

The t-distribution was first described in: Gosset, W.S. ("Student"). (1908). "The probable error of a mean." Biometrika, 6(1), 1–25. The z-test's theoretical foundation rests on Fisher, R.A. (1925). Statistical Methods for Research Workers. Edinburgh: Oliver and Boyd. Formula notation follows the NIST/SEMATECH Engineering Statistics Handbook.

Formulas Side by Side

The structure of both test statistics is identical: subtract the null hypothesis mean from the sample mean, then divide by the standard error. The only difference is which standard deviation goes into the standard error calculation.

T-Test Statistic (σ Unknown)
t = (x̄ − μ₀) / (s / √n)
= sample mean μ₀ = hypothesized mean (H₀) s = sample standard deviation n = sample size df = n − 1 (degrees of freedom)
Z-Test Statistic (σ Known)
z = (x̄ − μ₀) / (σ / √n)
= sample mean μ₀ = hypothesized mean (H₀) σ = known population standard deviation n = sample size Compare to z-table (no df needed)

After computing the test statistic, the comparison step differs. For a t-test, you look up the p-value using the t-distribution with n − 1 degrees of freedom. For a z-test, you look up the p-value using the standard normal distribution (the z-table). Common critical values for reference:

Significance Level (α) Test Type Z Critical Value T Critical Value (df = 10) T Critical Value (df = 30)
0.05Two-tailed±1.960±2.228±2.042
0.05One-tailed±1.645±1.812±1.697
0.01Two-tailed±2.576±3.169±2.750
0.01One-tailed±2.326±2.764±2.457
0.10Two-tailed±1.645±1.812±1.697

Notice that at df = 30 the t critical values are already close to z critical values. At df = 120, they are nearly identical. This is why large samples make the choice less consequential in practice.

Critical values for the t-distribution from: t-distribution table on Statistics Fundamentals. For the complete z-table, see the NIST Standard Normal Probability Table.

When to Use Which Test

The decision framework is straightforward. Answer the questions in order and you will arrive at the right test every time.

Decision Tree: T-Test vs Z-Test

Is the population standard deviation σ known with certainty?
→ No
✅ Use the T-Test (σ unknown → always t-test)
σ is known. Is the sample size n < 30?
→ Yes
✅ Use the T-Test (small sample → more uncertainty)
σ is known AND n ≥ 30 (or population is normal)?
→ Yes
⬛ Z-Test is valid here
Testing proportions (p)? Are np ≥ 10 and n(1−p) ≥ 10?
→ Yes
⬛ Use the Z-Test for proportions
Comparing two means? Is σ known for both groups?
→ No
✅ Use Two-Sample T-Test (Welch's or pooled)
Before-and-after measurements on the same subjects?
→ Yes
✅ Use Paired T-Test
⚠️
The n ≥ 30 Rule: A Convention, Not a Law

Many textbooks say "use z-test when n ≥ 30." This is a practical simplification. The t-test is technically always more correct when σ is unknown — even with n = 200. The reason the rule exists is that for large n, the difference in results is negligible. Most modern statisticians and software default to t-test for all mean comparisons, regardless of sample size, when σ is unknown.

Full Comparison Table

Feature T-Test Z-Test
Standard deviation usedSample SD (s) — estimated from dataPopulation SD (σ) — known in advance
Reference distributiont-distribution (df = n − 1)Standard normal distribution (z)
Degrees of freedomRequired (n − 1 for one-sample)Not needed
Typical sample sizeAny size; especially n < 30n ≥ 30, or σ known
Distribution shapeHeavier tails than normal; shape depends on dfFixed bell curve (μ = 0, σ = 1)
Critical valuesHigher than z-values (more conservative)Fixed: ±1.645 (α=.05 one-tail), ±1.96 (α=.05 two-tail)
Formulat = (x̄ − μ₀) / (s / √n)z = (x̄ − μ₀) / (σ / √n)
Used for proportions?No (use z-test for proportions)Yes (when np ≥ 10 and n(1−p) ≥ 10)
When σ is unknownCorrect choiceIncorrect — do not substitute s for σ and use z
Software defaultR, Python, SPSS, Excel default to t-test for meansExplicit z-test function required
Converges to the other?Yes — as df → ∞, t → zZ is the limit of t as n increases
Common applicationsMedical trials, psychology, education, business experimentsLarge surveys, quality control with known process σ, A/B testing proportions

T-Distribution vs Normal Distribution

Understanding why the t-distribution looks the way it does explains why the two tests exist. The key is in what happens when you replace σ with s in the denominator of the test statistic.

When σ is known, the standardized statistic (x̄ − μ₀) / (σ / √n) follows a perfect standard normal distribution — a fixed bell curve centered at zero with standard deviation of 1. Its shape does not change with sample size.

When you substitute s for σ, you introduce sampling variability in the denominator. Sometimes s overestimates σ, sometimes it underestimates. This extra randomness makes the ratio more volatile — you get more extreme values than a standard normal distribution would predict. The t-distribution captures this by having fatter tails that shrink as n increases.

How Degrees of Freedom Change the Shape

Why small samples need heavier tails

Degrees of Freedom (df) t critical value at α = .05 (two-tailed) Standard normal z-value Extra coverage needed
df = 112.7061.960+549%
df = 52.5711.960+31%
df = 102.2281.960+14%
df = 302.0421.960+4%
df = 1201.9801.960+1%
df = ∞1.9601.9600% (identical)

With df = 1 (n = 2), the t critical value is over 12 — you need extreme evidence before rejecting H₀ because your estimate of σ from just two observations is unreliable. As df grows, this conservatism disappears.

The practical implication: at any given sample of data, the t-test gives a wider confidence interval and a higher p-value than a z-test using the same numbers. This is intentional — it is the t-distribution being honest about the uncertainty in s as an estimator of σ.

Distribution convergence properties: Rice, J.A. (2007). Mathematical Statistics and Data Analysis, 3rd ed. Duxbury Press. Section 7.3. For a visual comparison, see the t-distribution vs normal distribution guide on Statistics Fundamentals.

Assumptions of Each Test

Both tests have conditions that must hold for the results to be valid. Violating them does not necessarily make the test useless — some violations matter more than others — but knowing them helps you decide whether your data qualifies.

Assumption T-Test Z-Test
Random samplingRequiredRequired
Independence of observationsRequiredRequired
Population normality (or CLT)Required for small n; CLT handles large nRequired; CLT applies for n ≥ 30
Continuous numeric dataRequiredRequired (proportions use different z-formula)
σ knownNo — s used insteadYes — σ must be known, not estimated
Finite population correctionOptional for large populationsOptional for large populations
The Robustness of the T-Test

The one-sample t-test is robust to violations of normality when n ≥ 30 because of the central limit theorem. Mild to moderate skew in the population has little effect on the t-test with moderate sample sizes. Severe outliers, however, can distort results at any sample size — use Winsorization or a nonparametric test like the Wilcoxon signed-rank test in those cases.

A common error is performing a z-test when σ is estimated from prior data rather than truly known. If you estimated σ from a previous study's sample, it carries sampling error itself — it is not the true population σ. The t-test is the correct choice. See the statistical assumptions guide for how to test each condition formally.

Interactive Test Selector

Answer four questions about your study and the selector will tell you which test to run, with a brief reason.

🔍 Which Test Should I Use?

5 Worked Examples

Each example uses the 6-step hypothesis testing procedure and shows the full arithmetic. The same problem is solved twice where both tests could apply, so you can see how the results compare.

Example 1 — One-Sample T-Test (σ Unknown)

Worked Example 1 — One-Sample T-Test

Problem: A nutritionist believes the average daily sodium intake of adults in a city exceeds the WHO recommendation of 2,000 mg. A random sample of 18 adults yields x̄ = 2,310 mg with s = 480 mg. Test at α = 0.05.

One-Sample T-Test Formula
t = (x̄ − μ₀) / (s / √n)
s = 480 mg (sample SD) n = 18 df = 17
1

Hypotheses: H₀: μ = 2,000 mg  |  H₁: μ > 2,000 mg (one-tailed, right)

2

Significance level: α = 0.05. One-tailed test; with df = 17, critical value from the t-distribution table is t* = 1.740.

3

Test selection: T-test. σ is unknown and n = 18 < 30, so the t-distribution is required. See the one-sample t-test guide.

4

Test statistic:
SE = s / √n = 480 / √18 = 480 / 4.243 = 113.12
t = (2,310 − 2,000) / 113.12 = 310 / 113.12 = 2.74

5

p-value: For t = 2.74 with df = 17 (one-tailed): p ≈ 0.007

6

Decision: p = 0.007 < 0.05 → Reject H₀. Also: t = 2.74 > t* = 1.740.

✅ Conclusion: At α = 0.05, there is statistically significant evidence (p = 0.007) that the average daily sodium intake in this city exceeds 2,000 mg. Because σ was unknown and n = 18, the t-test with df = 17 was the correct choice — a z-test would have been inappropriate here.

Example 2 — One-Sample Z-Test (σ Known)

Worked Example 2 — One-Sample Z-Test

Problem: A nationwide standardized test has a known population standard deviation of σ = 15 points. A local school's sample of 60 students scores x̄ = 103. The national mean is μ₀ = 100. At α = 0.05, does this school's average differ from the national mean?

One-Sample Z-Test Formula
z = (x̄ − μ₀) / (σ / √n)
σ = 15 (known population SD) n = 60
1

Hypotheses: H₀: μ = 100  |  H₁: μ ≠ 100 (two-tailed)

2

Significance level: α = 0.05. Two-tailed z-test critical values: ±1.96. See the full z-table.

3

Test selection: Z-test. σ = 15 is given as a known population parameter (from national test standardization), and n = 60 ≥ 30. Both conditions for the z-test are met.

4

Test statistic:
SE = σ / √n = 15 / √60 = 15 / 7.746 = 1.936
z = (103 − 100) / 1.936 = 3 / 1.936 = 1.549

5

p-value: For |z| = 1.549 (two-tailed): p ≈ 0.121

6

Decision: p = 0.121 > 0.05 → Fail to Reject H₀. Also: |z| = 1.549 < 1.96.

❌ Conclusion: There is not enough evidence (p = 0.121) to conclude this school's mean differs from the national average of 100. The 3-point difference is within the range expected from sampling variation when n = 60 and σ = 15.

Example 3 — Same Data, Both Tests: See the Difference

Worked Example 3 — T-Test vs Z-Test Comparison

Problem: A manufacturer claims bolt tensile strength averages 500 N. A quality inspector samples n = 25 bolts and finds x̄ = 487 N with s = 30 N. Run both a t-test (treating σ as unknown) and a z-test (wrongly treating s as if it were σ) and compare the results at α = 0.05, two-tailed.

1

Hypotheses: H₀: μ = 500 N  |  H₁: μ ≠ 500 N (two-tailed)

2

SE: SE = 30 / √25 = 30 / 5 = 6.00  |  Test statistic: (487 − 500) / 6 = −13 / 6 = −2.167

3

T-Test (correct): df = 24. Critical value = ±2.064. |t| = 2.167 > 2.064 → Reject H₀. p ≈ 0.040.

4

Z-Test (incorrect here, for illustration): Critical value = ±1.96. |z| = 2.167 > 1.96 → Reject H₀. p ≈ 0.030.

5

What changed: Same conclusion here, but the t-test gives p = 0.040 while the z-test gives p = 0.030. If the true mean were closer to 500 N, the discrepancy could flip the conclusion. The z-test gives artificially low p-values when σ is estimated, making it easier to reject H₀ than it should be.

⚠️ Key lesson: Both reject here, but using a z-test when σ is unknown inflates Type I error (false positives). The t-test with df = 24 is the correct test. Its critical value (2.064) is higher than z's (1.96) specifically to compensate for not knowing the true σ. Use the t-test calculator for this type of problem.

Example 4 — Two-Sample T-Test

Worked Example 4 — Two-Sample T-Test

Problem: A clinical trial compares a drug (n₁ = 30, x̄₁ = 142 mmHg, s₁ = 18) against a placebo (n₂ = 30, x̄₂ = 151 mmHg, s₂ = 20). Does the drug lower blood pressure significantly at α = 0.05?

Two-Sample T-Test (Welch's)
t = (x̄₁ − x̄₂) / √(s₁²/n₁ + s₂²/n₂)
1

Hypotheses: H₀: μ₁ = μ₂  |  H₁: μ₁ < μ₂ (one-tailed: drug lowers BP)

2

Test selection: Two-sample Welch's t-test. σ for both groups is unknown. Full details at the two-sample t-test guide.

3

Test statistic:
SE = √(18²/30 + 20²/30) = √(10.8 + 13.33) = √24.13 = 4.913
t = (142 − 151) / 4.913 = −9 / 4.913 = −1.832

4

p-value: Welch's df ≈ 57. For t = −1.832 (one-tailed): p ≈ 0.036

5

Decision: p = 0.036 < 0.05 → Reject H₀.

✅ Conclusion: At α = 0.05, there is statistically significant evidence that the drug reduces blood pressure compared to the placebo (p = 0.036). The two-sample t-test was required because population SDs were unknown for both groups.

Example 5 — Z-Test for Proportions

Worked Example 5 — Z-Test for Proportions

Problem: A marketing team claims their email open rate is 25%. Of n = 400 emails sent in a new campaign, 88 were opened (p̂ = 0.22). At α = 0.05, does the campaign open rate differ from the claimed 25%?

Z-Test for Proportions
z = (p̂ − p₀) / √(p₀(1−p₀)/n)
= 88/400 = 0.22 p₀ = 0.25 n = 400
1

Hypotheses: H₀: p = 0.25  |  H₁: p ≠ 0.25 (two-tailed)

2

Test selection: Z-test for proportions. Check conditions: np₀ = 400 × 0.25 = 100 ≥ 10 and n(1−p₀) = 300 ≥ 10. Both satisfied. Critical values: ±1.96.

3

Test statistic:
SE = √(0.25 × 0.75 / 400) = √(0.1875 / 400) = √0.000469 = 0.02165
z = (0.22 − 0.25) / 0.02165 = −0.03 / 0.02165 = −1.386

4

p-value: For |z| = 1.386 (two-tailed): p ≈ 0.166

5

Decision: p = 0.166 > 0.05 → Fail to Reject H₀.

❌ Conclusion: There is insufficient evidence (p = 0.166) to conclude the campaign's open rate differs from 25%. The observed 22% rate is within the range of sampling variability expected from a true 25% rate with n = 400. This is the one case where the z-test applies even though σ is not a quantity in the traditional sense — the proportion's variance is determined entirely by p₀, so there's nothing unknown to estimate. See the z-test calculator for proportion testing. For more on A/B testing, see how statistics powers A/B testing.

Interactive T-Test and Z-Test Calculator

Enter your data below. Select t-test when σ is unknown (the typical case), or z-test when σ is genuinely known. The calculator handles one-sample tests and all three tail directions.

🧮 One-Sample T-Test / Z-Test Calculator

For more test types, visit the dedicated t-test calculator (paired and two-sample), the z-test calculator, and the confidence interval calculator.

Common Mistakes and How to Avoid Them

Mistake Wrong Approach Correct Approach
Using z-test when σ is unknown Running z-test with s in place of σ "because n is large" Use t-test. s ≠ σ regardless of sample size — t-test handles this correctly
Applying one-sample test to paired data Running two separate one-sample t-tests (before and after) independently Use the paired t-test on the differences d = after − before
Using z-test for proportions without checking conditions Applying proportion z-test when np < 10 Verify np₀ ≥ 10 and n(1−p₀) ≥ 10. If not, use Fisher's exact test
Treating a prior study's s as σ Assuming s from a previous sample is the population σ and using a z-test A sample SD from a previous study still carries estimation error — use t-test
Wrong degrees of freedom Using df = n for one-sample t-test Degrees of freedom = n − 1 for one-sample; use Welch's df formula for two-sample
Ignoring the direction of H₁ Using two-tailed p-value when the hypothesis was directional Set tail direction in H₁ before seeing data. One-tailed p = two-tailed p ÷ 2 (if in the right direction)

Where Each Test Gets Used

Choosing the right test matters beyond the textbook. Here are the fields where each test appears in practice, and what the decision looks like in each context.

🏥

Clinical Research

Nearly always uses the t-test. Patient measurements (blood pressure, cholesterol, tumor markers) come from study samples. Population SDs for these outcomes are never truly known before the study.

🏭

Manufacturing QC

Often uses z-test. Long-established production lines can have genuine historical σ from thousands of measurements. When a process is well-understood, σ may legitimately be treated as known.

📊

A/B Testing (Marketing)

Z-test for proportions (click-through rates, conversion rates). T-test for continuous outcomes (average session duration, revenue per visitor). See A/B test calculator.

🎓

Education Research

T-test is standard. Standardized tests publish national means, but the national SD applies to a heterogeneous population that differs from any specific school sample. Individual school σ is unknown.

💰

Finance

Both tests appear. Portfolio return analysis typically uses t-test (σ of returns unknown ex ante). Proportion tests (default rates, fraud rates) use z-test when samples are large.

🧬

Biomedical Research

T-test dominates for biomarker comparisons between treatment groups. Z-test appears in large epidemiological studies comparing rates across populations with well-characterized SDs.

Applied usage patterns in clinical trials: Altman, D.G. (1991). Practical Statistics for Medical Research. Chapman and Hall. Manufacturing applications: Montgomery, D.C. (2019). Introduction to Statistical Quality Control, 8th ed. John Wiley & Sons. Both texts are standard references in their fields and confirm the decision framework described here. See also the statistical test selector for a broader test-selection guide.

The Sampling Distribution Behind Each Test

The reason two separate tests exist comes down to a theoretical result in statistics called the distribution of the studentized mean. When σ is known:

When σ is known
(x̄ − μ) / (σ / √n) ~ N(0, 1)
This ratio follows a standard normal distribution exactly

But when you substitute s for σ, the ratio no longer follows N(0, 1). It follows a t-distribution with n − 1 degrees of freedom:

When σ is unknown (s substituted)
(x̄ − μ) / (s / √n) ~ t(n−1)
This follows a t-distribution with df = n − 1 Shape depends on sample size Heavier tails than N(0,1)

This is not a convention or a heuristic — it is a mathematical theorem. The t-distribution arises because s is itself a random variable (it varies from sample to sample), and combining two sources of randomness (x̄ and s) creates a distribution with heavier tails than the normal. The degrees of freedom parameter captures how much variability s has: small df (small n) means s is unreliable, so the tails are fat; large df means s is close to σ, so the tails thin out toward the normal.

For a deeper look at how sampling distributions work, see the central limit theorem guide and the sampling distributions overview.

What Are Degrees of Freedom?

Degrees of freedom is the one concept that separates the t-test from the z-test procedurally. The z-test has no degrees of freedom parameter — you simply look up a single fixed critical value table. The t-test requires you to specify df = n − 1 before consulting the t-table, because the distribution changes with every different sample size.

The intuition: when you compute s from n observations, you first compute the sample mean x̄ and then compute deviations from it. Because those deviations must sum to zero, only n − 1 of them are free to vary — the last one is determined by the others. So n − 1 is the degrees of freedom: the number of independent pieces of information in your estimate of variability.

📐
Degrees of Freedom in Different T-Tests

One-sample t-test: df = n − 1. Two-sample (pooled) t-test: df = n₁ + n₂ − 2. Welch's two-sample t-test: df is computed from a more complex formula involving both sample sizes and SDs. Paired t-test: df = n_pairs − 1. Full details at the degrees of freedom guide.

Running These Tests in Software

Every major statistics package includes both tests, though their defaults and function names differ. Knowing which function to call prevents choosing the wrong test by mistake.

Software T-Test Command Z-Test Command Notes
Python (scipy)scipy.stats.ttest_1samp(data, mu)statsmodels.stats.weightstats.ztestscipy defaults to t-test for means
Rt.test(x, mu = 100)BSDA::z.test(x, sigma.x = σ)Base R has t.test; z.test requires BSDA package
SPSSAnalyze → Compare Means → One-Sample T TestNot natively available; use syntax ZTESTSPSS defaults to t-test
Excel=T.TEST() or Data Analysis ToolPak → t-Test=Z.TEST(data, μ, σ)Z.TEST requires σ as third argument
MATLAB[h,p,ci,stats] = ttest(x, mu)Not built-in; compute z manuallyMATLAB does not have a built-in z-test for means
MinitabStat → Basic Statistics → 1-Sample tStat → Basic Statistics → 1-Sample ZMinitab has both explicitly

Notice that Python's scipy and R's base package default to the t-test, treating it as the correct choice for mean inference. This reflects modern statistical practice: when in doubt about whether σ is truly known, the t-test is the safer, more honest choice.

Frequently Asked Questions

A t-test uses the sample standard deviation and the t-distribution, while a z-test uses the known population standard deviation and the standard normal distribution. The t-test accounts for the additional uncertainty that comes from estimating the population standard deviation, making it the preferred choice in most real-world studies.
Use a t-test whenever the population standard deviation is unknown, which is the case in most research. It is also the appropriate test for small samples, paired data, and comparisons of two group means when the population variability must be estimated from the sample.
A z-test is appropriate when the population standard deviation is known and the data meet the assumptions of the normal distribution. It is also widely used for hypothesis tests involving proportions when the sample size is large enough for the normal approximation to be valid.
Yes. With small samples, the t-distribution has heavier tails than the normal distribution, resulting in larger critical values and often larger p-values. As a result, a z-test may indicate statistical significance while a t-test does not. For large samples, the two tests usually produce nearly identical conclusions.
The t-test estimates the population standard deviation from the sample, so its distribution depends on the amount of information available, represented by the degrees of freedom. As the degrees of freedom increase, the t-distribution approaches the standard normal distribution. The z-test assumes the population standard deviation is known, so its distribution does not depend on sample size.
No. Although the z-test is rarely used for testing means because the population standard deviation is seldom known, it remains an important method for testing proportions and for many large-sample statistical procedures. The standard normal distribution continues to play a central role in statistical inference.
Most statistical software packages, including R, Python, SPSS, Excel, SAS, Stata, Minitab, and MATLAB, provide built-in functions for t-tests. Many also support z-tests directly or through additional packages. Online statistical calculators can also perform both tests without requiring specialized software.

Quick-Reference Summary

⚡ T-Test vs Z-Test — Decision Cheat Sheet
  • σ unknown → T-test (this is the case in virtually all real research)
  • σ known + n ≥ 30 → Z-test valid (but t-test still works and is more conservative)
  • n < 30 → T-test regardless of what you think you know about σ
  • Paired/before-after data → Paired t-test (compute d_i = after − before, then one-sample t-test on d)
  • Comparing two means → Two-sample t-test (Welch's unless variances are clearly equal)
  • Proportion testing (np ≥ 10) → Z-test for proportions
  • T-test formula: t = (x̄ − μ₀) / (s / √n), compare to t(df = n − 1)
  • Z-test formula: z = (x̄ − μ₀) / (σ / √n), compare to standard normal
  • Both tests converge for large n — at df = 120, t ≈ z to two decimal places
  • When in doubt: t-test is always the safer, more honest choice
🎓
Related Guides on Statistics Fundamentals

Continue building your hypothesis testing foundation: Hypothesis Testing overview · Understanding P-Values · Type I & II Errors · Statistical Power · Effect Size · Confidence Intervals · Hypothesis Testing Examples

Key references: Gosset, W.S. ("Student"). (1908). "The probable error of a mean." Biometrika, 6(1), 1–25.  |  Fisher, R.A. (1925). Statistical Methods for Research Workers. Edinburgh: Oliver and Boyd.  |  NIST Engineering Statistics Handbook — Hypothesis Testing.  |  OpenStax Introductory Statistics, Chapter 9 — Hypothesis Testing with One Sample.  |  SciPy ttest_1samp documentation.  |  Statsmodels z-test documentation.