T-Test Calculator
Run a Student's t-test or Welch's t-test from raw data or summary statistics. You get the exact p-value, the confidence interval of the difference, a named effect size, an APA sentence and R and Python code that reproduces every figure.
- Welch by default, with Student's result beside it
- Independent, paired and one-sample tests
- Checked against R and SciPy on published examples
Sources checked on November 21, 2026. Results computed by the site's engine and tested against R and SciPy.
Welch's t-test does not assume equal variances
At the 5% level, there is evidence of a difference between the Automatic and Manual means.
| Welch (default) | Student (equal variances) | |
|---|---|---|
| t | −3.7671 | −4.1061 |
| df | 18.33 | 30 |
| p (two-sided) | 0.0014 | 2.850 × 10−4 |
| 95% CI | −11.2802 to −3.2097 | −10.8484 to −3.6415 |
| Critical t | 2.0982 | 2.0423 |
| Group | n | Mean | SD |
|---|---|---|---|
| Automatic | 19 | 17.1474 | 3.8340 |
| Manual | 13 | 24.3923 | 6.1665 |
Effect sizes: Cohen's ds −1.4779 (pooled SD 4.9020), Hedges' g −1.4407, d* (average variance) −1.4110, Glass's delta −1.1749 using Manual as the control group.
Assumptions check
- Automatic: skewness 0.02; no values beyond 1.5 IQR from the quartiles.
- Manual: skewness 0.06; no values beyond 1.5 IQR from the quartiles.
- Ratio of the larger SD to the smaller: 1.61. Welch's test does not need equal SDs; Student's test assumes them.
APA Welch: t(18.33) = −3.77, p = .001, g = −1.44, 95% CI [−11.28, −3.21]
Reproduce this result in R or Python
R
x <- c(21.4, 18.7, 18.1, 14.3, 24.4, 22.8, 19.2, 17.8, 16.4, 17.3, 15.2, 10.4, 10.4, 14.7, 21.5, 15.5, 15.2, 13.3, 19.2)
y <- c(21, 21, 22.8, 32.4, 30.4, 33.9, 27.3, 26, 30.4, 15.8, 19.7, 15, 21.4)
t.test(x, y, alternative = "two.sided", conf.level = 0.95) # Welch (R default)
t.test(x, y, alternative = "two.sided", conf.level = 0.95, var.equal = TRUE) # StudentPython (SciPy)
from scipy.stats import ttest_ind
x = [21.4, 18.7, 18.1, 14.3, 24.4, 22.8, 19.2, 17.8, 16.4, 17.3, 15.2, 10.4, 10.4, 14.7, 21.5, 15.5, 15.2, 13.3, 19.2]
y = [21, 21, 22.8, 32.4, 30.4, 33.9, 27.3, 26, 30.4, 15.8, 19.7, 15, 21.4]
w = ttest_ind(x, y, equal_var=False, alternative="two-sided") # Welch
print(w, w.df, w.confidence_interval(0.95))
s = ttest_ind(x, y, equal_var=True, alternative="two-sided") # Student
print(s, s.df, s.confidence_interval(0.95))What a t-test tells you
A t-test asks whether a difference between means is larger than you would expect from sampling noise alone. It divides the difference by its standard error, so the t statistic counts how many standard errors apart the means are. The p-value is the chance of a t at least that extreme if the true difference were zero.
There are three common versions. The independent samples test compares two separate groups, such as cars with automatic and manual gearboxes. The paired test compares two measurements on the same people or items, such as a score before and after a course. The one-sample test compares one mean with a fixed value, such as a target or a label claim. Pick the version that matches how the data were collected; which t-test to use walks through it.
Worked example: fuel economy and gearbox type
The calculator opens with the fuel economy data from R's built-in mtcars dataset (Henderson and Velleman, 1981): miles per gallon for 19 cars with automatic gearboxes and 13 with manual ones. This is the example in R's own help page for t.test, so you can check our numbers against R's reference output.
The automatic cars average 17.15 mpg (SD 3.83) and the manual cars 24.39 mpg (SD 6.17). The difference is −7.24 mpg. Welch's test gives t = −3.77 with 18.33 degrees of freedom and a two-sided p of 0.0014. The 95% confidence interval for the difference runs from −11.28 to −3.21 mpg, so manual cars in this sample did between about 3.2 and 11.3 more miles per gallon.
Student's test on the same data gives t = −4.11 on 30 df and p = 2.850 × 10−4. Both lead to the same conclusion here, but they are not the same test: the SDs differ by a factor of 1.61, and only Welch's test allows for that. In APA style: t(18.33) = −3.77, p = .001.
How to read the result
- t and df. The sign of t shows which group is higher: negative means group 1 has the lower mean. Welch's df is usually a decimal; it is never rounded before the p-value is computed.
- p-value. Small p means the data would be unusual if there were no difference. It is not the chance that the null hypothesis is true, and a p above 0.05 does not show that the means are equal.
- Confidence interval. The range of differences that fit the data at your chosen level. An interval that excludes zero matches a two-sided p below 1 minus the confidence level.
- Effect size. Hedges' g is the difference in pooled standard deviations, with a small-sample correction. In the example g = −1.44, a large difference by Cohen's rough conventions.
- Assumptions check. With raw data you also see skewness and any values far outside the quartiles. They are flagged, never removed.
Why Welch is the default
Student's original test assumes the two groups have the same variance. When they do not, and the group sizes differ, its p-value can be far too small or too large. Welch's test drops that assumption and loses very little when the variances are in fact equal. That is why R's t.test uses Welch unless you ask otherwise, and why Delacre, Lakens and Leys (2017) recommend it as the default. We still show Student's result in the same panel, because many courses and journals ask for it. The Welch vs Student guide shows the two side by side on several datasets.
Raw data or summary statistics
Paste raw values when you have them. You get the exact descriptive statistics, skewness and outlier flags, and code that runs on your actual data. Use summary statistics (mean, SD and n per group) when you only have a published table. Results from rounded summaries can differ slightly from the raw-data answer: NIST's one-sample example prints t = 2611.284 from unrounded data, while the rounded summary it prints gives 2611.262. If you have a standard error instead of an SD, multiply it by the square root of n first.
Common mistakes this calculator guards against
- Using a paired test on independent groups, or the reverse. The paired test uses the SD of the differences, which can make the answer very different.
- Halving a two-sided p when the effect went the wrong way. A one-sided p in the opposite direction from your hypothesis is close to 1, not tiny; see one-tailed vs two-tailed tests.
- Choosing between Welch and Student with a variance test first. That two-step habit distorts error rates; decide in advance and report Welch.
- Reporting p = 0.000. A p-value is never zero; we print very small values in scientific notation and APA's p < .001.
- Calling a non-significant result "no difference". It is an absence of evidence at that level, and the confidence interval shows how large a difference is still plausible.
Every calculator
Guides
Checked against R and SciPy
Every calculation is tested against 30 published and constructed reference cases and 8,100 stored SciPy values before the site is built. See every test case, who runs this site, report a correction or read our privacy notes.
Sources
- R reference example output, stats-Ex.Rout.save checked November 21, 2026
- R source code, stats package, t.test.R checked November 21, 2026
- Delacre M., Lakens D., Leys C. (2017) Why psychologists should by default use Welch's t-test instead of Student's t-test. International Review of Social Psychology 30(1):92-101 checked November 21, 2026