Math calculators

t Test Calculator

Updated Nov 22, 2026 By Infinity Calculator Formulas Sources
2.6 · Rate
Step 1: Choose Data Entry Format
Enter Raw Data Manually
Interactive grid for up to 50 rows per group.
Paste Raw Data
Paste from Excel/Sheets, up to 2000 rows. Tab or newline separated.
Summary: Mean, SD, N
Enter mean, standard deviation, and sample size for each group.
Summary: Mean, SEM, N
Enter mean, standard error of the mean, and sample size for each group.
Step 2: Configure Test Parameters
Independent Samples t-test (Pooled Variance)
Compares means of two independent groups. Assumes equal variances.
Welch's t-test (Unequal Variance)
Compares means of two independent groups. Does not assume equal variances.
Paired t-test
For matched/dependent samples. Requires raw data.
One-Sample t-test
Compares a single sample mean against a hypothesized population mean.

H₀:μ₁ = μ₂
H₁:μ₁ ≠ μ₂
Step 3: Enter Data
#Value
#Value
Step 4: Results
Test Summary
Test TypeIndependent t-test (Pooled)
TailTwo-tailed
Significance Level (α)0.05
Primary Results
t-statistic3.0945
Degrees of Freedom (df)58
p-value0.003032
DecisionReject H₀: Statistically Significant
Effect Size
Cohen's d0.7990
InterpretationMedium
Confidence Interval
Mean Difference3.2000
95% CI[1.1301, 5.2699]
Descriptive Statistics
Group N Mean SD SEM
Group 13025.30004.20000.7668
Group 23022.10003.80000.6938
Step-by-Step Calculation
t-Distribution Visualization

Introduction

A t test is a statistical method used to compare the means of two groups, or one group's mean with a known value, and determine whether the difference is statistically significant. It helps you answer a simple question: "Is the difference I see between these two groups real, or could it just be due to chance?" For example, you might use a t test to check if students who studied with flashcards scored higher on a test than students who did not. This t Test Calculator makes it easy to plug in your data and get your t statistic, degrees of freedom, and p-value, the key numbers you need to draw a conclusion. This tool saves you time and reduces the chance of making errors in your calculations.

How to Use Our t Test Calculator

Enter your sample data below to calculate the t statistic, degrees of freedom, and p-value. This tells you whether the difference between groups or from a known value is statistically significant.

Test Type: Pick the kind of t test you need. Choose a one-sample t test to compare a sample mean to a known value. Choose a two-sample t test to compare the means of two groups. Choose a paired t test when your data points are matched or come from the same subjects.

Significance Level (α): Enter the significance level for your test. This is the cutoff you use to decide if your result is significant. A common choice is 0.05, which means a 5% chance of rejecting the null hypothesis when it is actually true (a false positive).

Tail Type: Select whether you want a one-tailed or two-tailed test. Use a two-tailed test when you want to detect a difference in either direction. Use a one-tailed test when you only care about a difference in one specific direction.

Sample Data or Summary Statistics: Enter your raw data values or provide summary statistics such as the sample mean, sample standard deviation, and sample size. If you are running a two-sample or paired test, you will need to enter data for both groups.

Hypothesized Mean (One-Sample Test): If you are running a one-sample t test, enter the population mean you want to compare your sample against. This is the value you think the true mean might equal.

What Is a t Test?

A t test is a statistical method used to determine whether there is a statistically significant difference between the means (averages) of two groups, or between one group's mean and a known value. It helps you answer a simple question: "Is this difference real, or could it have happened by chance?" Scientists, students, and researchers use t tests every day to make decisions based on data.

Types of t Tests

There are several types of t tests, and each one fits a different situation:

  • Independent samples t test (pooled variance): Compares the means of two separate, unrelated groups. For example, you might compare test scores between two different classrooms. This version assumes both groups have roughly equal variability (spread) in their data.1
  • Welch's t test (unequal variance): Also compares two independent groups, but it does not assume the groups have equal variability.1 This makes it a safer choice when you're unsure whether the spreads are similar.
  • Paired t test: Used when the two sets of measurements come from the same subjects. For example, measuring a patient's blood pressure before and after taking a medication. It works by looking at the difference within each pair.1
  • One-sample t test: Compares the mean of a single group to a specific known or hypothesized value.2 For instance, you could test whether the average height of students in your school differs from the national average.

Key Concepts Behind the t Test

Every t test involves a few core ideas:

  • Null hypothesis (H₀): This is the starting assumption that there is no real difference. For example, "the two group means are equal."
  • Alternative hypothesis (H₁): This is what you're trying to find evidence for: that a real difference does exist.
  • t-statistic: A number calculated from your data that measures how far apart the group means are relative to the variability in the data. A larger absolute t value means a bigger difference relative to the noise.
  • Degrees of freedom (df): A value based on your sample sizes that shapes the t distribution used to judge your result.4 For Welch's test it also depends on the two groups' standard deviations.1
  • p-value: The probability of seeing a result as extreme as yours if the null hypothesis were true.6 A small p-value (typically below 0.05) suggests the difference is statistically significant.8
  • Significance level (α): The threshold you set before testing. Common values are 0.01, 0.05, and 0.10. If the p-value falls below α, you reject the null hypothesis.

One-Tailed vs. Two-Tailed Tests

A two-tailed test checks whether the means are simply different in either direction. A one-tailed test checks for a difference in only one specific direction, either greater than or less than. Use a one-tailed test only when you have a clear reason to expect the difference to go one way before you look at the data.11

Effect Size: Cohen's d

Statistical significance alone doesn't tell you how big a difference is. That's where Cohen's d comes in. It measures the size of the difference in standard deviation units.7 Cohen's conventional values are 0.2 for a small effect, 0.5 for a medium effect and 0.8 for a large effect.10 This calculator labels a d below 0.2 as negligible, from 0.2 up to 0.5 as small, from 0.5 up to 0.8 as medium, and 0.8 or more as large. For a paired test, the d shown is the mean of the differences divided by the standard deviation of the differences, a measure called Cohen's dz. Cohen's dz is rarely reported, and when the two sets of measurements are correlated above 0.5 it is larger than the other forms of d used for paired data.7 For Welch's test, d still divides by the pooled standard deviation. When the two groups' standard deviations differ a lot, Glass's delta, which divides by one group's standard deviation, should be reported instead.7 A result can be statistically significant but have a tiny effect size, which is important to keep in mind.6

Confidence Intervals

Along with the p-value, a confidence interval gives you a range of plausible values for the true difference between means. For example, a 95% confidence interval means that if you repeated the study many times, about 95% of those intervals would contain the true difference.2 For a two-tailed test, if a 95% interval does not include zero, it lines up with a significant result at the 0.05 level.2

When to Use a t Test

The t test works best when your data is roughly normally distributed (bell-shaped) and measured on a continuous scale, such as weight, temperature, or test scores. For small samples, the normality assumption matters more. For larger samples (generally 30 or more per group), the t test is robust even when data is somewhat skewed, thanks to the central limit theorem.


Formulas used

Independent t-test (Pooled Variance) 1
t = \frac{\bar{x}_1 - \bar{x}_2}{s_p \sqrt{\frac{1}{n_1} + \frac{1}{n_2}}}, \quad s_p = \sqrt{\frac{(n_1-1)s_1^2 + (n_2-1)s_2^2}{n_1+n_2-2}}
Welch's t-test (Unequal Variance) 1
t = \frac{\bar{x}_1 - \bar{x}_2}{\sqrt{\frac{s_1^2}{n_1} + \frac{s_2^2}{n_2}}}, \quad df = \frac{\left(\frac{s_1^2}{n_1} + \frac{s_2^2}{n_2}\right)^2}{\frac{\left(\frac{s_1^2}{n_1}\right)^2}{n_1-1} + \frac{\left(\frac{s_2^2}{n_2}\right)^2}{n_2-1}}
Paired t-test 3
t = \frac{\bar{d}}{s_d / \sqrt{n}}, \quad df = n - 1
One-Sample t-test 2
t = \frac{\bar{x} - \mu_0}{s / \sqrt{n}}, \quad df = n - 1
Cohen's d (Independent) 7
d = \frac{|\bar{x}_1 - \bar{x}_2|}{s_p}
Confidence Interval for Mean Difference 9
CI = (\bar{x}_1 - \bar{x}_2) \pm t_{\alpha/2,\,df} \cdot SE

Frequently asked questions

What is the difference between a t test and a z test?

A t test is used when you do not know the population standard deviation and estimate it from your sample, whatever the sample size.4 A z test is used when you already know the population standard deviation.8 In most real-world cases, you will not know the population standard deviation, so the t test is the more common choice.4

How do I know which t test type to pick?

Ask yourself these questions:

  • Are you comparing one group to a known value? Use a one-sample t test.
  • Are you comparing two separate groups of different people? Use an independent samples t test or Welch's t test.
  • Are you comparing measurements from the same people taken at two different times? Use a paired t test.

When should I use Welch's t test instead of the independent samples t test?

Use Welch's t test when the two groups may have different amounts of spread (different standard deviations) or different sample sizes. It does not assume equal variances, so it is the safer choice when you are not sure if the groups have similar variability.1 Many statisticians recommend using Welch's t test by default.

Why can't I run a paired t test with summary statistics?

A paired t test needs the individual differences between each matched pair of data points. When you only have summary statistics like the mean, standard deviation, and sample size, there is no way to calculate those pair-by-pair differences. If you have the mean and standard deviation of the differences themselves, a paired t test is the same as a one-sample t test of those differences against 0.7 Otherwise, you must enter the raw data for each pair so the calculator can subtract one from the other.

What does the p-value actually tell me?

The p-value tells you the chance of seeing a result as extreme as yours if there really were no difference (if the null hypothesis were true).6 A small p-value (like 0.03) means a result this extreme would be unlikely if there were really no difference. If the p-value is less than your significance level (α), you reject the null hypothesis and conclude the difference is statistically significant.

What does it mean to reject or fail to reject the null hypothesis?

If you reject the null hypothesis, it means your data provides enough evidence that a real difference exists. If you fail to reject the null hypothesis, it means your data does not provide strong enough evidence to say a difference exists. Failing to reject does not prove the groups are the same.6 It just means you cannot be sure they are different.

What is the degrees of freedom and why does it matter?

Degrees of freedom (df) is a number based on your sample sizes. For Welch's t test it also depends on the two groups' standard deviations.1 It shapes the t distribution curve that is used to calculate the p-value. Smaller degrees of freedom means a wider, flatter curve, which makes it harder to reach significance. As your sample size grows, the degrees of freedom increase and the t distribution looks more like a normal bell curve.4

How many data points do I need to run a t test?

Each group needs at least 2 data points for the math to work. However, very small samples give less reliable results. The number you need depends on the size of the difference you want to detect, the significance level you choose and the statistical power you want, which a power analysis works out.10

What is the difference between standard deviation (SD) and standard error (SEM)?

Standard deviation (SD) measures how spread out individual data points are from the mean. Standard error of the mean (SEM) measures how much the sample mean is expected to vary from study to study. SEM is always smaller than SD because it equals SD divided by the square root of the sample size.5 This calculator lets you enter either one when using summary statistics.

What does the confidence interval for the mean difference tell me?

The confidence interval gives a range where the true difference between the means likely falls. For example, a 95% confidence interval of [1.13, 5.27] means you can be 95% confident the true difference is somewhere between 1.13 and 5.27. For a two-tailed test, if zero is not inside the interval, the result is statistically significant at the matching significance level (0.05 for a 95% interval).2

How do I interpret Cohen's d values?

Cohen's d tells you how big the difference is in practical terms. Cohen's conventional values are 0.2 for a small effect, 0.5 for a medium effect and 0.8 for a large effect.10 These values are arbitrary and should not be applied rigidly, since a small effect can still have large consequences.7 This calculator uses these bands:

  • Below 0.2: Negligible effect
  • 0.2 to under 0.5: Small effect
  • 0.5 to under 0.8: Medium effect
  • 0.8 and above: Large effect

A statistically significant result can still have a small effect size, meaning the real-world impact may be minor.

Should I use a one-tailed or two-tailed test?

Use a two-tailed test if you want to detect a difference in either direction (higher or lower). Use a one-tailed test only when you have a specific reason, decided before looking at your data, to test in one direction.11 For example, use a right-tailed test if you only care whether a new drug increases scores, not decreases them. When in doubt, the two-tailed test is the safer and more common choice.11

What if my data is not normally distributed?

The t test assumes your data is roughly normally distributed (bell-shaped). For small samples, this matters a lot. For larger samples (about 30 or more per group), the t test still works well even with somewhat skewed data because of the central limit theorem. If your data is heavily skewed and your sample is small, consider a non-parametric test instead, such as the Mann-Whitney U test for two independent groups or the Wilcoxon signed-rank test for paired data or a single sample.10


Sources

  1. NIST/SEMATECH e-Handbook of Statistical Methods, 1.3.5.3 Two-Sample t-Test for Equal Means. National Institute of Standards and Technology. § 1.3.5.3. Accessed September 28, 2026.
  2. NIST/SEMATECH e-Handbook of Statistical Methods, 1.3.5.2 Confidence Limits for the Mean. National Institute of Standards and Technology. § 1.3.5.2. Accessed September 28, 2026.
  3. Illowsky B, Dean S. Introductory Statistics 2e, 10.4 Matched or Paired Samples. OpenStax. 2023;§ 10.4. Accessed September 28, 2026.
  4. Illowsky B, Dean S. Introductory Statistics 2e, 8.2 A Single Population Mean using the Student t Distribution. OpenStax. 2023;§ 8.2. Accessed September 28, 2026.
  5. Illowsky B, Dean S. Introductory Statistics 2e, 7.1 The Central Limit Theorem for Sample Means (Averages). OpenStax. 2023;§ 7.1. Accessed September 28, 2026.
  6. Wasserstein RL, Lazar NA. The ASA Statement on p-Values: Context, Process, and Purpose. The American Statistician. 2016;70(2):129-133. doi:10.1080/00031305.2016.1154108. Accessed September 28, 2026.
  7. Lakens D. Calculating and reporting effect sizes to facilitate cumulative science: a practical primer for t-tests and ANOVAs. Frontiers in Psychology. 2013;4:863. doi:10.3389/fpsyg.2013.00863. Accessed September 28, 2026.
  8. Illowsky B, Dean S. Introductory Statistics 2e, 9.5 Additional Information and Full Hypothesis Test Examples. OpenStax. 2023;§ 9.5. Accessed September 28, 2026.
  9. NIST/SEMATECH e-Handbook of Statistical Methods, 7.4.3.6 Assessing the response from any factor combination. National Institute of Standards and Technology. § 7.4.3.6. Accessed September 28, 2026.
  10. G*Power 3.1 manual. Heinrich Heine University Düsseldorf. 2023;§20.1 Effect size index, p. 50. Accessed October 8, 2026.
  11. Ruxton GD, Neuhäuser M. When should we use one-tailed hypothesis testing? Methods in Ecology and Evolution. 2010;1(2):114-117. doi:10.1111/j.2041-210X.2010.00014.x. Accessed November 22, 2026.