InfyCalculator
📊

t-Test Calculator (One-Sample, Two-Sample Welch or Pooled, and Paired)

Run a one-sample, two-sample (Welch or pooled Student) or paired t-test from pasted data or summary statistics — t, degrees of freedom, one- or two-tailed p-value, confidence interval, effect size, variance and normality checks, and every step.

Test type
Sample data
Population mean (μ₀)
Group 1 data
Group 2 data
Mean (x̄₁)
Standard deviation (s₁)
Sample size (n₁)
Group 2 mean (x̄₂)
Group 2 standard deviation (s₂)
Group 2 sample size (n₂)
Variances
Alternative hypothesis
Significance level (α)
Hypothesised difference (d₀)
Decimal separator
Loading calculator…

How it works

One-sample: t = (x̄ − μ₀) ÷ (s ÷ √n), df = n − 1 · Welch: t = (x̄₁ − x̄₂ − d₀) ÷ √(s₁²/n₁ + s₂²/n₂), df = (s₁²/n₁ + s₂²/n₂)² ÷ [(s₁²/n₁)²/(n₁−1) + (s₂²/n₂)²/(n₂−1)] · Pooled: s_p² = [(n₁−1)s₁² + (n₂−1)s₂²] ÷ (n₁+n₂−2), t = (x̄₁ − x̄₂ − d₀) ÷ (s_p √(1/n₁ + 1/n₂)), df = n₁+n₂−2 · Paired: t = (d̄ − d₀) ÷ (s_d ÷ √n) · CI = estimate ± t* × SE · Cohen’s d = difference ÷ SD

A t-test asks whether an observed difference in means is larger than you would expect from sampling noise alone. The one-sample test compares a sample mean with a fixed reference value μ₀. The two-sample test compares two independent groups: Welch’s version does not assume equal variances and estimates the degrees of freedom with the Welch–Satterthwaite formula, while Student’s pooled version assumes equal variances and uses n₁ + n₂ − 2 degrees of freedom. The paired test works on the within-subject differences when the same people are measured twice. Paste raw numbers (commas, spaces or a spreadsheet column) or enter the means, standard deviations and sample sizes. Choose a two-tailed test for any difference or a one-tailed test when only one direction matters, and the significance level α. The calculator reports t, the degrees of freedom, the exact p-value from the Student t distribution (via the regularized incomplete beta function — the same values SciPy gives), the critical value, a confidence interval at 1 − α, Cohen’s d (and Hedges’ g for two groups), and checks of the assumptions: an F test and Levene’s test for equal variances, and a Shapiro–Wilk normality test for raw data. For two groups, a table shows Welch and pooled results side by side, and the full worked steps use your numbers.

Worked example

For the sample 5.1, 4.9, 5.2, 5.0, 4.8, 5.3 tested against μ₀ = 5: the mean is 5.05 and the sample standard deviation is 0.1871, so the standard error is 0.1871 ÷ √6 = 0.07638. Then t = (5.05 − 5) ÷ 0.07638 = 0.6547 on 5 degrees of freedom, giving a two-tailed p-value of 0.5416 — not significant at α = 0.05, and the 95% confidence interval for the mean, 4.8537 to 5.2463, contains 5. For two groups, 5.1, 4.9, 5.2, 5.0, 4.8 against 5.5, 5.7, 5.4, 5.9, 5.6 gives a mean difference of −0.62; Welch’s t = −5.5678 on 7.71 df (p = 0.000603, 95% CI −0.8785 to −0.3615), and the pooled test gives the same t on 8 df (p = 0.00053). Cohen’s d with the pooled SD is −3.52, a very large effect.

Sources: Student's t-test — Wikipedia · NIST/SEMATECH e-Handbook — two-sample t-test for equal means · Welch (1947), The generalization of “Student’s” problem when several different population variances are involved, Biometrika 34:28–35

Frequently asked questions

When should I use a one-sample, two-sample or paired t-test?

One-sample: you compare one group’s mean with a known or target value (is the mean fill weight 5 g?). Two-sample: two separate, independent groups (treatment vs control). Paired: the same subjects measured twice, or matched pairs (before vs after) — it analyses the differences and is more powerful when measurements are linked.

Welch or pooled Student t-test?

Welch’s test is the safer default: it stays accurate when the two groups have different variances or sizes, and loses almost nothing when the variances are equal. The pooled test assumes equal variances; it is fine when the SDs are similar and the group sizes are close. The calculator shows both, plus an F test and Levene’s test of equal variances.

What does the p-value mean?

It is the probability, if the null hypothesis (no difference) were true, of getting a t statistic at least as extreme as yours — in either direction for a two-tailed test, or in the chosen direction for a one-tailed test. A p-value below α (usually 0.05) is called statistically significant.

Can I run the test with only means and standard deviations?

Yes. Choose a "from mean, SD and n" option and type the summary statistics. The results are identical to raw data with the same mean, SD and size, except that the normality and Levene checks need the raw values. Make sure you enter the standard deviation, not the standard error (SE = SD ÷ √n).

Should I use a one-tailed or a two-tailed test?

Use two-tailed unless you decided before seeing the data that only one direction matters. A one-tailed p-value is half the two-tailed one when the effect goes the predicted way, so choosing it after looking at the data inflates false positives.

Does a significant t-test prove the effect is important?

No. Significance only says the difference is unlikely to be pure chance. With a large sample even a tiny difference can be significant, so look at the mean difference, its confidence interval and the effect size (Cohen’s d: about 0.2 small, 0.5 medium, 0.8 large).

How do I report the result?

Give the means and SDs, t with its degrees of freedom, the p-value, the confidence interval of the difference and an effect size — for example: Welch’s t(7.71) = −5.57, p < .001, mean difference −0.62 (95% CI −0.88 to −0.36), d = −3.52.

Related calculators

Paired t-Test Calculator
Paste before-and-after (paired) data or summary statistics and get the paired t-test: mean difference, t statistic, degrees of freedom, one- or two-tailed p-value, confidence interval, effect size, a Shapiro–Wilk normality check and every step worked out.
Two-Sample t-Test Calculator (Pooled)
Compare the means of two independent groups with the pooled (equal-variance) Student t-test — get the t statistic, degrees of freedom, two-tailed p-value and a verdict.
One-Sample T-Test Calculator
Test a sample mean against a hypothesised value using the sample standard deviation, with the t statistic, degrees of freedom and a decision.
P-Value Calculator
Convert a z-score into a p-value from the normal distribution for a left, right or two-tailed test, with a significance verdict at 0.05.
Confidence Interval Calculator
Build a confidence interval for a mean from your sample mean, standard deviation and size — with the margin of error and the interval bounds.
Standard Deviation Calculator
Paste a list of numbers and get the sample or population standard deviation, variance, mean, standard error, confidence interval, quartiles, z-scores, a frequency table and a histogram, with every step worked out.
Cohen's d Calculator
Measure effect size between two groups with Cohen’s d from their means, standard deviations and sizes — with the pooled SD and a magnitude label.
ANOVA Calculator
Run a one-way ANOVA across two or more groups — get the F statistic, between- and within-group degrees of freedom, the p-value and a verdict at α = 0.05.

For education — check the test assumptions (independence, sample size, distribution) before drawing conclusions from a p-value.