T-Test Calculator

This t-test calculator runs a one-sample, two-sample, or paired t-test from raw data or summary statistics. For two samples you can use Welch’s test (the default, which does not assume equal variances) or a pooled test. The result includes the t statistic, degrees of freedom, the p-value, and a confidence interval for the mean or mean difference.

T-test calculator

Run a one-sample, two-sample (Welch or pooled), or paired t-test from summary statistics or raw data.

Type of t-test
Input
Variances
Alternative

Calculator loading… If the form does not return a result, wait a moment and try again.

How the t-test is calculated

One-sample: t = (x̄ − μ₀) / (s / √n), with df = n − 1.

Paired: the same formula applied to the differences di = xi − yi.

Two-sample, Welch: t = (x̄₁ − x̄₂ − δ₀) / √(s₁²/n₁ + s₂²/n₂), with Welch–Satterthwaite degrees of freedom.

Two-sample, pooled: t = (x̄₁ − x̄₂ − δ₀) / (sp √(1/n₁ + 1/n₂)), with df = n₁ + n₂ − 2, where sp² pools the two sample variances.

The p-value comes from Student’s t distribution with those degrees of freedom. Welch’s test is the safer default when you cannot assume the two populations share a variance.

Worked example

Heights (in meters): 1.83, 1.62, 1.71, 1.89, 1.77, 1.70, 1.66, 1.80. Test whether the mean equals 1.70.

The sample mean is 1.7475 and the sample SD is about 0.0896, with n = 8. Then SE = 0.0317 and t = (1.7475 − 1.70) / 0.0317 ≈ 1.50, with df = 7. The two-sided p-value is about 0.177, so the data are compatible with a mean of 1.70 at the 5% level.

Related calculators and guides

Frequently asked questions

When should I use a t-test instead of a z-test?

Use a t-test when the population standard deviation is unknown and you estimated it from the sample. A z-test is reserved for a known standard deviation or a very large sample with a well-estimated standard error.

Should I choose Welch or pooled for two samples?

Welch’s test is the usual default because it does not assume equal population variances. Use the pooled test only when you have a good reason to assume the variances are equal.

What is a paired t-test?

A paired t-test is used when each observation in one sample has a natural partner in the other, such as before-and-after measurements on the same person. The test is a one-sample t-test on the differences.

Does this calculator assume normality?

The classical t-test assumes that the observations (or the differences, or the two samples) come from a normal population, or that the sample is large enough for the sampling distribution of the mean to be approximately normal. For small, skewed samples, a nonparametric test such as the Mann–Whitney or a Wilcoxon signed-rank test may be more appropriate.

How should I enter raw data?

Enter numbers separated by commas, spaces, or new lines, and use a period as the decimal point. Do not use thousands separators.