T-Test Calculator
Test cases replayed : 3 of 3 match · Methodology · No outside source listed
Enter the mean, standard deviation and size of two independent samples to test whether their means differ.
Result
Two-tailed p-value
Difference of means (group 1 − group 2)
- Standard error of the difference
- t statistic
- Degrees of freedom
Estimate for planning only, not tax, legal, financial or medical advice. This calculator uses the method explained on this page.
This browser did not allow copying. The sentence is in the box below, already selected: copy it with your keyboard or the menu.
How to use this calculator
Fill in the fields in this order; each step takes you to its field.
- Group 1 mean: enter a number.
- Group 1 standard deviation: enter 0 or more.
- Group 1 sample size: enter 2 or more.
- Group 2 mean: enter a number.
- Group 2 standard deviation: enter 0 or more.
- Group 2 sample size: enter 2 or more.
- Variance assumption: choose Unequal variances (Welch's t-test) or Equal variances (Student's pooled t-test).
- Read the result: Two-tailed p-value; the panel also shows Difference of means (group 1 − group 2), Standard error of the difference, t statistic and Degrees of freedom.
How this calculator works
t = (x̄₁ − x̄₂) ÷ SE. Welch's test uses SE = √(s₁²/n₁ + s₂²/n₂) and the Welch–Satterthwaite degrees of freedom ν = (s₁²/n₁ + s₂²/n₂)² ÷ [(s₁²/n₁)²/(n₁ − 1) + (s₂²/n₂)²/(n₂ − 1)].
Student's pooled test uses the pooled variance s_p² = [(n₁ − 1)s₁² + (n₂ − 1)s₂²] ÷ (n₁ + n₂ − 2), SE = √(s_p²(1/n₁ + 1/n₂)) and ν = n₁ + n₂ − 2.
The two-tailed p-value is P(|T| ≥ |t|) for Student's t distribution with ν degrees of freedom, computed with the regularized incomplete beta function.
Worked example
| Group 1 mean | 24.5 |
|---|---|
| Group 1 standard deviation | 4.2 |
| Group 1 sample size | 30 |
| Group 2 mean | 22.1 |
| Group 2 standard deviation | 5.1 |
| Group 2 sample size | 28 |
| Variance assumption | Unequal variances (Welch's t-test) |
| Difference of means (group 1 − group 2) | 2.4 |
|---|---|
| Standard error of the difference | 1.2316 |
| t statistic | 1.9486 |
| Degrees of freedom | 52.438 |
| Two-tailed p-value | 0.0567 |
Frequently asked questions
Should I use Welch's or Student's t-test?
Welch's test is the safer default: it stays valid when the two groups have different variances, and gives almost the same answer as the pooled test when they do not.
What does the t-test assume?
Independent observations and, for small samples, roughly normal data in each group. With larger samples the test is robust to moderate non-normality.