T-Test Calculator

Test whether means differ with a one-sample, paired or two-sample t-test.

T-Test Calculator tool

Test
Input
—
t statistic
—
Degrees of freedom
—
p-value
—
Mean difference
—
Confidence interval for the difference
—
Cohen's d
—
Result

About the T-Test Calculator

Did a new teaching method raise scores? Is one machine filling bottles differently from another? A t-test checks whether a difference in means is larger than random sampling would explain. This t test calculator runs one-sample, paired and two-sample tests, with Welch's version for unequal variances, from raw data or summary statistics, and reports t, the degrees of freedom, the p-value and a confidence interval.

Each test computes t = (difference in means) ÷ (standard error of the difference). For one sample, t = (x̄ − μ₀) ÷ (s ÷ √n) with n − 1 degrees of freedom. A paired test applies the same formula to the differences within pairs. Welch's two-sample test uses SE = √(s₁²/n₁ + s₂²/n₂) and the Welch–Satterthwaite degrees of freedom; the pooled test assumes equal variances. The p-value comes from the t distribution, and the calculator adds a confidence interval and Cohen's d effect size.

Example: group A scores 85, 90, 88, 75, 95, 80, 87 and 92, and group B scores 78, 82, 80, 70, 85, 75, 79 and 83. The mean difference is 7.5, Welch's t = 2.634 with about 12.88 degrees of freedom, and the two-tailed p-value is about 0.02076, significant at the 5% level. The 95% interval for the difference is 1.343 to 13.657, and Cohen's d is about 1.32, a large effect.

t-tests assume roughly normal data, or samples large enough for the central limit theorem. For p-values from a known t statistic use the p-value calculator; for intervals around one mean, the confidence interval calculator; and for count data, the chi-square calculator.

How to use the T-Test Calculator

  1. Choose the testOne-sample, paired, or two independent samples.
  2. Choose data or summary statisticsPaste the raw values, or type the means, standard deviations and sizes.
  3. Set the hypothesisEnter the hypothesized mean or difference, the tail and the significance level.
  4. Read the resultSee t, the degrees of freedom, the p-value, the confidence interval and the effect size.

T-Test Calculator features

  • One-sample, paired and two-sample t-tests
  • Welch's test or pooled variances
  • Raw data or summary statistics
  • Two-tailed and one-tailed p-values
  • Confidence interval for the difference
  • Cohen's d effect size
  • Step-by-step formulas

Common uses

  • A/B tests and experiments
  • Before-and-after studies
  • Comparing two groups in research
  • Checking a process against a target
  • Statistics homework

T-tests in practice: before-and-after studies, comparing groups and a brewery's secret

By the FreeToolsWorld editorial team · Updated November 2026 · How we write and check our guides

A t-test checks whether the difference between averages is larger than random variation would explain. It is used to compare a group with a target, the same people before and after a change, or two independent groups. This guide works through a paired before-and-after example, explains which kind of t-test to use, covers the assumptions and effect sizes, and tells the story of the brewery chemist who invented the test.

Three kinds of t-test

A one-sample t-test compares a sample's mean with a known value, such as checking whether bags filled by a machine average their labelled weight. A paired t-test compares two measurements on the same subjects, such as test scores before and after a course. A two-sample t-test compares the means of two independent groups, such as customers at two branches. Choosing the right type matters, because they handle variation differently.

A worked example: a revision course

Eight students take a practice test before and after a revision course. Their scores rise by 6, 4, 5, 2, 6, 2, 6 and 5 points. The mean improvement is 4.5 points, with a standard deviation of about 1.7. The paired t-statistic is 4.5 ÷ (1.7 ÷ √8), about 7.5, with 7 degrees of freedom, giving a p-value well below 0.001.

The improvement is very unlikely to be due to chance. Whether the course caused it is another question: students might have improved anyway with time and practice, so a comparison group that did not take the course would make the conclusion stronger.

Why pairing helps

Pairing removes differences between individuals from the comparison. In the example, students start at quite different levels, but each acts as their own control, so the test focuses on the changes. Analysing the same data with a two-sample test, ignoring the pairing, would mix in the variation between students and weaken the result.

Welch or pooled?

For two independent groups, the classic pooled t-test assumes both groups have the same variance. Welch's t-test does not make that assumption and is now widely recommended as the default, because it performs well whether or not the variances are equal. When the groups have very different spreads or sizes, Welch's version is the safer choice.

Assumptions

T-tests assume that observations are independent and that the data, or the differences for a paired test, are roughly normally distributed. With larger samples, the test is fairly robust to departures from normality, thanks to the central limit theorem. With small, strongly skewed samples or outliers, non-parametric alternatives such as the Wilcoxon or Mann-Whitney tests may be more appropriate.

Effect size

A p-value says whether a difference is likely to be real, not how large it is. Cohen's d expresses the difference in standard deviation units: values around 0.2 are often called small, 0.5 medium and 0.8 large, though context matters. Reporting the mean difference, a confidence interval and an effect size together gives a complete picture.

The brewery chemist

The t-test was published in 1908 by William Sealy Gosset, a chemist at the Guinness brewery in Dublin, who needed to draw conclusions from small samples of barley and hops. Guinness did not allow employees to publish under their own names, so he wrote under the pseudonym "Student", which is why the test is still called Student's t-test.

Common mistakes

  • Using a two-sample test for paired data, or the reverse.
  • Assuming equal variances without checking.
  • Running many t-tests on the same data without adjusting for multiple comparisons.
  • Treating a significant result as proof of cause without a control group.

Related tools

For p-values from any statistic, use P-Value Calculator. For confidence intervals, try Confidence Interval Calculator, and for spread, Standard Deviation Calculator.

A one-sample example: checking a filling machine

A machine is meant to fill bags with 500 g of rice. A sample of 25 bags averages 497 g with a standard deviation of 6 g. The t-statistic is (497 − 500) ÷ (6 ÷ √25) = −2.5, with 24 degrees of freedom, giving a two-sided p-value of about 0.02. The shortfall is probably real rather than chance, so the machine may need adjusting, even though each bag is only slightly light.

Reporting a t-test

A clear report gives the group means, the difference, the t-statistic, the degrees of freedom, the p-value and a confidence interval for the difference. For the revision course, that might read: mean improvement 4.5 points, 95% confidence interval 3.1 to 5.9, t(7) = 7.53, p < 0.001. Readers can then judge both whether the effect is real and whether it is large enough to matter in practice.

Small samples and the t distribution

With small samples, the t distribution has heavier tails than the normal distribution, so larger t-values are needed before a result counts as significant. For a two-sided test at the 5% level, the critical value is about 2.36 with 7 degrees of freedom, 2.06 with 24 and close to the normal value of 1.96 with large samples. This is exactly the adjustment Gosset worked out for his small brewery samples.

Limits

Calculations are exact for the data entered; conclusions depend on the study design and the test's assumptions holding reasonably well.

Frequently asked questions

What is a t-test?

A hypothesis test for means that uses the t distribution. It asks whether the difference between a sample mean and a value, or between two means, is too large to be explained by sampling variation.

Which t-test should I use?

Use a one-sample test to compare one mean with a known value, a paired test when the same subjects are measured twice, and a two-sample test for two independent groups.

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

Student's pooled t-test assumes both groups have equal variances. Welch's test does not, and it adjusts the degrees of freedom. Welch's test is the safer default unless you know the variances are equal.

What does the p-value of a t-test mean?

The probability of a t statistic at least this extreme if the true means were equal or the null value were correct. Below 0.05, the difference is usually called statistically significant.

What are the assumptions of a t-test?

Independent observations, roughly normal data or differences, and for the pooled test equal variances. With samples of about 30 or more, moderate departures from normality matter little.

When should I use a paired t-test?

When each value in one sample is naturally matched to a value in the other, such as a patient's blood pressure before and after treatment. Pairing removes differences between subjects and increases power.

What is Cohen's d?

An effect size: the mean difference divided by a standard deviation. Roughly, 0.2 is small, 0.5 medium and 0.8 large. It shows how big a difference is, which p-values do not.

Can I do a t-test with summary statistics only?

Yes. A t-test needs only the means, standard deviations and sample sizes. Choose the summary option and enter them; paired tests need the mean and SD of the differences.