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
| Input | Unit | Required | Notes |
|---|---|---|---|
| Test type | one of 2 options | Yes | — |
| Sample data | text | Yes | Separate values with commas, spaces or new lines. |
| Hypothesised mean (μ₀) | number | In some modes | Shown Test type is One sample (against a known mean). |
| Second sample | text | In some modes | Separate values with commas, spaces or new lines. Shown Test type is Two independent samples. |
| Significance level | one of 3 options | Yes | — |
How to use it
- Choose Test type and Significance level.
- Enter Sample data.
- Fill in the remaining inputs the form shows for your choice.
- 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.