ThisCalculator

Everyday

Easy t test calculator? How to run it

Updated · Standard formula, shown below

The calculator for this page is switched off while it is checked. The formula is below, and the worked example in the article shows how to use it by hand.

Easy t test calculator? How to run it

An easy t test calculator lets you enter your sample data (or summary statistics) and instantly get the t-statistic, degrees of freedom, and p-value for a Student’s t test. You choose the type of t test (one-sample, independent two-sample, or paired), enter your numbers, and the calculator applies the standard formula to tell you whether the difference you observe is statistically significant. Below is a working calculator that handles the most common case: comparing the means of two independent groups with unequal sample sizes and unequal variances (Welch’s t test).

Formula

For an independent two-sample t test with unequal variances (Welch’s t test), the test statistic is:

t = (M� – M₂) / √(s�²/n� + s₂²/n₂)

where:

  • Mâ‚� and Mâ‚‚ are the sample means of group 1 and group 2
  • sâ‚�² and s₂² are the sample variances (standard deviation squared) of each group
  • nâ‚� and nâ‚‚ are the sample sizes

The degrees of freedom for Welch’s t test are given by the Welch–Satterthwaite equation:

df = (s�²/n� + s₂²/n₂)² / [ (s�²/n�)²/(n�–1) + (s₂²/n₂)²/(n₂–1) ]

The p-value is the probability of observing a t-statistic as extreme as (or more extreme than) the one you got, assuming the null hypothesis (no difference between group means) is true. For a two-tailed test, it’s 2 × (1 – CDF_t(|t|, df)), where CDF_t is the cumulative distribution function of the t distribution.

Worked Example

Using the default values from the calculator:

  • Group 1: mean = 100, SD = 15, n = 30
  • Group 2: mean = 105, SD = 18, n = 35

Step 1: Compute the standard error of the difference:

SE = √(15²/30 + 18²/35) = √(225/30 + 324/35) = √(7.5 + 9.2571) = √16.7571 ≈ 4.094

Step 2: Compute the t-statistic:

t = (100 – 105) / 4.094 = –5 / 4.094 ≈ –1.221

Step 3: Compute degrees of freedom:

df = (7.5 + 9.2571)² / [ (7.5)²/29 + (9.2571)²/34 ] = (16.7571)² / (56.25/29 + 85.69/34) = 280.8 / (1.9397 + 2.5203) = 280.8 / 4.46 ≈ 62.96

Step 4: Find the two-tailed p-value. Using a t table or software, t = –1.221 with df ≈ 63 gives a p-value of about 0.2266.

So the calculator shows t ≈ –1.221, df ≈ 63.0, p ≈ 0.2266. Since p > 0.05, you would not reject the null hypothesis at the 5% significance level.

When to Use a t Test

A t test is used when you want to compare the means of one or two groups and you have a small sample size (typically n < 30) or you do not know the population standard deviation. The three main types are:

  • One-sample t test: Compares the mean of a single group to a known value (e.g., is the average height of a sample different from 170 cm?).
  • Independent two-sample t test: Compares the means of two different groups (e.g., test scores of students who studied with method A vs. method B).
  • Paired t test: Compares the means of the same group measured twice (e.g., before and after a treatment).

The calculator above handles the independent two-sample case with unequal variances, which is the most common scenario in real data because sample sizes and variances often differ.

How to Choose the Right t Test

Before you run a t test, you need to decide which type fits your data:

  • If you have one group and a known reference value → one-sample t test.
  • If you have two independent groups (e.g., men vs. women, treated vs. control) → independent t test.
  • If you have one group measured twice (e.g., pre-test and post-test) → paired t test.

For the independent t test, you also need to decide whether to assume equal variances. The classic Student’s t test assumes equal variances; Welch’s t test does not. Many statisticians recommend using Welch’s t test by default because it performs well even when variances are equal, and it avoids the assumption. The calculator above uses Welch’s method, so it’s a safe choice.

Common Mistakes and Pitfalls

  • Using the wrong standard deviation: Make sure you enter the sample standard deviation (the one with n–1 in the denominator), not the population standard deviation. Most calculators and software report the sample SD.
  • Mixing up one-tailed and two-tailed p-values: If your hypothesis is directional (e.g., “group 1 is greater than group 2â€�), you use a one-tailed test. If you only care about any difference, use a two-tailed test. The calculator above gives a two-tailed p-value.
  • Ignoring the normality assumption: The t test assumes the data are approximately normally distributed, especially for small samples. If your data are heavily skewed, consider a nonparametric test like the Mann–Whitney U test.
  • Rounding too early: If you round intermediate values (like the SE) too much, your final p-value can be off. Keep at least 3–4 decimal places during calculations.

Limitations of the t Test

The t test is a parametric test, which means it relies on assumptions about the underlying distribution. The main limitations are:

  • It assumes the data are continuous and approximately normally distributed (for small samples).
  • It is sensitive to outliers, which can inflate the standard deviation and reduce the t-statistic.
  • It only tests the difference between means; it does not tell you the effect size or practical significance.
  • For very small samples (n < 5), the t test has low power, meaning it may fail to detect a real difference even if one exists.

If these assumptions are violated, you might need to use a nonparametric alternative or a different statistical method.

Frequently Asked Questions

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

A z test is used when you know the population standard deviation and the sample size is large (typically n > 30). A t test is used when the population standard deviation is unknown and you estimate it from the sample. For large samples, the t distribution approaches the normal distribution, so the results are very similar.

Can I use a t test with unequal sample sizes?

Yes, you can. Welch’s t test (which the calculator above uses) does not require equal sample sizes or equal variances. It adjusts the degrees of freedom to account for the unequal variances and sample sizes, making it robust.

What does a p-value of 0.05 mean?

A p-value of 0.05 means that if the null hypothesis were true (no difference), there is a 5% chance of observing a t-statistic as extreme as the one you got. By convention, if p < 0.05, you reject the null hypothesis and conclude there is a statistically significant difference.

How do I report the results of a t test?

You typically report the t-statistic, degrees of freedom, and p-value, like this: “t(63) = –1.22, p = 0.23.� You should also include the means and standard deviations of each group, and the sample sizes.

What if my data are not normally distributed?

If your sample size is large (n > 30 per group), the t test is fairly robust to non-normality due to the Central Limit Theorem. For small samples, consider using a nonparametric test like the Mann–Whitney U test (for independent groups) or the Wilcoxon signed-rank test (for paired data).

Related

Formula used
in mean1 | Mean of group 1 | - | 100 | 0
in sd1 | SD of group 1 | - | 15 | 0
in n1 | Sample size 1 | - | 30 | 1
in mean2 | Mean of group 2 | - | 105 | 0
in sd2 | SD of group 2 | - | 18 | 0
in n2 | Sample size 2 | - | 35 | 1
out t | t-statistic | - | (mean1 - mean2) / sqrt(sd1^2/n1 + sd2^2/n2) | 3
out df | Degrees of freedom (Welch) | - | (sd1^2/n1 + sd2^2/n2)^2 / ( (sd1^2/n1)^2/(n1-1) + (sd2^2/n2)^2/(n2-1) ) | 1
out p | p-value (two-tailed) | - | 2 * (1 - tcdf(abs(t), df)) | 4

Each line is one input (in, sel, list) or one result (out: label, unit, formula, decimals). How the calculators work

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.