Two-Sample t-Test Calculator

Written by Thierno Sadou Diallo, formula verified per our methodology • Last checked on 9/9/2026

The two independent-samples t-test (equal variances) is calculated with t = (mean1 − mean2) ÷ SE, where SE combines both variances into a common pooled variance. For two samples with means 25 and 22 (n=20 and n=25), the t-statistic is about 2.24, with 43 degrees of freedom.

Explanation

The two independent-samples t-test lets you compare the means of two distinct groups (for example, a test group and a control group) to assess whether their observed difference is large enough not to be due to sampling chance alone. It answers a different question than our Pearson correlation calculator, which measures how two variables move together rather than whether two groups differ on average. The method used here, called pooled variance, assumes the two source populations have genuinely comparable variance: the two sample variances, of the kind our sample variance and standard deviation calculator computes for a single group, are here combined into a single common pooled variance (sp²), which is then used to calculate the standard error of the difference between the two means. The result, the t-statistic, measures how many standard errors separate the two observed means: the larger its absolute value, the more pronounced the difference between the two groups relative to the internal variability of each sample. This calculator deliberately stops at the t-statistic and degrees of freedom (n1+n2−2): converting this result into a significance probability (p-value) requires comparing it to a Student's t-distribution table for this exact number of degrees of freedom, a step generally done with statistical software rather than by hand.

Example: means of 25 (n=20, SD 5) and 22 (n=25, SD 4)

Inputs

Sample 1: mean 25, SD 5, n=20. Sample 2: mean 22, SD 4, n=25.

Calculation

Pooled variance = ((19×25) + (24×16)) ÷ 43 = (475+384) ÷ 43 ≈ 19.977. SE = √19.977 × √(1/20+1/25) ≈ 4.469 × 0.3 ≈ 1.341. t = (25−22) ÷ 1.341 ≈ 2.24. Degrees of freedom = 20+25−2 = 43.

Result

The t-statistic is about 2.24, with 43 degrees of freedom.

Frequently asked questions

Why does this test assume the two variances are equal?

Because the pooled variance method combines the two sample variances into a single estimate, which only makes statistical sense if the two source populations genuinely have comparable variability. If this assumption is doubtful (for example, if one standard deviation is more than twice the other), a variant of the t-test suited to unequal variances (Welch's test) is generally preferred, but its calculation is more complex and falls outside the scope of this calculator.

Does this calculator directly give a statistical significance conclusion?

No, deliberately: this calculator gives the t-statistic and degrees of freedom, but no p-value or automatic significance conclusion. Interpreting this result requires comparing the obtained t-statistic to a critical value of Student's t-distribution for this number of degrees of freedom and the chosen significance threshold (generally 5%), a step that requires a statistical table or dedicated software rather than a simple formula.

How is this different from checking whether two variables are correlated?

Correlation (see our Pearson correlation calculator) measures whether two variables tend to rise and fall together across the same set of observations. This t-test instead compares the average value of one variable between two separate groups, with no assumption that the groups are linked observation by observation — a different question with a different formula.

Related resources

Similar calculators