T test calculator with the p-value shaded
A t test checks whether a mean, or the difference between two means, is far enough from what you expected to be more than chance. It turns the difference into a t statistic, for one sample t = (x̄ − μ₀) ÷ (s ÷ √n), and compares it with a t distribution to get a p-value. If p is below your significance level, usually 0.05, you reject the null hypothesis. This t test calculator is part of our Hypothesis Test Calculator: it runs one-sample, two-sample and paired t tests and ends with a conclusion in words.
Hypothesis Test Calculator
Run z, t and chi-squared tests and read off the p-value
How to run a t test in the calculator
- Open the Hypothesis Test Calculator. It opens on a z test, so under Which test choose One-sample t test, Two-sample t test or Paired t test.
- Choose the tail (Two-tailed, Lower tail or Upper tail) and the significance level (10%, 5%, 1% or 0.1%).
- Under Values, enter Summary values (means, standard deviations and sizes) or switch to Raw data and type or paste your data. For a one-sample test, also give the Mean to test μ₀.
- For a two-sample test, turn on Assume equal variances (pooled) only if you have reason to. Otherwise it runs Welch's test.
- Read the hypotheses, the test statistic, the p-value, the critical values, the degrees of freedom and the conclusion. The distribution shades the p-value and the critical region.
Which t test?
| Test | Use it when | t statistic | Degrees of freedom |
|---|---|---|---|
| One-sample | Comparing one mean with a known value | (x̄ − μ₀) ÷ (s ÷ √n) | n − 1 |
| Two-sample (Welch) | Comparing two independent groups | (x̄₁ − x̄₂) ÷ √(s₁²/n₁ + s₂²/n₂) | Welch's formula |
| Paired | Two measurements on the same subjects | d̄ ÷ (s_d ÷ √n), on the differences | n − 1 |
Use a t test, not a z test, when the population standard deviation is unknown and you estimate it from the sample. t tests assume the data, or the differences, come from a roughly normal population, which matters most for small samples.
Worked examples you can check in the calculator
Example 1: one-sample t test
A maker claims its batteries last 10 hours. A sample of 16 lasts a mean of 9.6 hours with s = 1.2. Is that evidence the claim is wrong, at the 5% level, two-tailed? H₀: μ = 10 and H₁: μ ≠ 10.
With 15 degrees of freedom the p-value is 0.202, and the critical values are ±2.131. Since p > 0.05, do not reject H₀: the sample doesn't give enough evidence against the 10-hour claim.
Example 2: two-sample t test
Group A (n = 20) scores a mean of 72 with s = 8, and group B (n = 22) a mean of 66 with s = 10. Is there a difference, at 5%, two-tailed?
Welch's formula gives about 39.4 degrees of freedom, and the p-value is 0.037. Since p < 0.05, reject H₀: there is evidence the group means differ.
Example 3: paired t test
Five students take a test before and after a revision session. Their improvements are 2, 4, 1, 3 and 5 marks. Work on the differences: d̄ = 3 and s_d = 1.581, so:
With 4 degrees of freedom, p = 0.013 two-tailed, below 0.05, so there is evidence the session changed the scores. Choose Paired t test, Raw data, and type the differences. A paired test is right here because the same students were measured twice.
Try one
One-tailed or two-tailed?
Choose before you look at the data. A two-tailed test asks whether the mean is different in either direction. A one-tailed test asks about one direction only, such as whether batteries last less than claimed. For the same t, the one-tailed p-value is half the two-tailed one: in example 1 it would be 0.101, still not significant.
Common mistakes
- Using a two-sample test on paired data. If the same subjects are measured twice, use the paired test.
- Dividing by s instead of s ÷ √n. The t statistic uses the standard error of the mean.
- Saying H₀ is proven true. A large p-value only means not enough evidence against it.
- Choosing the tail after seeing the data. Decide the direction first.
- Pooling variances by habit. Welch's test is safer unless the variances are known to be equal.
Common questions
What does a t test tell you?
What is the formula for a one-sample t test?
When should I use a paired t test?
What is the difference between a t test and a z test?
Can I paste raw data?
Revision cards
Read the front, say your answer, then flip to check.
Where to go next
- Solve it
Hypothesis Test Calculator
Run z, t and chi-squared tests and read off the p-value
Open the tool - Test it
AP Statistics
A new exam-style paper every day, with instant marking and a mark scheme
Start today's paper