Halloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PCHalloween DealsAmazon USOctober picks are moving - compare before checkoutAmazon US: current deals, useful picks and tech finds.See Picks×
FREEDOM251

Freedom251 › Blog

Difference between T-Test and Z-Test

By Freedom251 Team · · 16 min read

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A t-test and a z-test are both statistical hypothesis tests used to compare means and decide whether an observed difference is likely to be real or due to random variation. They often appear similar because both produce a test statistic, use a significance level, and help evaluate claims about populations based on sample data.

The main difference is when each test is appropriate. A t-test is typically used when the sample size is small or the population variance is unknown, while a z-test is used when the sample size is large and the population variance is known or reliably estimated. Choosing the right test depends on sample size, data distribution, variance information, and the practical question being tested.

As an Amazon Associate I earn from qualifying purchases.

What Is a T-Test?

A t-test is a statistical hypothesis test used to compare means when the population standard deviation is unknown and must be estimated from sample data. It is especially useful with small samples, where uncertainty around the estimated standard deviation is higher. Instead of using the standard normal distribution, a t-test uses the t-distribution, which has heavier tails and changes shape depending on the sample size through a value called degrees of freedom.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

In practice, a t-test asks whether an observed difference in means is large enough to be unlikely under a null hypothesis. For example, a researcher might test whether the average test score of a class differs from a national benchmark, whether two groups have different average blood pressure readings, or whether the same patients show different cholesterol levels before and after treatment. The result is usually reported as a t-statistic, a p-value, and often a confidence interval for the mean difference.

#1 Best Overall
Sale
Statistics Laminate Reference Chart: Parameters, Variables, Intervals, Proportions (Quickstudy: Academic )
  • This guide is a perfect overview for the topics covered in introductory statistics courses.

Common Types of T-Tests

  • One-sample t-test: Compares the mean of one sample with a known or hypothesized value. For example, testing whether the average delivery time of a courier service differs from 30 minutes.
  • Independent two-sample t-test: Compares the means of two separate groups. For example, comparing average exam scores between students taught with two different methods.
  • Paired t-test: Compares two related measurements from the same subjects or matched pairs. For example, comparing employee productivity before and after a training program.

The basic one-sample t-test formula is:

t = (x̄ − μ0) / (s / √n)

Here, x̄ is the sample mean, μ0 is the hypothesized population mean, s is the sample standard deviation, and n is the sample size. For an independent two-sample t-test, the numerator becomes the difference between two sample means, and the denominator uses the standard error of that difference. The exact version depends on whether the two groups are assumed to have equal variances; when that assumption is doubtful, Welch’s t-test is commonly preferred.

A t-test is most appropriate when the data are numerical, observations are independent, and the variable being measured is roughly normally distributed within the population or within each group. With very small samples, departures from normality can strongly affect the reliability of the test. With moderate or larger samples, the t-test is often reasonably robust, especially when the data are not heavily skewed and do not contain extreme outliers.

The central feature of a t-test is that it works with sample-based uncertainty. Because the population standard deviation is not known, the test uses the sample standard deviation as an estimate. This makes the t-test a practical choice in fields such as medicine, education, psychology, manufacturing, and business analytics, where researchers often work with limited samples rather than complete population information.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What Is a Z-Test?

A z-test is a statistical hypothesis test used to determine whether a sample result is significantly different from a known or hypothesized population value. It is most commonly used for testing population means or proportions when the population standard deviation is known, or when the sample size is large enough for the sampling distribution to be treated as approximately normal. The test statistic follows the standard normal distribution, also called the z-distribution, which has a mean of 0 and a standard deviation of 1.

For a one-sample z-test for a mean, the basic formula is:

z = (x̄ – μ) / (σ / √n)

In this formula, x̄ is the sample mean, μ is the hypothesized population mean, σ is the population standard deviation, and n is the sample size. The resulting z-value measures how many standard errors the sample mean is away from the hypothesized population mean. A larger absolute z-value indicates stronger evidence against the null hypothesis.

Z-tests are especially common in situations where researchers have reliable population-level information. For example, a manufacturer may know the long-term standard deviation of the weight of cereal boxes produced by a machine. If a sample of boxes has an average weight different from the target value, a z-test can help determine whether that difference is likely due to random sampling variation or a real shift in the production process.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Common Types of Z-Tests

  • One-sample z-test for a mean: Compares a sample mean with a known or hypothesized population mean when the population standard deviation is known.
  • Two-sample z-test for means: Compares the means of two independent groups when population standard deviations are known or the samples are very large.
  • One-proportion z-test: Tests whether a sample proportion differs from a hypothesized population proportion.
  • Two-proportion z-test: Compares proportions between two independent groups, such as conversion rates for two website designs.

A z-test is generally appropriate when the sample size is large, often using n ≥ 30 as a practical rule of thumb for mean-based tests. Large samples make the sampling distribution of the mean approximately normal under the central limit theorem, even if the original data are not perfectly normally distributed. For proportion tests, the expected number of successes and failures should both be large enough, commonly at least 5 or 10 in each category.

Rank #2
Statistics Guide - Quick Reference Guide by Permacharts
  • Quick reference Statistics chart
  • This 8.5" x 11" 4-page laminated Guide provides an easy to follow summary of all basic principles that are the foundation to Statistics and Probabilities
  • Detailed descriptions and examples of theory
  • Using a combination of charts and sample equations, the key concepts are developed and the essential Statistics theories are outlined.
  • Easy-to-read to promoted memory retention. Great quick reference aid.

In practice, z-tests are widely used in quality control, polling, marketing analytics, medical studies, and A/B testing. A polling analyst might use a one-proportion z-test to assess whether support for a candidate differs from 50%. A product team might use a two-proportion z-test to compare purchase rates between a control group and a new checkout design. In each case, the z-test provides a standardized way to convert an observed difference into a probability-based decision about statistical significance.

Key Differences Between T-Test and Z-Test

The main difference between a t-test and a z-test is the information available about the population and how much uncertainty the test must account for. A z-test is generally used when the population standard deviation is known and the sample size is large. A t-test is used when the population standard deviation is unknown and must be estimated from the sample, especially with smaller samples.

Both tests compare a sample statistic to a hypothesized population value, or compare two groups to each other. However, they use different probability distributions. A z-test uses the standard normal distribution, while a t-test uses the t-distribution. The t-distribution has heavier tails, which means it allows for more uncertainty when estimating variability from limited data. As sample size increases, the t-distribution becomes very similar to the standard normal distribution.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Feature T-Test Z-Test
Population standard deviation Unknown; estimated using the sample standard deviation Known or reliably available from prior data
Typical sample size Commonly used for small samples, such as n < 30 Commonly used for large samples, such as n ≥ 30
Distribution used T-distribution Standard normal distribution
Degrees of freedom Uses degrees of freedom, usually based on sample size Does not use degrees of freedom in the same way
Best suited for Small samples, unknown variance, experimental studies Large samples, known variance, quality control, population-level testing

The formulas also show the distinction clearly. For a one-sample z-test, the test statistic is commonly written as z = (x̄ − μ) / (σ / √n), where x̄ is the sample mean, μ is the hypothesized population mean, σ is the known population standard deviation, and n is the sample size. For a one-sample t-test, the formula is t = (x̄ − μ) / (s / √n), where s is the sample standard deviation. This replacement of σ with s is what makes the t-test account for additional sampling uncertainty.

In practical terms, a t-test is often the safer choice when working with real-world data collected from a limited sample, such as comparing the average test scores of 18 students against a school benchmark or comparing two small treatment groups in a clinical pilot study. A z-test is more appropriate when the population variation is already well established, such as testing whether a manufacturing process has shifted from a known historical mean or whether a large survey proportion differs from a national benchmark.

The distinction is not only about the cutoff of 30 observations. Sample size matters, but so does whether the population variance is known, whether the data are approximately normal, and whether the observations are independent. With a large enough sample, a t-test and z-test may produce very similar results. Still, if the population standard deviation is unknown, the t-test remains the more standard and defensible option because it uses the sample data to estimate variability.

When to Use a T-Test vs a Z-Test

Choosing between a t-test and a z-test mainly depends on three practical questions: do you know the population standard deviation, how large is your sample, and what kind of comparison are you making? In most real-world studies, the population standard deviation is unknown, so researchers estimate it from the sample. That situation usually calls for a t-test. A z-test is appropriate when the population standard deviation is known or when the sample is large enough for the sampling distribution to be treated as approximately normal.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use a t-test when the population variance is unknown

A t-test is typically the better choice when working with small samples or when you only have the sample standard deviation. The t-distribution has heavier tails than the standard normal distribution, which accounts for the extra uncertainty created by estimating variability from limited data. For example, if a researcher measures the average blood pressure of 18 patients before and after a treatment, a paired t-test would be appropriate because the sample is small and the population standard deviation is not known.

  • One-sample t-test: Use when comparing a sample mean to a known or hypothesized value, such as testing whether the average fill weight of 15 bottles differs from 500 ml.
  • Independent two-sample t-test: Use when comparing means from two separate groups, such as exam scores from students taught by two different methods.
  • Paired t-test: Use when comparing two related measurements, such as before-and-after readings from the same people.

Use a z-test when the population variance is known or the sample is large

A z-test is suitable when the population standard deviation is available from reliable historical data or when sample sizes are large, commonly at least 30 observations per group. With large samples, the central limit theorem supports using the normal distribution even if the original data are not perfectly normal. For instance, a manufacturer with years of production data may know that the population standard deviation of bolt lengths is 0.2 mm. If it tests a sample of 100 bolts to see whether the mean length differs from the target, a z-test can be used.

Situation Better Test Example
Small sample and unknown population standard deviation t-test Testing average delivery time from a sample of 12 orders
Large sample and known population standard deviation z-test Testing mean product weight using long-term factory variation data
Comparing two small independent groups t-test Comparing recovery times for two treatments with 20 patients in each group
Testing a population proportion with a large sample z-test Testing whether 52% of 1,000 voters support a proposal

For proportions, the z-test is especially common because the test statistic is based on the normal approximation to the binomial distribution. This works best when the sample is large enough that expected successes and failures are both reasonably high. For means, however, the t-test is often the safer default when the population standard deviation is not known, even if the sample size is moderately large, because the t-distribution approaches the normal distribution as sample size increases.

In practical terms, use a t-test for most small-sample mean comparisons and for studies where variability must be estimated from the data. Use a z-test when you have a known population standard deviation, a large sample, or a large-sample proportion problem. If both tests seem possible, checking whether the population standard deviation is truly known is usually the deciding factor.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Assumptions Behind T-Tests and Z-Tests

Both t-tests and z-tests rely on assumptions about the data, the sampling process, and the parameter being tested. These assumptions matter because the test statistic is compared against a theoretical distribution: the t-distribution for a t-test and the standard normal distribution for a z-test. If the assumptions are badly violated, the resulting p-value, confidence interval, or decision about the null hypothesis may be misleading.

Shared assumptions

Several assumptions apply to both tests. First, the data should come from a random sample or a process that is reasonably representative of the population. Second, observations should be independent: one person’s measurement, transaction, or experimental outcome should not determine another’s. For paired designs, such as before-and-after measurements on the same subjects, independence applies to the pairs rather than to the two measurements within each pair.

  • Measurement scale: The variable being analyzed should be numeric and measured on an interval or ratio scale, such as weight, revenue, blood pressure, processing time, or test score.
  • Independence: Observations should not be repeated measurements from the same unit unless a paired test is used.
  • Randomization or representativeness: Samples should be collected in a way that avoids systematic bias.
  • Appropriate test structure: A one-sample, two-sample, or paired design should match how the data were collected.

Assumptions specific to t-tests

A t-test is commonly used when the population standard deviation is unknown and must be estimated from the sample. This is the t-test uses the sample standard deviation in its formula and compares the result to a t-distribution with degrees of freedom. For small samples, the population should be approximately normally distributed, especially for a one-sample or paired t-test. With larger samples, the t-test is often robust because the sampling distribution of the mean becomes more nearly normal.

For an independent two-sample t-test, the assumptions depend on the version used. The classic Student’s t-test assumes equal population variances across the two groups. Welch’s t-test relaxes this condition and is usually preferred when group variances or sample sizes differ. For example, comparing average delivery times between two warehouses with unequal variability is often better handled by Welch’s t-test than by the equal-variance version.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Assumptions specific to z-tests

A z-test assumes that the population standard deviation is known or that the sample size is large enough for the sample-based estimate to be treated as highly stable. In practice, the known population variance condition is uncommon outside controlled industrial processes, standardized testing, or situations with extensive historical data. The z-test also assumes that the sampling distribution of the statistic is approximately normal. For means, this may come from a normally distributed population or from a large sample. For proportions, normal approximation conditions should be checked.

Test Main variance assumption Distribution assumption Common concern
T-test Population variance unknown; sample variance used Data or mean differences approximately normal for small samples Outliers can strongly affect the mean and standard deviation
Z-test Population variance known or sample very large Sampling distribution approximately normal Often misused when population standard deviation is not truly known

Before choosing either test, inspect the data for extreme outliers, skewness, unequal group spreads, and dependence between observations. If the data are heavily skewed with a small sample, a nonparametric alternative such as the Mann-Whitney U test or Wilcoxon signed-rank test may be more appropriate. If the issue is unequal variance between two groups, Welch’s t-test is usually a practical adjustment rather than switching to a z-test.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Examples of T-Test and Z-Test Applications

Practical examples make the distinction between a t-test and a z-test easier to apply. In most real-world analysis, the choice depends on whether the population standard deviation is known, how large the sample is, and whether the question involves one mean, two means, or paired measurements. The scenarios below show how each test is commonly used in business, healthcare, education, manufacturing, and research.

T-Test Application Examples

A one-sample t-test is appropriate when a researcher compares a sample mean with a known or hypothesized value and the population standard deviation is unknown. For example, a coffee shop may claim that its average service time is 4 minutes. A manager records service times for 20 customers and finds a sample mean and sample standard deviation. Because the sample is small and the population variance is not known, a one-sample t-test can assess whether the average service time differs significantly from 4 minutes.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

An independent two-sample t-test is used when comparing the means of two separate groups. For instance, an education researcher might compare exam scores between students taught with a traditional method and students taught with a new online learning tool. If each group has 25 students and the population standard deviations are unknown, a two-sample t-test is suitable for testing whether the average performance differs between the groups. If the group variances appear unequal, Welch’s t-test is often preferred because it does not require equal variances.

A paired t-test applies when measurements are taken from the same subjects before and after a treatment or intervention. In healthcare, a clinician may measure patients’ blood pressure before starting a new medication and again after six weeks. Since each patient provides two linked measurements, the analysis focuses on the mean difference within patients rather than comparing two independent groups. A paired t-test can determine whether the average change in blood pressure is statistically significant.

Z-Test Application Examples

A one-sample z-test for a mean is used when the population standard deviation is known and the sampling distribution of the mean can be treated as approximately normal. For example, a factory may know from years of production data that the standard deviation of the weight of packaged flour is 5 grams. If a quality control analyst samples 100 bags and wants to test whether the average weight differs from the labeled 1,000 grams, a z-test can be used because the population standard deviation is available and the sample is large.

A two-sample z-test may be used when comparing two population means with known population standard deviations, especially in large-scale studies. For example, a national retail chain may compare average transaction values between two regions using thousands of purchases from each region. If historical data provides reliable population standard deviations for both regions, a z-test can evaluate whether the difference in average transaction value is statistically meaningful.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Z-tests are also common for proportions. A marketing team might test whether the conversion rate of a new landing page differs from the company’s historical conversion rate of 8%. If 2,000 visitors are included in the experiment, the sample is large enough for the normal approximation to work well, making a one-proportion z-test appropriate. Similarly, a two-proportion z-test can compare click-through rates between two ad versions in an A/B test.

Scenario Best Test Typical Reason
Average delivery time from a sample of 18 orders One-sample t-test Small sample and unknown population standard deviation
Before-and-after cholesterol levels for the same patients Paired t-test Dependent measurements from the same individuals
Average fill weight from 150 packages with known historical standard deviation One-sample z-test Large sample and known population standard deviation
Conversion rates for two website designs Two-proportion z-test Large samples and categorical success/failure outcome

Frequently Asked Questions

Should I use a t-test or z-test if my sample size is less than 30?

Use a t-test when the sample size is small and the population standard deviation is unknown, which is the most common real-world situation. The t-test uses the sample standard deviation and accounts for extra uncertainty through the t-distribution.

Can I use a z-test if I do not know the population standard deviation?

No, a z-test generally requires the population standard deviation to be known. If you only have the sample standard deviation, use a t-test instead, even if the sample is fairly large.

What happens if I use a z-test instead of a t-test by mistake?

Using a z-test when a t-test is more appropriate can make your result look more statistically significant than it really is, especially with small samples. This increases the chance of rejecting the null hypothesis incorrectly.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Is a t-test only for comparing two groups?

No, t-tests can be used in several ways. A one-sample t-test compares one sample mean to a known value, an independent two-sample t-test compares two separate groups, and a paired t-test compares matched measurements such as before-and-after results.

Do t-tests and z-tests require normally distributed data?

Both tests assume the sampling distribution of the mean is approximately normal. For small samples, the original data should be roughly normal, while larger samples can often rely on the central limit theorem if there are no severe outliers or strong skew.

Bottom Line

A z-test is the right choice when the population standard deviation is known and the sample is large enough for the normal approximation to be reliable. A t-test is usually more practical when the population variance is unknown, especially with smaller samples where the t-distribution better accounts for extra uncertainty.

Before choosing a test, check your sample size, whether the population standard deviation is known, and whether your data meets the needed assumptions such as independence and approximate normality. If you are working with real-world sample data and estimating variability from the sample, the t-test is often the safer default.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Quick Recap

Bestseller No. 2
Statistics Guide - Quick Reference Guide by Permacharts
Statistics Guide - Quick Reference Guide by Permacharts
Quick reference Statistics chart; Detailed descriptions and examples of theory; Easy-to-read to promoted memory retention. Great quick reference aid.
$9.95
SaleBestseller No. 4

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.