How to Calculate Two Sample T Test
Two Sample T Test Calculator: solve two sample t test problems online for free — formula, worked examples, and how-to guide included.
The Formula
t = (x̄1 − x̄2) / √(sp²(1/n1 + 1/n2))The two sample t test formula uses the mathematical relationship: t = (x̄1 − x̄2) / √(sp²(1/n1 + 1/n2)). Each variable in the formula represents a measurable quantity that affects the final result.
What Each Variable Means
Every value in the two sample t test formula, what it measures, and the value used in the worked example on this page:
| Variable | Type | Example value |
|---|---|---|
| Group 1 Mean | Input (you provide) | 52 |
| Group 1 Standard Deviation | Input (you provide) | 8 |
| Group 1 Size (n1) | Input (you provide) | 25 |
| Group 2 Mean | Input (you provide) | 48 |
| Group 2 Standard Deviation | Input (you provide) | 9 |
| Group 2 Size (n2) | Input (you provide) | 25 |
| Mean Difference | Result (calculated) | — |
| Pooled Variance | Result (calculated) | — |
| Pooled Standard Deviation | Result (calculated) | — |
| Standard Error | Result (calculated) | — |
| t Statistic | Result (calculated) | — |
| Degrees of Freedom | Result (calculated) | — |
Step-by-Step Method
- 1Write down the values you know: Group 1 Mean, Group 1 Standard Deviation, Group 1 Size (n1), Group 2 Mean, Group 2 Standard Deviation, Group 2 Size (n2).
- 2Substitute your known values into the formula: t = (x̄1 − x̄2) / √(sp²(1/n1 + 1/n2)).
- 3Work through the arithmetic in the standard order of operations — parentheses first, then exponents, then multiplication and division, then addition and subtraction.
- 4Check that your result carries the correct unit and falls in a reasonable range for the problem.
- 5Verify your answer with the interactive Two Sample T Test Calculator — it solves the same formula instantly.
Worked Example
Take a concrete case: group 1 mean = 30, with the other inputs at the typical values from the variables table above. Substituting into the formula gives mean difference = -18.0000, pooled variance = 72.5000, pooled standard deviation = 8.5147, standard error = 2.4083, t statistic = -7.4741, degrees of freedom = 48. These numbers are solved by the same engine that powers the Two Sample T Test calculator, so you can reproduce them exactly by entering the same inputs there.
| Group 1 Mean | Mean Difference | Pooled Variance | Pooled Standard Deviation | Standard Error | t Statistic | Degrees of Freedom |
|---|---|---|---|---|---|---|
| 10 | -38.0000 | 72.5000 | 8.5147 | 2.4083 | -15.7786 | 48 |
| 30 | -18.0000 | 72.5000 | 8.5147 | 2.4083 | -7.4741 | 48 |
| 40 | -8.0000 | 72.5000 | 8.5147 | 2.4083 | -3.3218 | 48 |
| 50 | 2.0000 | 72.5000 | 8.5147 | 2.4083 | 0.8305 | 48 |
| 70 | 22.0000 | 72.5000 | 8.5147 | 2.4083 | 9.1350 | 48 |
| 80 | 32.0000 | 72.5000 | 8.5147 | 2.4083 | 13.2873 | 48 |
| 100 | 52.0000 | 72.5000 | 8.5147 | 2.4083 | 21.5918 | 48 |
| 200 | 152.0000 | 72.5000 | 8.5147 | 2.4083 | 63.1146 | 48 |
How each result changes as group 1 mean changes, holding the other inputs constant.
Practice Problems
1. Two class sections: Given Group 1 Mean 52, Group 1 Standard Deviation 8, Group 1 Size (n1) 25, Group 2 Mean 48, Group 2 Standard Deviation 9, and 1 more more inputs, what does it come out to?
Answer: The calculator returns Mean Difference 4.0000, Pooled Variance 72.5000, Pooled Standard Deviation 8.5147, Standard Error 2.4083, t Statistic 1.6609, and 1 more more results for Group 1 Mean 52, Group 1 Standard Deviation 8, Group 1 Size (n1) 25, Group 2 Mean 48, Group 2 Standard Deviation 9, and 1 more more inputs.
2. You enter Group 1 Mean 37.5, Group 1 Standard Deviation 5, Group 1 Size (n1) 20, Group 2 Mean 27, Group 2 Standard Deviation 6, and 1 more more inputs — what does the calculator return?
Answer: With Group 1 Mean 37.5, Group 1 Standard Deviation 5, Group 1 Size (n1) 20, Group 2 Mean 27, Group 2 Standard Deviation 6, and 1 more more inputs, the results are Mean Difference 10.5000, Pooled Variance 30.5000, Pooled Standard Deviation 5.5227, Standard Error 1.7464, t Statistic 6.0123, and 1 more more results.
Frequently Asked Questions
What is the formula for two sample t test?
The formula is: t = (x̄1 − x̄2) / √(sp²(1/n1 + 1/n2)). Two Sample T Test Calculator: solve two sample t test problems online for free — formula, worked examples, and how-to guide included.
What values do I need to calculate two sample t test?
You need group 1 mean, group 1 standard deviation, group 1 size (n1), group 2 mean, group 2 standard deviation, group 2 size (n2). The calculator produces mean difference, pooled variance, pooled standard deviation, standard error, t statistic, degrees of freedom from those inputs.
What is the two sample t test when group 1 mean is 30?
With group 1 mean = 30, the result is mean difference = -18.0000, pooled variance = 72.5000, pooled standard deviation = 8.5147, standard error = 2.4083, t statistic = -7.4741, degrees of freedom = 48. This is worked through in full in the example on this page.
Related Topics
Use the Interactive Calculator
Skip the manual math — get instant results with our free Two Sample T Test calculator.
