T-Test Calculator
A sample of 25 measurements with a mean of 5, a standard deviation of 2, and a comparison value of 4 produces a t statistic of 2.5, 24 degrees of freedom, and a two-tailed p-value of about 0.0197. This t-test calculator works from summary statistics, so you do not need the raw data set. You enter the means, standard deviations, and sample sizes that a study or spreadsheet already reports, and the tool returns the t statistic, the degrees of freedom, and the two-tailed p-value. It supports three common designs: a one-sample test against a fixed value, a two-sample pooled test that assumes equal variances, and a Welch test that does not. A t-test asks whether an observed difference in means is larger than what sampling noise alone would tend to produce. A small p-value means a difference that size would be uncommon if the true means were equal. This page reports results at the common 0.05 threshold, and it states the outcome in plain words without claiming more than the number supports. Use it to check homework, confirm a spreadsheet formula, or preview a result before you run full statistics software.
Quick answer
A t-test compares means using the t-distribution, which has heavier tails than the normal curve and adjusts for small samples.
t statistic
2.5
Degrees of freedom
24
Two-tailed p-value
0.019654
Standard error
0.4
Significance at 0.05: The p-value is below 0.05, which suggests the difference is statistically significant at the 0.05 level.
Two-tailed p-values come from the Student t-distribution using the regularized incomplete beta function: p = betai(df/2, 0.5, df/(df + t*t)).
What this tells you
- •A t-test compares means using the t-distribution, which has heavier tails than the normal curve and adjusts for small samples.
- •The t statistic measures the gap between means in units of standard error, so a larger absolute t points to a clearer difference.
- •Degrees of freedom set the exact shape of the t-distribution and depend on the sample sizes.
- •The two-tailed p-value is the chance of seeing a t at least this extreme in either direction when the true means are equal.
- •A one-sample test compares one group mean to a known or target value, while two-sample tests compare two group means.
- •The pooled test assumes both groups share the same variance, and the Welch test relaxes that assumption.
How to Use
- 11. Pick the test mode: one-sample, two-sample pooled, or Welch, depending on your study design.
- 22. For a one-sample test, enter the sample mean, the sample standard deviation, the sample size, and the population or target mean you are testing against.
- 33. For a two-sample test, enter the mean, standard deviation, and size for each of the two groups.
- 44. Read the t statistic and degrees of freedom, then compare the two-tailed p-value against your chosen alpha, usually 0.05.
- 55. Use the plain-language note as a summary, and remember that a result below 0.05 suggests significance rather than proving a real-world effect.
How It Works
Formula
one-sample: t = (mean - mu) / (sd / sqrt(n)), df = n - 1
pooled: t = (mean1 - mean2) / sqrt(sp^2 x (1/n1 + 1/n2)), df = n1 + n2 - 2
Welch: t = (mean1 - mean2) / sqrt(sd1^2/n1 + sd2^2/n2)
two-tailed p = betai(df/2, 0.5, df / (df + t^2))Every mode divides a difference in means by a standard error, which is the expected spread of that difference from sampling. In the one-sample case the standard error is sd / sqrt(n). In the pooled case the two groups are assumed to share one variance sp^2, computed as ((n1 - 1) x sd1^2 + (n2 - 1) x sd2^2) / (n1 + n2 - 2). The Welch case keeps the two variances separate and uses the Welch-Satterthwaite formula for its degrees of freedom, df = (v1 + v2)^2 / (v1^2/(n1 - 1) + v2^2/(n2 - 1)), where v1 = sd1^2/n1 and v2 = sd2^2/n2, so the result is usually not a whole number. Once t and df are known, the two-tailed p-value comes from the regularized incomplete beta function betai. For example, t = 2.5 with df = 24 gives betai(12, 0.5, 24 / 30.25) = 0.0197.
Calculation note: values are processed in the order shown above, using the current input units.
Worked Examples
One-sample test of a mean against 4
The standard error is 2 / sqrt(25) = 0.4, so t = (5 - 4) / 0.4 = 2.5 with df = 24. The two-tailed p-value of 0.0197 is below 0.05, which suggests the sample mean differs from 4 at the 0.05 level.
One-sample test that is not significant
Here t = (48 - 50) / (6 / sqrt(16)) = -2 / 1.5 = -1.333 with df = 15. The p-value of 0.2023 is above 0.05, so the data do not show a difference from 50 at the 0.05 level. A negative t just means the sample mean sits below the target.
Two-sample pooled test with equal sizes
With equal variances the pooled variance is 4, so the standard error is sqrt(4 x (1/10 + 1/10)) = sqrt(0.8). Then t = (10 - 8) / sqrt(0.8) = 2.236 with df = 18. The p-value of 0.0382 is below 0.05.
Two-sample pooled test with unequal sizes
The pooled variance is ((11 x 25) + (14 x 36)) / 25 = 31.16, giving a standard error of about 2.162. Then t = (82 - 78) / 2.162 = 1.850 with df = 25. The p-value of 0.0761 is above 0.05, so this gap is not significant at the 0.05 level even though the means differ by 4 points.
Welch test with unequal variances
The variances of the two means are v1 = 9/15 = 0.6 and v2 = 4/20 = 0.2, so the standard error is sqrt(0.8) and t = (10 - 7) / sqrt(0.8) = 3.354. The Welch-Satterthwaite formula gives df = 23.01, and the p-value of 0.0027 is well below 0.05.
Two-Tailed Critical t Values at Alpha 0.05
Reject the null hypothesis when the absolute t statistic is larger than the critical value for its degrees of freedom.
| Degrees of freedom | Critical t (two-tailed, 0.05) |
|---|---|
| 1 | 12.706 |
| 2 | 4.303 |
| 3 | 3.182 |
| 4 | 2.776 |
| 5 | 2.571 |
| 10 | 2.228 |
| 15 | 2.131 |
| 20 | 2.086 |
| 24 | 2.064 |
| 30 | 2.042 |
| 60 | 2.000 |
| 120 | 1.980 |
| Infinite (z) | 1.960 |
As degrees of freedom grow, the critical t value approaches the normal critical value of 1.960. Larger samples make the t-distribution look almost normal.
How to read a t-test result
Start with the t statistic. Its sign shows which mean is larger, and its size shows how many standard errors separate the two means. A t near zero means the means are close relative to their spread, while a large absolute t means they are far apart.
Next look at the degrees of freedom and the two-tailed p-value together. The degrees of freedom set the exact critical value from the table above, and the p-value turns your t into a probability. When the p-value is below your alpha, often 0.05, the difference is called statistically significant at that level.
Finally, judge the practical meaning on your own. Statistical significance and real-world importance are separate questions. A tiny difference can be significant with a very large sample, and a large difference can miss significance with a very small one, so report the actual means and spread alongside the p-value.
Common mistakes
- Using the standard deviation of the mean instead of the standard deviation of the data. Enter the sample standard deviation, and the tool divides by sqrt(n) to find the standard error.
- Choosing the pooled test when the two groups have very different variances. The Welch test is the safer default when spreads or sample sizes differ.
- Reading a small p-value as proof of a large or important effect. A p-value speaks to statistical significance, not to the size or practical value of the difference.
- Comparing the two-tailed p-value to 0.05 after planning a one-tailed test. Decide the direction and the alpha before you look at the data.
- Entering sample sizes below 2. A t-test needs at least two observations per group so that variance and degrees of freedom are defined.
Embed this calculator on your site
Drop this single line where you want the calculator to appear. It is responsive, mobile-friendly, resizes automatically, and is free to use with attribution.
<script src="https://calctide.com/embed.js" data-tool="t-test-calculator" async></script>Preview the embed at /embed/t-test-calculator/.