Change language

Statistics

Student’s and Welch’s t-test calculator

Compare two means (independent or paired) or one mean with a value, with p value, confidence interval and effect size.

Published by SolucionesAhora.com How we verify

Calculator inputs

  1. Enter your figures, or press “See example” to watch it work.
  2. If your case is unusual, open “Advanced options”.
  3. Read the result and, below it, what it means and how it was worked out.

Two groups of different people: “independent”. The same people measured twice (before and after): “paired”. One group against a reference value: “one sample”. If you only have means and SDs from a paper: “summary”.

The observations of the first group (or the first measure, or the sample). In the paired test, the difference is measure 1 minus measure 2, and the lists must be in the same order and size.

Values separated by commas or spaces

The observations of the second group (or the second measure).

Values separated by commas or spaces

The value you compare your sample mean with (the null hypothesis).

The mean being tested

The mean of the first group.

The sample standard deviation of the first group.

Sample SD (n − 1)

How many people the first group has.

At least 2

The mean of the second group.

The sample standard deviation of the second group.

Sample SD (n − 1)

How many people the second group has.

At least 2

Advanced options

Two-sided: the means differ (the usual case). One-sided: only one direction matters, and must be decided before seeing the data; the one-sided p value is half.

Welch does not assume equal variances and is the recommended default: it works just as well when they are equal and much better when they are not. The classic Student t needs equal variances.

The maximum false-positive probability you accept. 5% is the standard; the confidence interval uses 1 − α.

See the result

Results

Student’s t-4.600
Degrees of freedom9.98
p valuep < 0.001
Mean difference-3.8333
CI of the difference: lower-5.6905
CI of the difference: upper-1.9761
Cohen’s d-2.656
Hedges’ g-2.451
Standard error of the difference0.8333
Variance ratio (larger ÷ smaller)1.083
Descriptives
GroupnMeanSDSE
Group 1614.16671.4720.6009
Group 26181.41420.5774
See the working step by step
  1. Standard error of the difference = 0.8333; degrees of freedom = 9.98
Free, no sign-up! What if you could do this without a calculator? A five-minute game with challenges, lives and points. It clicks even when you cannot be bothered.

In short

What it calculates
Compare two means (independent or paired) or one mean with a value, with p value, confidence interval and effect size.
Formula used
Independent (Welch): t = (x̄₁ − x̄₂) / √(s₁²/n₁ + s₂²/n₂), df = (s₁²/n₁ + s₂²/n₂)² / [ (s₁²/n₁)²/(n₁−1) + (s₂²/n₂)²/(n₂−1) ]
Example
Example 1. Two independent groups.

t-test calculator

The t-test answers a very common question: is the difference between two means real, or could it be down to sampling chance? It is used to compare two groups, the before and after of the same people, or a mean against a reference value.

Choose the type of comparison, paste the data (or type the means, SDs and sizes from a paper) and you get the t statistic, the p value, the confidence interval of the difference, the effect size (Cohen’s d and Hedges’ g) and, for two groups, a check on the variances. By default it uses Welch’s test, which is safer. Everything runs in your browser.

How it works

The t statistic is the difference in means divided by its standard error: how many standard errors separate the means. With that value and the degrees of freedom you get the p value, the probability of seeing a difference this large (or larger) if there were really none.

For independent groups, the classic t pools the variances and requires them to be equal; Welch’s does not, and adjusts the degrees of freedom. For paired samples you work with each pair’s difference, and for one sample, with the difference from the reference value. The confidence interval of the difference is the difference ± critical t × standard error.

Formula

Independent (Welch): t = (x̄₁ − x̄₂) / √(s₁²/n₁ + s₂²/n₂), df = (s₁²/n₁ + s₂²/n₂)² / [ (s₁²/n₁)²/(n₁−1) + (s₂²/n₂)²/(n₂−1) ]
Independent (Student): t = (x̄₁ − x̄₂) / √(s_p² (1/n₁ + 1/n₂)), df = n₁ + n₂ − 2
Paired: t = d̄ / (s_d / √n), df = n − 1 One sample: t = (x̄ − μ₀) / (s / √n), df = n − 1
CI = difference ± critical t × standard error d = difference / s_p (or s_d if paired) g = d × J(df)

Worked example

Example 1. Two independent groups.
Group 1: 12, 15, 14, 16, 13, 15 (mean 14.17). Group 2: 18, 17, 19, 16, 20, 18 (mean 18.00). With Welch, t = −4.60 on 9.98 degrees of freedom and p < .001. The difference is −3.83 (95% CI −5.69 to −1.98), with d = −2.66 and g = −2.45: a very large effect. The variances are almost equal (ratio 1.08), so Student would give practically the same.

Example 2. From a paper.
Group 1: mean 78, SD 8, n = 40. Group 2: mean 70, SD 9, n = 35. With Welch, t = 4.04 on 68.66 degrees of freedom, p < .001; a difference of 8 points (95% CI 4.05 to 11.95), d = 0.94.

Example 3. Before and after.
Ten patients score 72, 65, 80, 74, 68, 77, 70, 83, 66, 75 before and 78, 70, 85, 75, 74, 84, 73, 88, 71, 80 after. They improve by 4.8 points on average (95% CI 3.59 to 6.01): t(9) = 9.00, p < .001, d_z = 2.85.

Example 4. One sample.
Eight measurements (5.1, 4.9, 5.6, 5.2, 4.8, 5.4, 5.0, 5.3) against a reference value of 5: the mean is 5.16, t(7) = 1.72, p = .129. You cannot claim it differs from 5.

Explanation

What the t-test compares

It compares means. The null hypothesis is that the population mean is the same (or equal to the reference value). The p value is the probability of getting a difference as large as the one observed if that hypothesis were true. If it is below α (usually 0.05), it is rejected.

Which version to use

  • **Two independent groups**: different people in each group. Use Welch by default.
  • **Paired**: the same people measured twice, or matched pairs. It is more powerful because it removes variation between people.
  • **One sample**: a group’s mean against a theoretical or reference value.

Welch or Student

The classic Student t assumes both groups have the same variance. With unequal variances and unequal sizes, its error rate drifts away from 5%. Welch’s works just as well with equal variances and much better without them, so using it always is recommended (Delacre et al., 2017). It is not wise to choose between them based on a preliminary variance test.

Beyond the p value

A p value does not say how big the difference is. Always report the difference with its confidence interval and the effect size (d or g). With large samples, tiny differences are significant; with small samples, important differences may not be.

Assumptions

  • Independent observations (except in the paired test, where pairs are matched).
  • Roughly normal data (or differences), mainly important with small samples.
  • No extreme outliers. If normality fails, consider a nonparametric test (Mann-Whitney, Wilcoxon).

Common mistakes

  • Using the independent test with paired data (power is lost).
  • Reading p > .05 as proof there is no difference.
  • Deciding the test’s tail after seeing the data.
  • Running many t-tests instead of one ANOVA, inflating error.
  • Reporting only the p value.

Limits of this calculator

  • It assumes roughly normal data; it does not check normality.
  • For three or more groups, use the ANOVA with post hoc.
  • The F test of variances is sensitive to non-normality; it is only a guide.
  • It accepts up to 5,000 values per group.

Notice

This is an estimate. For publication, check the figures with your statistics package and report the method (for example, “two-sided Welch t-test”).

Frequently asked questions

When do I use the t-test?

To compare two means (independent or paired) or one mean with a value, when the data are numeric and roughly normal.

What is the difference between Student and Welch?

Student assumes equal variances; Welch does not. With unequal variances Welch is more reliable and with equal variances it performs the same: use it by default.

When do I use the paired test?

When both measures come from the same people (before and after) or from matched pairs.

What does a p value below 0.05 mean?

That, if there were no real difference, seeing a difference this large would be unlikely (under 5%). It does not say the effect is large or important.

What is a one-sided test?

A test that looks for a difference in one direction only. It must be decided before seeing the data; the p value is half that of a two-sided test.

What if my data are not normal?

With large samples the t-test is robust. With small samples and very skewed data, use Mann-Whitney (independent) or Wilcoxon (paired).

What sample size do I need?

It depends on the effect you want to detect; the statistical power calculator works it out.

Is my data sent to a server?

No. The calculation runs in your browser.

Sources and references

The formula behind this calculator is not ours. These are the sources it comes from, in APA 7 format, in case you want to go to the original or cite them in your own work.

  1. Student. (1908). The probable error of a mean. Biometrika, 6(1), 1–25. https://doi.org/10.2307/2331554 https://doi.org/10.2307/2331554 The origin of Student’s t.
  2. Welch, B. L. (1947). The generalization of “Student’s” problem when several different population variances are involved. Biometrika, 34(1–2), 28–35. https://doi.org/10.2307/2332510 https://doi.org/10.2307/2332510 The t test with unequal variances and its degrees of freedom.
  3. Delacre, M., Lakens, D., & Leys, C. (2017). Why psychologists should by default use Welch’s t-test instead of Student’s t-test. International Review of Social Psychology, 30(1), 92–101. https://doi.org/10.5334/irsp.82 https://doi.org/10.5334/irsp.82 Why Welch should be the default.
  4. Lakens, D. (2013). Calculating and reporting effect sizes to facilitate cumulative science: A practical primer for t-tests and ANOVAs. Frontiers in Psychology, 4, Article 863. https://doi.org/10.3389/fpsyg.2013.00863 https://doi.org/10.3389/fpsyg.2013.00863 How to calculate d, g and d_z.

Need to calculate something else?

These tools are often used alongside this calculator.

Cohen’s d

Effect size between two groups or before and after, with confidence intervals, plain-language equivalents…

Power & sample size

How many participants do you need? Work out sample size for a t test, correlation, ANOVA, proportions or…

ANOVA & post hoc

Compare the means of three or more groups: ANOVA, equal-variance check, Tukey or Games-Howell, effect size…

Non-parametric tests

Non-parametric tests for ordinal or non-normal data: exact p values when possible, effect sizes and Dunn’s…

Confidence interval

The range the true mean is likely to fall in at your chosen confidence level.

Sample size

How many responses you need to estimate a percentage or a mean, with finite population, design effect and…