Menu
numiqo
Statistics made easy

Statistics made easy

8th revised edition (March 2026) - many illustrative examples - only €8.99

Free sample

t-Test

Author: Dr. Mathias Jesussek
Updated:

What is a t-Test?

A t-test is a tool that helps you figure out if the difference you see between two groups is actually real, or if it's just a "fluke" caused by random luck in your data.

There are three main versions of the test depending on what you are comparing:

  • One-Sample t-test: Compares one group's mean against a known value or standard.
  • Independent Two-Sample t-test: Compares the means of two entirely separate groups, such as a treatment group vs. a control group.
  • Paired Samples t-test: Compares means from the same group at two different times, such as "Before" vs. "After" an intervention.

How does a t-Test work?

A t-test checks whether two means really differ. To do this, it compares two things:

  • The size of the difference between the means (the signal), and
  • The variation or spread of the values within the groups (the noise).

If the difference is large compared to the natural variation, it suggests the groups likely differ in the real world, not just in your sample. The test produces a p-value to help you judge the strength of this evidence.

t-Test

Types of t-test

There are three different types of t-tests. The one-sample t-test, the independent-sample t-test and the paired-sample t-test.

Types of t-test

One sample t-Test

We use the one sample t-test when we want to compare the mean of a sample with a known reference mean.

One sample t-Test
Synonyms:
  • Single-sample t-test
  • One-sample Student's t-test
  • Simple t-test

Example of a one sample t-test

A manufacturer of chocolate bars claims that its chocolate bars weigh 50 grams on average. To verify this, a sample of 30 bars is taken and weighed. The mean value of this sample is 48 grams. We can now perform a one sample t-test to see if the mean of 48 grams is significantly different from the claimed 50 grams.

Example one  sample t-test

Independent Samples t-Test

We use the t-test for independent samples when we want to compare the means of two independent groups or samples. We want to know if there is a significant difference between these means.

t-test for independent samples
Synonyms:
  • Two-Sample t-Test
  • Unpaired t-Test
  • Independent t-Test

Example of a t-test for independent samples

We would like to compare the effectiveness of two painkillers, drug A and drug B. To do this, we randomly divide 60 test subjects into two groups. The first group receives drug A, the second group receives drug B. With an independent-samples t-test we can now test whether there is a significant difference in pain relief between the two drugs.

Example of a t-test for independent samples

Paired Samples t-Test

The Paired Samples t-Test is used to compare the means of two dependent groups. In a dependent sample (paired sample), the measured values are available in pairs. The pairs are created, for example, by repeated measurements on the same persons.

Paired samples t-Test
Synonyms:
  • Dependent Samples t-Test
  • Repeated Measures t-Test
  • Paired t-Test

Example of the t-test for paired samples

We want to know how effective a diet is. To do this, we weigh 30 people before the diet and exactly the same people after the diet. Now we can see for each person how big the weight difference is between before and after. With a dependent t-test we can now check whether there is a significant difference.

Example of the t-test for paired samples

Hypotheses

Before running a t-test, we state two opposing claims: the Null Hypothesis and the Alternative Hypothesis .

  • Null Hypothesis (H0): There is no real difference. Any small gap you see in your data doesn't exist in the "real world" (population) and is simply due to random chance.
  • Alternative Hypothesis (H1): This is the opposite claim. It states that a real, systematic difference exists that goes beyond mere coincidence.

1. One-Sample t-test

Here, you compare your sample data against a fixed target value.

  • Null Hypothesis: Your sample mean is equal to the reference value. There is no difference from the standard.
  • Alternative Hypothesis: Your mean significantly deviates from the reference value. There is a real difference.

2. Independent Samples t-test

Here, you compare two separate groups (e.g., Men vs. Women).

  • Null Hypothesis: The means of both groups are equal in the population. Any observed difference in your sample is just random noise.
  • Alternative Hypothesis: The means are actually different. The difference is systematic and not just a fluke.

3. Paired Samples t-test

Here, you compare the same individuals at two different points in time (e.g., Before vs. After).

  • Null Hypothesis: The average difference between the pairs is zero. There has been no real change.
  • Alternative Hypothesis: The average difference between the pairs is non-zero. A systematic change has occurred.

t-Test Assumptions

To ensure the results of your t-test are reliable and allow for a valid inference about the "real world" (population), certain conditions must be met:

1. Suitable Sample Structure: Depending on your research question, you need the correct data setup:

  • One-Sample t-test: One group and one fixed reference value.
  • Independent Samples t-test: Two completely separate, unrelated groups.
  • Paired Samples t-test: A dependent sample (e.g., the same individuals measured twice).

2. Continuous Scale of Measurement: The variable you are testing should be "measurable" (interval or ratio scale). Typical examples include age, body weight, income, or reaction time.

Assumptions t-test

3. Normal Distribution: The values in the population should be approximately normally distributed (the classic bell curve). To check for normality, you can use the Shapiro-Wilk test or a Q-Q plot.

Note: With larger samples (usually n > 30), the t-test is very "robust," meaning it still works well even if the data isn't perfectly bell-shaped.

4. Homogeneity of Variance (Independent t-test only): The "spread" or variance in both groups should be roughly equal. If one group is highly scattered and the other is very tight, the standard t-test might give misleading results. You can check this using the Levene's test.

5. Random Sampling: The data points should be a random selection from the population. This ensures that your sample is a fair representation of reality and isn't distorted by selection bias.

Why do we need a t-test?

Let's say we have a theory:

"Men and women in Germany spend a different amount of time finishing their degrees."

In a perfect world, we would ask every single graduate in Germany. But since that is impossible, we pick a smaller sample of graduates to represent the whole country.

t-Test Sample

Now, here is the tricky part: even if men and women across all of Germany spend the exact same amount of time studying, your specific sample will almost never show a difference of exactly zero. Just by luck, the group of men you picked might have studied a little longer (or shorter) than the group of women.

So, how do we know if the difference we see in our data is a "real" trend in Germany, or just a result of luck in our sample?

Why do you need a t-test

This is exactly what the t-test does. It calculates how likely it is that you would find a difference this large or even larger simply by chance. If that likelihood is very low, you can feel confident that a difference exists in the real world, not just in your sample.

How to Calculate a t-test?

The core of every t-test is the t-value. You can think of the t-value as a ratio between the "Signal" (the difference you found) and the "Noise" (the random fluctuation in your data).

To calculate the t-value, we need two components:

  1. The difference between the means (the Signal).
  2. The standard error (the Noise), which tells us how much the means are expected to fluctuate just by chance.
Calculate t-value

One-sample t-test

In a one-sample t-test, we calculate the difference between your sample mean and the fixed reference value. To get the "noise" component, we take the standard deviation (s) and divide it by the square root of the sample size (n). This gives us the standard error.

t-value in the one sample t-test

So, s divided by the square root of n is the standard error.

t-value standard error

Independent samples t-test

In the t-test for independent samples, the difference is simply calculated from the difference of the two sample means.

t-value in t-test independent samples

Calculating the standard error here is slightly more complex because we have to account for the variation and size of both samples. Depending on whether the groups have similar variances, the formula changes slightly. You can find the details in the tutorial on independent t-tests.

Paired samples t-test

In a paired samples t-test, we first look at the individual differences within each pair (e.g., person A's score before minus person A's score after). We then calculate the mean of these differences.

The standard error is then the same as in the t-test for one sample.

t-value in paired samples t-test

Interpreting the t-value

Once you have your t-value, what does it actually tell you? Think of it as a battle between the Signal (your mean difference) and the Noise (the variability in your data).

The Signal (The Mean Difference): The t-value is directly tied to the difference between your means. If the difference gets larger, the t-value increases as well. A big t-value suggests that the difference you found is quite substantial compared to the background noise.

Interpret t-value

The Noise (The Standard Error): On the other hand, the t-value becomes smaller if there is a lot of "scatter" or dispersion in your data. In the real world, the greater the scatter, the more likely it is that any mean difference you found is just a result of random fluctuation (luck of the draw).

In short: A high t-value means your signal is loud and clear, while a low t-value means the signal is getting lost in the noise.

t-value and p-value

Now that you have your t-value, there is one final question: Is this t-value "big enough" to be important, or is it just background noise?

There are two ways to make this decision:

1. The Modern Path: The p-value

This is the method used by almost all modern software and researchers. Instead of looking at a table, the computer calculates a specific probability for you: the p-value.

  • The p-value tells you how likely it is to get your result or a more extrem if the Null Hypothesis were true (i.e., if there were actually no difference).
  • The Rule: If p < 0.05, the result is "significant." This provides strong evidence that the effect you found isn't just random fluctuation, but exists in the real world.

2. The Classic Path: The Critical t-value

This is the traditional way. You compare your calculated t-value against a fixed "threshold" called the critical t-value.

  • If your calculated t-value is higher than the critical value, you reject the Null Hypothesis.
  • Good to know: Since reading from physical tables is mostly relevant for university exams today, we have created a separate deep-dive for you: How to read the t-distribution table.

The Result remains the same: Regardless of which path you take, they will always lead you to the same conclusion. Both methods are simply different ways of asking the same question: "Is my signal strong enough to be taken seriously?"

What is the p-value?

Essentially, the p-value tells you:

"If the Null Hypothesis were true, how likely is it that I would get a result as extreme or even more extreme than mine just by random fluctuation?"

In "simple" words:

Imagine there is actually no difference in the real world (the null hypothesis is true), for example, there is no difference between two drugs. If that were true, how likely is it that I would get a result as extreme as, or even more extreme than, my current one just by pure luck?

  • A high p-value (e.g., 0.45): Means your result is very common even if there is no real effect. The "Signal" is likely just random fluctuation.
  • A low p-value (e.g., 0.03): Means your result would be very rare if there was no real effect. This provides strong evidence against the Null Hypothesis.

The 0.05 Threshold

In most scientific fields, we use a threshold of 0.05 (5%).

  • If p < 0.05: We say the result is "statistically significant." We reject the Null Hypothesis and conclude that the difference likely exists in the real world (population).
  • If p > 0.05: We fail to reject the Null Hypothesis. The data does not provide enough evidence to rule out pure chance.

Important to remember: The p-value is not a "proof" of truth. It is simply a tool to help us decide if our observed data is unusual enough to take the "Signal" seriously. It helps us draw a line between a lucky hit in our sample and a reliable trend in the population.

Degrees of freedom (df)

The degrees of freedom essentially tell the t-test how much "information" you have in your data. In the real world, the fewer people you measure, the more likely it is that random fluctuation creates extreme results. The df adjust the t-distribution to account for this:

How to calculate df

The calculation depends on the type of t-test you are using:

t-test Degrees of freedom

Where n is the number of participants in each group or pairs.

In short: You can't get a p-value with the t-value alone. You always need the df to tell the computer (or the table) which specific version of the t-distribution to look at.

One-tailed vs. Two-tailed Tests

Before you calculate your p-value, you must decide in which "direction" you are looking for a signal. In statistics, we call this choosing between a one-tailed and a two-tailed test. This choice refers to the "tails" of the t-distribution curve where the extreme results live.

1. Two-tailed Test (Non-directional)

This is the standard approach. You use it when you want to know if there is any difference at all, regardless of whether it is an increase or a decrease.

  • The Hypothesis: "Does the new training program change performance?" (It could get better or worse).
  • The Logic: You are looking for a signal in both directions. Because you are splitting your focus between both tails of the distribution, the "threshold" for a significant result is harder to reach.

2. One-tailed Test (Directional)

You use this only if you are looking for a change in one specific direction and you are 100% sure the other direction is impossible or irrelevant.

  • The Hypothesis: "Does the new training program specifically improve performance?"
  • The Logic: You put all your "statistical power" into one tail. This makes it easier to find a significant result in that specific direction, but you completely ignore any signal in the opposite direction—even if it's huge!
When in doubt, go Two-tailed!

In the real world (population), surprises happen. If you use a one-tailed test to look for an "improvement" and the results actually show a massive "decline," your test will stay "not significant." Most scientists prefer two-tailed tests because they are more honest about exploring the data in both directions.

Calculate the t-test with numiqo

If you want to calculate a t-test with numiqo, all you have to do is copy your own data into the table, click on "Hypothesis Test" and then select the desired variables.

Calculate t-test online

For example, if you want to check whether gender has an influence on salary, simply click on both variables and a t-test for independent samples is automatically calculated. You can then read the p-value at the bottom.

t-test results

If you are still unsure how to interpret the results, you can simply click on "Summary in words":

A two tailed t-test for independent samples (equal variances assumed) showed that the difference between Female and Male with respect to the dependent variable Salary was not statistically significant, t(10) = -2.16, p = .056, 95% confidence interval [-1445.23, 21.89]. Thus, the null hypothesis is not rejected.

Statistics made easy

  • many illustrative examples
  • ideal for exams and theses
  • statistics made easy on 464 pages
  • 8th revised edition (March 2026)

Only €8.99

Free sample
numiqo

"Super simple written"

"It could not be simpler"

"So many helpful examples"

Cite numiqo: numiqo Team (2026). numiqo: Online Statistics Calculator. numiqo e.U. Graz, Austria. URL https://numiqo.com

Contact & About Us FAQ Privacy Policy Terms and Conditions Statistics Software Minitab alternative Minitab to Excel (Minitab File Converter) SPSS to Excel (SPSS File Converter) SPSS alternative DATAtab is now numiqo