T-Test Calculator

Run a one-sample or two-sample t-test and get the p-value.

What the T-Test Calculator does

A t-test asks whether an observed difference in means is larger than sampling noise would plausibly produce. The p-value is the probability of seeing a difference at least this large if there were truly no effect.

Formula

  • One sample: t = (x̄ − μ₀) ÷ (s ÷ √n)
  • Welch's two sample: t = (x̄₁ − x̄₂) ÷ √(s₁²/n₁ + s₂²/n₂)
  • p-value from the t distribution with the appropriate degrees of freedom

Inputs explained

InputUnitRequiredNotes
Test typeone of 2 optionsYes
Sample datatextYesSeparate values with commas, spaces or new lines.
Hypothesised mean (μ₀)numberIn some modesShown Test type is One sample (against a known mean).
Second sampletextIn some modesSeparate values with commas, spaces or new lines. Shown Test type is Two independent samples.
Significance levelone of 3 optionsYes

How to use it

  1. Choose Test type and Significance level.
  2. Enter Sample data.
  3. Fill in the remaining inputs the form shows for your choice.
  4. Select Calculate.

Worked example

Testing whether a sample of 23, 25, 28, 22, 26, 24 differs from a hypothesised mean of 22.

Type
One sample
Data
23, 25, 28, 22, 26, 24
Hypothesised mean
22

Mean 24.67, t ≈ 2.95 with 5 df, p ≈ 0.032 — significant at the 5% level.

Frequently asked questions

What does the p-value actually mean?

The probability of observing a difference at least this extreme if the null hypothesis were true. It is not the probability that the null hypothesis is correct.

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

Two-tailed unless you have a strong directional hypothesis stated before seeing the data. Switching to one-tailed afterwards to gain significance is not legitimate.

Related calculators