Skip to content
The Calculatorz
Hypothesis testing

T-Test Calculator (One-Sample and Two-Sample)

Run a one-sample or two-sample (Welch) t-test from summary statistics and get the t statistic, degrees of freedom, p-value and confidence interval.

Statistical results depend on the assumptions stated in the formula. Check that your data meet them before drawing conclusions.

Sample statistics

Samples

How to use this calculator

Choose a one-sample test (does a mean differ from a target value?) or a two-sample test (do two group means differ?). Enter each sample's mean, standard deviation and size. The two-sample test uses Welch's method, which does not assume equal variances. The result shows the t statistic, degrees of freedom, p-value, confidence interval and a plain-language conclusion.

Formula

One sample: t = (x̄ − μ₀) ÷ (s ÷ √n), df = n − 1. Welch two-sample: t = (x̄₁ − x̄₂) ÷ √(s₁²/n₁ + s₂²/n₂), df = (s₁²/n₁ + s₂²/n₂)² ÷ [(s₁²/n₁)²/(n₁ − 1) + (s₂²/n₂)²/(n₂ − 1)]. The p-value comes from Student's t distribution with df degrees of freedom.

Calculator credits

Calculator developmentJulia Edwards

Editorial supervision

Expert reviewSaeedM.Phil Statistics, Data Scientist

Published byThe Calculatorz

Last updated

Read how we research, test, review and correct our calculators in our editorial policy.

Frequently asked questions

When should I use a t-test?

To compare a mean with a value, or two means, when the population standard deviation is unknown and the data are roughly normal or the samples are reasonably large (about 30 or more each).

What is Welch's t-test?

A two-sample t-test that does not assume the two groups have equal variances. It is the safer default and is nearly as powerful as the pooled test when variances are equal.

What does the p-value mean?

The probability of a result at least as extreme as yours if the null hypothesis (no difference) were true. A small p-value is evidence against the null hypothesis; it is not the probability that the hypothesis is true.

One-sided or two-sided?

Use two-sided unless, before seeing the data, you had a clear reason to test only one direction.

Can I use this for paired data?

For before-and-after measurements on the same subjects, calculate each pair's difference and run a one-sample test of the differences against 0.

Is statistical significance the same as importance?

No. With large samples, tiny differences can be significant. Look at the size of the difference and its confidence interval.

References & methodology sources

These sources support the calculator’s formula, definitions, thresholds, units or result interpretation.

  1. Croarkin, C., & Tobias, P. (Eds.). (2012). NIST/SEMATECH e-handbook of statistical methods. National Institute of Standards and Technology. View source
  2. Illowsky, B., & Dean, S. (2023). Introductory statistics 2e. OpenStax. View source
  3. Casella, G., & Berger, R. L. (2002). Statistical inference (2nd ed.). Duxbury. View source
  4. Welch, B. L. (1947). The generalization of 'Student's' problem when several different population variances are involved. Biometrika, 34(1–2), 28–35. View source