Skip to content

T-Test Calculator

One-sample, paired and two-sample t-tests (Student's pooled and Welch's) from data or summary statistics: t, df, p-value, confidence interval and Cohen's d.

Calculator Details

p-value (two-sided):0.07939See results ↓

Welch (two samples, unequal variances), Student pooled (equal variances), paired, or one sample against a value

Raw data, or each sample’s mean, standard deviation and size

Numbers separated by commas, spaces or new lines

For a paired test, in the same order as sample 1

The mean (one sample) or difference (two samples, paired) under the null hypothesis, usually 0

Two-sided (≠), or one-sided: less than (<) or greater than (>)

Reject the null hypothesis when p < α; the confidence interval is 1 − α

Your Results

p-value (two-sided): 0.07939

p-value (two-sided)

0.07939

Not significant at α = 0.05

t statistic

−1.8608

17.776 degrees of freedom

Mean difference

−1.58

Standard error 0.84909

95% confidence interval

−3.3655 to 0.20548

± 2.1028 × SE

Cohen's d

−0.83218

Difference ÷ pooled SD

Welch's two-sample t-test gives t = -1.861 with 17.78 degrees of freedom and a two-sided p-value of 0.07939, not significant at α = 0.05: no evidence to reject the null hypothesis.

Compare scenarios

Save these inputs as a scenario, change them, and compare the results side by side.

Loading, available in a moment

Student's t distribution with 17.776 df

Student's t distribution with 17.776 df

Detailed Breakdown

Samples
SamplenMeanSDSE of mean
Sample 1100.751.7890.56573
Sample 2102.332.00220.63317
p-values for each alternative
Alternative hypothesisp-value
Two-sided: difference ≠ 0 (yours)0.07939
Less: difference < 00.0397
Greater: difference > 00.9603

How This Calculator Works

How it's calculated

Every t-test divides an observed difference by its standard error: t = (difference − μ₀) ÷ SE. The p-value is the probability of a t at least this extreme under the null hypothesis, from Student's t distribution with the degrees of freedom shown. Welch's test uses separate variances and the Welch–Satterthwaite degrees of freedom; Student's pools the variances.

SE = √(1.789²/10 + 2.0022²/10) = 0.84909; df (Welch–Satterthwaite) = 17.776
t = (−1.58 − 0) ÷ 0.84909 = −1.8608 → p = 0.07939
CI = −1.58 ± 2.1028 × 0.84909 = −3.3655 to 0.20548

Frequently Asked Questions

Which t-test should I use?

Use a one-sample test to compare one group's mean with a fixed value, a paired test when each value in one sample matches one in the other (the same people before and after), and a two-sample test for two independent groups. For two groups, Welch's test is the safer default because it does not assume equal variances.

What is the difference between Student's and Welch's t-test?

Student's test pools the two variances and has n₁ + n₂ − 2 degrees of freedom; it is exact only when the population variances are equal. Welch's test keeps them separate and uses the Welch–Satterthwaite degrees of freedom. On the default sleep data, Welch gives t = -1.8608 with 17.776 df and p = 0.0794.

Why does the paired test give a smaller p-value on the same data?

Pairing removes the variation between subjects. The default data are the same ten patients on two drugs: as independent groups p = 0.0794, but as pairs t = -4.0621 and p = 0.0028, because every patient's own baseline cancels out. Only pair the samples when the design really is paired.

What does the p-value mean?

The probability of getting a t statistic at least as extreme as yours if the null hypothesis were true. A small p-value (below α, often 0.05) means the data would be surprising if there were no difference, so you reject the null hypothesis. It is not the probability that the null hypothesis is true.

One-sided or two-sided?

Use two-sided unless you decided before seeing the data that only one direction matters, and a result in the other direction would be treated the same as no effect. A one-sided p-value is half the two-sided one when the effect is in the predicted direction.

What is Cohen's d?

A standardised effect size: the difference in means divided by a standard deviation. Cohen's rough guide calls 0.2 small, 0.5 medium and 0.8 large. Unlike the p-value it does not grow with the sample size, so it tells you how big the difference is rather than how sure you are of it.

What are the assumptions of a t-test?

Independent observations, and data that are roughly normal within each group, or samples large enough (about 30 or more each) for the central limit theorem to help. Student's pooled test also assumes equal variances. With small, clearly skewed samples or outliers, consider a non-parametric test such as Mann–Whitney or Wilcoxon.

Can I run a t-test from means and standard deviations only?

Yes. Choose "Summary statistics" and enter each group’s mean, standard deviation and size. For a paired test enter the mean and standard deviation of the differences and the number of pairs. The results are identical to running the test on the raw data.

One-sample, paired, Student pooled and Welch two-sample t-tests as defined in the NIST/SEMATECH e-Handbook of Statistical Methods and R's t.test, with p-values from the Student t distribution. The confidence interval is two-sided at 1 − α whatever the alternative. Assumes independent observations (independent pairs for the paired test) and roughly normal data or large samples. Not included: tests of the assumptions (Shapiro–Wilk, Levene, F-test), non-parametric alternatives (Mann–Whitney, Wilcoxon signed-rank), power and sample-size calculations, Hedges' g small-sample correction, multiple comparisons and ANOVA for more than two groups.

T-Test Calculator: One-Sample, Paired, Student and Welch Two-Sample Tests

By FindMySum · Last reviewed

A t-test asks whether a difference in averages is bigger than you would expect from chance alone. It is one of the most used tools in statistics: comparing two treatments, a process before and after a change, or a sample against a target value. This calculator runs all four common versions from raw data or from summary statistics and reports the t statistic, degrees of freedom, p-value, confidence interval and effect size. The opening example is R's classic sleep data: the extra hours of sleep ten patients got from two different drugs.

The idea

Every t-test has the same shape. Take the difference you observed, subtract the difference the null hypothesis says there should be (usually zero), and divide by the standard error, the typical size of that difference from sampling noise alone:

t = (observed difference − μ₀) ÷ standard error

A t near 0 is what chance alone would give. A large positive or negative t is unusual under the null hypothesis. How unusual is measured by the p-value, read from Student's t distribution with the right degrees of freedom. The t distribution looks like the normal curve but with heavier tails, especially for small samples, because the standard error is itself estimated from the data.

One-sample test

Compare one sample's mean with a fixed value μ₀, such as a specification or a published average:

t = (x̄ − μ₀) ÷ (s ÷ √n), df = n − 1

For example, 36 students average 103 on a test whose population mean is 100, with a standard deviation of 15: t = 3 ÷ (15 ÷ 6) = 1.2 with 35 degrees of freedom, p = 0.238. The difference could easily be chance.

Paired test

When each value in one sample is matched with one in the other, the same patient on two drugs, a part measured by two instruments, a store's sales before and after a promotion, work with the differences. The paired test is a one-sample test on the differences against μ₀ = 0.

In the sleep data, the differences between the two drugs for the ten patients have mean −1.58 hours and standard deviation 1.23, so t = −1.58 ÷ (1.23 ÷ √10) = −4.06 with 9 degrees of freedom, p = 0.0028. Pairing removes the large differences between patients, which is why it is so much more sensitive than treating the groups as independent.

Two-sample tests: Student and Welch

For two independent groups, the difference is x̄₁ − x̄₂. The two versions differ in how they estimate its standard error.

Student's pooled test assumes both populations have the same variance and pools the two sample variances:

s_p² = [(n₁ − 1)s₁² + (n₂ − 1)s₂²] ÷ (n₁ + n₂ − 2), SE = s_p √(1/n₁ + 1/n₂), df = n₁ + n₂ − 2

Welch's test keeps the variances separate:

SE = √(s₁²/n₁ + s₂²/n₂)

with the Welch–Satterthwaite degrees of freedom:

df = (s₁²/n₁ + s₂²/n₂)² ÷ [(s₁²/n₁)²/(n₁ − 1) + (s₂²/n₂)²/(n₂ − 1)]

which is usually not a whole number. Welch's test is nearly as powerful as Student's when the variances are equal and much more reliable when they are not, especially with unequal sample sizes, so many statisticians (and R, by default) use it routinely.

Treating the sleep data as two independent groups, Welch's test gives t = −1.861 with 17.78 degrees of freedom and p = 0.0794, matching the example in R's documentation. At α = 0.05 the difference is not significant, even though the paired analysis of the same numbers is highly significant. The design of the study, not the data alone, decides which test is right.

One-sided and two-sided p-values

A two-sided test asks whether the means differ in either direction; its p-value counts both tails of the t distribution. A one-sided test asks about one direction only (is the new process faster?), and its p-value is one tail. Choose the alternative before looking at the data; switching to one-sided after seeing the result halves the p-value and inflates false positives. The calculator shows all three p-values so you can see the relationship.

Confidence interval

The confidence interval for the difference is:

difference ± t(1 − α/2, df) × SE

For the Welch example at 95%, −1.58 ± 2.10 × 0.849 gives −3.37 to 0.21 hours. The interval includes 0, which is the same conclusion as p > 0.05, but it also shows the range of plausible differences, which is often more useful than the yes-or-no decision.

Effect size

A p-value says how surprising the data are, not how big the effect is; with a huge sample a trivial difference becomes significant. Cohen's d expresses the difference in standard-deviation units: the mean difference divided by the pooled standard deviation for two samples, by the standard deviation for one sample, and by the standard deviation of the differences (d_z) for paired data. Cohen's rough benchmarks are 0.2 small, 0.5 medium and 0.8 large; the sleep data's −0.83 is large, though the small sample leaves it uncertain.

Assumptions and alternatives

The t-test assumes independent observations and, for small samples, roughly normal data within each group. It is fairly robust to mild skewness, especially with equal group sizes, and Welch's version removes the equal-variance assumption. With strongly skewed data, outliers or ordinal scores in small samples, consider a non-parametric test: Mann–Whitney for two independent groups, or the Wilcoxon signed-rank test for pairs. For three or more groups, use analysis of variance rather than many t-tests.

More questions

Why is it called Student's t-test?

William Sealy Gosset, a chemist at the Guinness brewery in Dublin, published the t distribution in 1908 under the pen name 'Student', because the brewery did not let staff publish under their own names. He needed a way to draw conclusions from the small samples of barley and hops he worked with.

How large a sample does a t-test need?

There is no minimum beyond two values per group, but small samples have little power: they can only detect large effects. As a rough guide, detecting a medium effect (Cohen's d = 0.5) with 80% power at α = 0.05 in a two-sided two-sample test needs about 64 per group. Plan the sample size before collecting the data.

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

A z-test uses the normal distribution and needs the population standard deviation to be known. A t-test estimates the standard deviation from the sample and accounts for that extra uncertainty with the heavier-tailed t distribution. With large samples the two give almost the same answer.

Can I use a t-test on Likert-scale survey answers?

It is common and usually works reasonably for averages of several Likert items or for 7-point scales with decent sample sizes, because the t-test is robust to moderate departures from normality. For a single 5-point item with few respondents, a Mann–Whitney or Wilcoxon test is the more cautious choice.

What should I report from a t-test?

The test used, the t statistic with its degrees of freedom, the p-value, the mean difference with its confidence interval, and an effect size. For example: Welch's t(17.8) = −1.86, p = 0.079, mean difference −1.58 (95% CI −3.37 to 0.21), d = −0.83.

Sources

This article explains how the calculator works and is general information, not financial, tax, legal or medical advice. Rules change; check the sources above or a qualified professional before you act.

Spotted a wrong result or a bug? Report a problem

May we count your visits with Invoker Analytics? It keeps a random visitor number in your browser. Your calculator inputs are never sent. Privacy policy