How to use the two-sample t-test calculator
Compare the means of two groups. Enter mean 1, sd 1, size 1, mean 2, sd 2, size 2 in the fields above; the difference, standard error, t statistic, approx. two-tailed p-value are computed instantly and plotted on the chart so you can see how the answer changes.
Formula
Variables
- m1 — Mean 1
- s1 — SD 1
- n1 — Size 1
- m2 — Mean 2
- s2 — SD 2
- n2 — Size 2
Worked example
With mean 1 = 24, sd 1 = 5, size 1 = 30, mean 2 = 21, sd 2 = 6, size 2 = 32, the calculator gives difference ≈ 3; standard error ≈ 1.399405; t statistic ≈ 2.143769; approx. two-tailed p-value ≈ 0.0320513.
Frequently asked questions
What is the formula for the two-sample t-test calculation?
Difference = m1-m2. Standard error = √(s1 × s1 / n1+s2 × s2 / n2). t statistic = [Difference] / [Standard error]. Approx. two-tailed p-value = 2 × (1-ncdf(abs([t statistic]))). Here m1 is mean 1, s1 is sd 1, n1 is size 1, m2 is mean 2, s2 is sd 2, n2 is size 2.
What inputs do I need for the two-sample t-test (welch) calculator?
You need mean 1, sd 1, size 1, mean 2, sd 2, size 2. Each field is pre-filled with a typical example so you can see how the result responds as you edit the numbers.
How do I use this calculator?
Type values into the input fields. Results and the chart update instantly. Use Reset to restore the example values, Copy results to paste them elsewhere, or Share to copy a link that preserves your inputs.
Is the result exact?
Calculations use standard formulas and double-precision arithmetic, then display about seven significant figures. Real-world measurements carry uncertainty, so treat results as estimates unless your inputs are exact.