t-Test Calculator

Quick answer

The t-test calculator runs one-sample, paired and two-sample (Student or Welch) t-tests from summary statistics or raw data, or straight from a t-score and degrees of freedom. It gives t, df, the p-value, critical values, the decision, a confidence interval and Cohen's d.

p-value
0.05
t statistic
2.0652
Degrees of freedom
29
Decision
Reject H₀ at α = 0.05 – p = 0.0479 ≤ 0.05 and t = 2.0652 lies in the rejection region.
Critical t
±2.0452
Rejection region
t ≤ −2.0452 or t ≥ 2.0452
Estimate (mean, mean difference or x̄₁ − x̄₂)
52.3
Standard error
1.1137
Confidence interval for the estimate (two-sided, 1 − α)
95% CI: 50.0222 to 54.5778
Cohen's d
0.377
t distribution with rejection region

A t-test compares means when the population standard deviation is unknown. The one-sample version asks whether a mean differs from a target value, such as a specification or a historical average. The paired version handles two measurements on the same subjects, such as before and after or left and right, by testing whether the mean of the differences is zero. The two-sample version compares the means of two independent groups.

In every case the statistic is an estimated difference divided by its standard error, and the p-value comes from Student’s t distribution. For two independent samples you can assume equal variances (the pooled, or Student, test) or not (Welch’s test). Welch’s test is the safer default: it loses almost nothing when variances are equal and stays accurate when they are not.

t-tests assume independent observations and roughly normal data, or, for larger samples, a roughly normal sampling distribution of the mean, which the central limit theorem provides. For small, skewed samples consider the Wilcoxon signed-rank or Mann–Whitney U test. Report the confidence interval and an effect size such as Cohen’s d, not only the p-value.

How to use the t-Test Calculator

  1. Test and data
  2. Sample mean (x̄)
  3. Sample standard deviation (s)
  4. Sample size (n)
  5. Sample 1 (or “before” values)
  6. Sample 2 (or “after” values, same order)
  7. Mean of group 1
  8. SD of group 1
  9. Size of group 1
  10. Mean of group 2
  11. SD of group 2
  12. Size of group 2
  13. Variances
  14. t-score
  15. Degrees of freedom
  16. Hypothesised value μ₀ (mean, mean difference or difference of means)
  17. Alternative hypothesis H₁
  18. Significance level (α)

Everything is calculated in your browser, so results appear instantly and nothing you type is sent to a server.

How it works

Choose the test and how you will enter the data, then set the hypothesised value, the alternative hypothesis and α. The calculator computes the estimate, its standard error, t and the degrees of freedom, and reads the p-value and critical values from the t distribution.

Worked example

One-sample. A sample of 30 has x̄ = 52.3 and s = 6.1. Testing H₀: μ = 50: SE = 6.1 ÷ √30 = 1.114, t = 2.3 ÷ 1.114 = 2.065 with 29 df. The two-tailed p-value is 0.048, just below 0.05, so we reject H₀; the 95% CI is 50.02 to 54.58.

Paired. Ten people’s cholesterol before (200, 174, 198, …) and after (191, 170, 177, …) a diet: the mean difference is 16.7 with SD 9.78, so t = 16.7 ÷ (9.78 ÷ √10) = 5.40 with 9 df and p = 0.0004.

How to report a t-test

Give the test, the statistic with its degrees of freedom, the p-value, the estimate with its confidence interval and an effect size, for example: “Scores were higher than 50 (M = 52.3, SD = 6.1), t(29) = 2.07, p = 0.048, 95% CI [50.0, 54.6], d = 0.38.”

Formula

One-sample: t = (x̄ − μ₀) ÷ (s/√n), df = n − 1 · Paired: same on the differences dᵢ = xᵢ − yᵢ · Pooled: t = (x̄₁ − x̄₂ − Δ₀) ÷ (s_p √(1/n₁ + 1/n₂)), df = n₁ + n₂ − 2 · Welch: t = (x̄₁ − x̄₂ − Δ₀) ÷ √(s₁²/n₁ + s₂²/n₂)

Worked example

Inputs: Test and data: One-sample – summary statistics; Sample mean (x̄): 52.3; Sample standard deviation (s): 6.1; Sample size (n): 30; Hypothesised value μ₀ (mean, mean difference or difference of means): 50; Alternative hypothesis H₁: Two-tailed (H₁: not equal); Significance level (α): 0.05.
Results: p-value = 0.05; t statistic = 2.0652; Degrees of freedom = 29; Decision = Reject H₀ at α = 0.05 – p = 0.0479 ≤ 0.05 and t = 2.0652 lies in the rejection region.; Critical t = ±2.0452; Rejection region = t ≤ −2.0452 or t ≥ 2.0452.

Key terms

Paired t-test
A one-sample t-test on the differences between matched observations.
Pooled standard deviation
√(((n₁ − 1)s₁² + (n₂ − 1)s₂²) ÷ (n₁ + n₂ − 2)), used by Student's two-sample test.
Welch's t-test
A two-sample t-test that does not assume equal variances and uses Welch–Satterthwaite degrees of freedom.
Cohen's d
Difference in means divided by a standard deviation; 0.2, 0.5 and 0.8 are often called small, medium and large.

Frequently asked questions

Does a small p-value prove my hypothesis?

No. It says the data would be unlikely if H₀ were true. It does not give the probability that H₁ is true, nor the size of the effect.

Which t-test should I use?

One-sample to compare a mean with a fixed value; paired when each value in one list is matched to one in the other; two-sample for independent groups.

Should I use Welch's or Student's two-sample test?

Welch's, unless you have a strong reason to believe the variances are equal. It is the default in R and loses very little power.

What is the critical t value for 29 degrees of freedom?

±2.045 for a two-tailed test at α = 0.05 and 1.699 for a one-tailed test.

What are the assumptions of a t-test?

Independent observations, a continuous outcome and approximately normal data (or differences, for a paired test). Larger samples relax the normality requirement.

Why does the paired test give a much smaller p-value?

Pairing removes the between-subject variation. In the default paired data the differences have SD 9.8, far less than the SD of each list.

Can I run a t-test with a sample of 5?

Yes, but power is low and the normality assumption matters more. Check a plot of the data and consider a non-parametric test.

Sources

  1. NIST/SEMATECH e-Handbook of Statistical Methods
  2. OpenStax: Introductory Statistics 2e
  3. Penn State STAT 500: Applied Statistics

Cite this calculator

Speedy Calculator. (2026). t-Test Calculator. Speedy Calculator. https://speedycalculator.com/calculators/statistics/t-test/