T-Test Calculator (One & Two Sample)
Compare two independent group means with Welch's t-test from each group's mean, standard deviation and sample size: get t, Welch degrees of freedom,
T-Test Calculator (One & Two Sample)
Calculator
Adjust values & calculateEnter your values below. Every result is computed in your browser โ no data is sent to any server.
Formula: t = (xฬโ - xฬโ) / โ(sโยฒ/nโ + sโยฒ/nโ) | Welch's df โ (sโยฒ/nโ + sโยฒ/nโ)ยฒ / [(sโยฒ/nโ)ยฒ/(nโ-1) + (sโยฒ/nโ)ยฒ/(nโ-1)]
Worked example โ t = 2.57, p โ 0.013 โ Significant
Formula
t = (xฬโ - xฬโ) / โ(sโยฒ/nโ + sโยฒ/nโ) | Welch's df โ (sโยฒ/nโ + sโยฒ/nโ)ยฒ / [(sโยฒ/nโ)ยฒ/(nโ-1) + (sโยฒ/nโ)ยฒ/(nโ-1)]
Welch's t-test compares the means of two independent groups without assuming equal variances. The t-statistic is the difference between the sample means divided by the standard error of that difference, sqrt(sโยฒ/nโ + sโยฒ/nโ). The degrees of freedom are approximated with the Welch-Satterthwaite formula, and the two-tailed p-value is read from the t distribution with that df. Cohen's d = (xฬโ - xฬโ) / pooled SD reports the effect size.
Worked Examples
Example 1: Two group comparison
Problem:Group 1: mean=25, SD=5, n=30. Group 2: mean=22, SD=4, n=30
Solution:t = 3/(โ(25/30+16/30)) = 3/1.169 = 2.566. dfโ55.3. pโ0.013
Result:t = 2.57, p โ 0.013 โ Significant
Example 2: Unequal sample sizes and variances
Problem:Treated plants: mean height 12.0 cm, SD 3.0, n = 15. Control plants: mean 10.5 cm, SD 6.0, n = 40. Is the difference significant at ฮฑ = 0.05?
Solution:SE = โ(3ยฒ/15 + 6ยฒ/40) = โ(0.60 + 0.90) = โ1.50 = 1.225 t = (12.0 - 10.5) / 1.225 = 1.225 Welch df = 1.50ยฒ / [0.60ยฒ/14 + 0.90ยฒ/39] = 2.25 / (0.0257 + 0.0208) = 48.4 Two-tailed p โ 0.23 Pooled SD = โ[(14 x 9 + 39 x 36) / 53] = โ28.9 = 5.37, so Cohen's d = 1.5 / 5.37 = 0.28 (small)
Result:t = 1.22, df โ 48.4, p โ 0.23 โ Not significant; d = 0.28
Frequently Asked Questions
When should I use Welch's t-test?
Always. Welch's t-test does not assume equal variances and performs well even when variances are equal. It's the default recommendation over Student's t-test in modern statistics.
What is a p-value?
The probability of observing a test statistic as extreme as the calculated value, assuming the null hypothesis (no difference) is true. p < 0.05 conventionally means the result is statistically significant.
What is Cohen's d and how do I interpret effect size?
Cohen's d measures the practical magnitude of the difference between two groups in standard deviation units. Guidelines: d = 0.2 is small (noticeable to careful observers), d = 0.5 is medium (noticeable to most people), d = 0.8 is large (obvious difference). A result can be statistically significant with a tiny effect size when sample sizes are large, so always report both p-value and Cohen's d to fully characterize your findings.
When should I use a paired t-test instead of an independent samples t-test?
Use a paired t-test when the same subjects are measured twice (before/after), matched pairs are compared, or measurements are otherwise dependent. Pairing controls for individual variability and gives a more powerful test than independent samples when within-subject correlation is high. An independent samples t-test (like T-Test Calculator (One & Two Sample)) is appropriate when two distinct, unrelated groups are compared.
Why are the degrees of freedom fractional instead of a whole number?
Welch's test does not pool the two variances, so the test statistic no longer follows an exact t distribution. The Welch-Satterthwaite formula supplies an effective degrees of freedom that matches the true sampling distribution as closely as possible, and that value is usually not an integer. It always falls between the smaller group's n - 1 and the pooled n1 + n2 - 2, and it collapses exactly to n1 + n2 - 2 when both the variances and the sample sizes are equal.
What is the difference between a one-tailed and a two-tailed t-test?
A two-tailed test asks whether the two means differ in either direction and splits the rejection region across both tails, which is what T-Test Calculator (One & Two Sample) reports. A one-tailed test commits in advance to a single direction, such as treatment greater than control, and puts the whole rejection region in one tail. Because the t distribution is symmetric, the one-tailed p-value is half the two-tailed value when the observed difference runs the predicted way. Choosing the direction after seeing the data invalidates the test.
Why does the calculator ask for the standard deviation rather than the standard error?
The standard deviation describes how spread out the individual observations are, while the standard error of the mean equals that standard deviation divided by the square root of n and describes how precisely the mean itself is estimated. The formula already divides by n internally, so entering a standard error where a standard deviation belongs divides by n a second time. That shrinks the denominator, inflates t and can turn noise into an apparently significant result.
What does a non-significant result actually tell me about the two groups?
It means the data did not provide enough evidence to reject the hypothesis of equal means, which is not the same as demonstrating that the means are equal. Statistical power depends on the true effect size, the within-group variability and the sample sizes, so a small or noisy study can easily miss a real difference. Report the confidence interval for the mean difference alongside the p-value: a wide interval spanning zero signals an uninformative study rather than an established null.
When should I use a Mann-Whitney U test instead of a t-test?
Switch when the underlying distributions are strongly skewed or heavy-tailed and the samples are too small for the central limit theorem to rescue the sampling distribution of the mean, when the outcome is ordinal such as a behavioural score, or when a few extreme outliers dominate the mean. Mann-Whitney ranks the pooled observations and tests whether values from one group tend to exceed the other, so it answers a question about distributional dominance rather than about means.
How should I adjust when comparing more than two treatment groups?
Running every pairwise t-test inflates the family-wise error rate. Three groups need three comparisons, and at alpha = 0.05 the chance of at least one false positive rises to about 14 percent rather than 5 percent. Either run a one-way ANOVA first and follow a significant result with a post-hoc procedure such as Tukey's HSD, or apply a Bonferroni correction that divides alpha by the number of comparisons, giving roughly 0.0167 for three tests.
References
Background & Theory
History
Reviewed for accuracy by Daniel Agrici, Founder & Lead Developer ยท Editorial policy
Related Calculators
๐งฎPower Sample Size Calculator
Calculate power sample size with inputs, formulas, and instant results.
๐งฎSample Size Calculator
Calculate sample size with inputs, formulas, and instant results.
๐งฎAlpaca Gestation Calculator
Calculate alpaca gestation with inputs, formulas, and instant results.
๐งฎCat Pregnancy Calculator โ Due Date & Gestation
Calculate cat pregnancy with inputs, formulas, and instant results.
๐งฎCow Gestation Calculator
Calculate cow gestation with inputs, formulas, and instant results.
๐งฎDog Pregnancy Calculator: Due Date by Breed
Calculate dog pregnancy with inputs, formulas, and instant results.
๐งฎGoat Gestation Calculator
Calculate goat gestation with inputs, formulas, and instant results.
๐งฎGuinea Pig Pregnancy Calculator โ Due Date
Calculate guinea pig pregnancy with inputs, formulas, and instant results.