Difference Between T-test And Z-test

What Is a T-Test?

A t-test is a type of inferential statistic used to determine if there is a significant difference between the means of two groups, which may be related in certain features. It is mostly used when the data sets, like the data set recorded as the outcome from flipping a coin 100 times, would follow a normal distribution and may have unknown variances.

A t-test is used as a hypothesis testing tool, which allows testing of an assumption applicable to a population. A t-test looks at the t-statistic, the t-distribution values, and the degrees of freedom to determine the statistical significance. To conduct a test with three or more means, one must use an analysis of variance.

There are three types of t-tests, and they are categorized as dependent and independent t-tests.

  1. Independent samples t-test: compares the means for two groups.
  2. Paired sample t-test: compares means from the same group at different times (say, one year apart).
  3. One sample t-test test: the mean of a single group against a known mean.

What is a Z-test?

Z-test is a statistical method to determine whether the distribution of the test statistics can be approximated by a normal distribution. It is the method to determine whether two sample means are approximately the same or different when their variance is known and the sample size is large (should be >= 30).

In other words, the z-test is also a hypothesis test in which the z-statistic follows a normal distribution. The z-test is best used for greater-than-30 samples because, under the central limit theorem, as the number of samples gets larger, the samples are considered to be approximately normally distributed.

When conducting a z-test, the null and alternative hypotheses, alpha and z-score should be stated. Next, the test statistic should be calculated, and the results and conclusion stated. A z-statistic, or z-score, is a number representing how many standard deviations above or below the mean population a score derived from a z-test is.

When to Use Z-test:

  • The sample size should be greater than 30. Otherwise, we should use the t-test.
  • Samples should be drawn at random from the population.
  • The standard deviation of the population should be known.
  • Samples that are drawn from the population should be independent of each other.
  • The data should be normally distributed, however for large sample size, it is assumed to have a normal distribution.

Also Read: Difference Between Type I And Type II

Difference Between T-test And Z-test In Tabular Form

Basis for comparisonT-testZ-test
DefinitionThe t-test is a test in statistics that is used for testing hypotheses regarding the mean of a small sample taken population when the standard deviation of the population is not known.z-test is a statistical tool used for the comparison or determination of the significance of several statistical measures, particularly the mean in a sample from a normally distributed population or between two independent samples.
Sample sizeThe t-test is usually performed in samples of a smaller size (n≤30).z-test is generally performed in samples of a larger size (n>30).
Type of distribution of populationt-test is performed on samples distributed on the basis of t-distribution.z-tets is performed on samples that are normally distributed.
AssumptionsA t-test is not based on the assumption that all key points on the sample are independent.z-test is based on the assumption that all key points on the sample are independent.
Variance or standard deviationVariance or standard deviation is not known in the t-test.Variance or standard deviation is known in z-test.
DistributionThe sample values are to be recorded or calculated by the researcher.In a normal distribution, the average is considered 0 and the variance as 1.
Population parametersIn addition, to the mean, the t-test can also be used to compare partial or simple correlations among two samples.In addition, to mean, z-test can also be used to compare the population proportion.
Conveniencet-tests are less convenient as they have separate critical values for different sample sizes.z-test is more convenient as it has the same critical value for different sample sizes.

Also Read: Difference Between Inferential And Descriptive


Z-tests are statistical calculations that can be used to compare population means to a sample’s. The z-score tells you how far, in standard deviations, a data point is from the mean or average of a data set. A z-test compares a sample to a defined population and is typically used for dealing with problems relating to large samples (n > 30). Z-tests can also be helpful when we want to test a hypothesis. Generally, they are most useful when the standard deviation is known.

Like z-tests, t-tests are calculations used to test a hypothesis, but they are most useful when we need to determine if there is a statistically significant difference between two independent sample groups. In other words, a t-test asks whether a difference between the means of two groups is unlikely to have occurred because of random chance. Usually, t-tests are most appropriate when dealing with problems with a limited sample size (n < 30).

Both z-tests and t-tests require data with a normal distribution, which means that the sample (or population) data is distributed evenly around the mean