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 ≈ 3.02 with 5 df, p ≈ 0.029 — significant at the 5% level.

Reading the result

  • "Critical t value" gives the exact threshold |t| needed to cross — comparing the t statistic directly against it is a good sanity check on the p-value-based conclusion.
  • For the two-sample test, Welch's formula (the default here) typically gives a non-integer degrees of freedom, unlike the whole-number df a classic pooled-variance test would show for the same data — that difference is expected, not an error.

Assumptions and limitations

  • The one-sample test assumes the underlying population is approximately normal, which the notes say matters most for small samples — a 6-observation sample like the example is exactly the case where that assumption's validity matters most.

Common mistakes

  • Treating statistical significance as evidence of a large or important effect — the p-value says nothing about effect size, so a "significant" result from a large sample can still reflect a trivially small real difference.

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