T-Test Calculator
A t-test calculator checks whether a difference between means is larger than chance would explain. Two classes scored a mean of 80.2 (n = 10) and 71.67 (n = 9). Welch’s two-sample t-test gives t = 2.986 with df = 16.43 and a two-tailed p-value of 0.0085. That is below α = 0.05, so the difference is statistically significant.
| n | Mean | SD | SE | |
|---|---|---|---|---|
| Group 1 | 10 | 80.2 | 7.1305 | 2.2549 |
| Group 2 | 9 | 71.6667 | 5.2678 | 1.7559 |
Show steps
- Hypotheses. H₀: μ₁ − μ₂ = 0. H₁: μ₁ − μ₂ ≠ 0 (two-tailed, α = 0.05).
- Group 1: n₁ = 10, x̄₁ = 802 / 10 = 80.2, s₁ = √(Σ(x − x̄₁)² / (n₁ − 1)) = √(457.6 / 9) = 7.1305.
- Group 2: n₂ = 9, x̄₂ = 645 / 9 = 71.6667, s₂ = √(222 / 8) = 5.2678.
- Welch standard error: SE = √(s₁²/n₁ + s₂²/n₂) = √(5.0844 + 3.0833) = 2.8579.
- Welch–Satterthwaite df = (s₁²/n₁ + s₂²/n₂)² / [ (s₁²/n₁)²/(n₁ − 1) + (s₂²/n₂)²/(n₂ − 1) ] = 16.4286.
- t = (x̄₁ − x̄₂ − 0) / SE = (80.2 − 71.6667) / 2.8579 = 2.9858.
- Two-tailed p-value = 2 × P(T ≥ |2.9858|) with df = 16.43 = 2 × 0.0043 = 0.0085.
- Decision: p = 0.0085 ≤ 0.05, so reject H₀. Check with the critical value: reject when t is beyond ±2.1154; t = 2.9858 is in the rejection region.
- 95% confidence interval: μ₁ − μ₂ ± t* × SE, with t* = 2.1154 (the two-sided critical value for df = 16.43). 8.5333 ± 2.1154 × 2.8579 = [2.4876, 14.5791].
- Effect size: Cohen’s d = (x̄₁ − x̄₂) / sₚ = 8.5333 / 6.3227 (pooled SD) = 1.35. By Cohen’s rough guide (0.2 small, 0.5 medium, 0.8 large) this is large.
How to use the t-test calculator
- Pick the test: Two-sample for two separate groups, Paired for the same subjects measured twice, One-sample to compare one mean with a known value μ₀.
- Choose Raw data and paste your values (commas, spaces or a spreadsheet column all work), or choose Summary and type the mean, standard deviation and n.
- Pick the alternative hypothesis: two-tailed (≠) unless you decided on a direction before you collected the data.
- For two samples, keep Welch (the default) unless you have a good reason to assume equal variances.
The result shows t, the degrees of freedom, the p-value, a confidence interval for the mean or difference, Cohen’s d, a table of group statistics, a dot plot of your data, the t curve with the p-value area shaded, and every step of the working.
Which t-test should you use?
| Your data | Test | Degrees of freedom |
|---|---|---|
| One sample compared with a target or claimed mean | One-sample t-test | n − 1 |
| Two independent groups (different people in each) | Welch two-sample t-test | Welch–Satterthwaite formula (often a decimal) |
| Two independent groups with equal variances | Pooled (Student) t-test | n₁ + n₂ − 2 |
| Same subjects twice, or matched pairs | Paired t-test | number of pairs − 1 |
The quick test for pairing: if each value in one column belongs with one specific value in the other column (the same student before and after, the left and right eye of one patient), the data are paired. If you could shuffle one column without losing information, they are independent.
T-test formulas
Every t statistic has the same shape: t = (estimate − value under H₀) / standard error. Here x̄ is a sample mean, s a sample standard deviation and n a sample size.
- One-sample: t = (x̄ − μ₀) / (s / √n), df = n − 1.
- Welch two-sample: t = (x̄₁ − x̄₂) / √(s₁²/n₁ + s₂²/n₂), with df = (s₁²/n₁ + s₂²/n₂)² / [(s₁²/n₁)²/(n₁ − 1) + (s₂²/n₂)²/(n₂ − 1)].
- Pooled two-sample: sₚ² = [(n₁ − 1)s₁² + (n₂ − 1)s₂²] / (n₁ + n₂ − 2), t = (x̄₁ − x̄₂) / (sₚ√(1/n₁ + 1/n₂)), df = n₁ + n₂ − 2.
- Paired: find each difference d = A − B, then t = d̄ / (s(d) / √n), df = n − 1. It is a one-sample t-test on the differences.
The confidence interval uses the same pieces: estimate ± t* × SE, where t* is the two-sided critical value for your df. Cohen’s d expresses the difference in standard deviations: (x̄₁ − x̄₂) / sₚ for two samples, d̄ / s(d) for pairs and (x̄ − μ₀) / s for one sample.
Worked examples
Two-sample (Welch): test scores in two classes
Class 1: 82, 75, 91, 68, 77, 85, 79, 88, 73, 84. Class 2: 71, 69, 78, 64, 80, 70, 75, 66, 72. The means are 80.2 and 71.67, the SDs 7.131 and 5.268.
- s₁²/n₁ = 50.844 / 10 = 5.084 and s₂²/n₂ = 27.75 / 9 = 3.083, so SE = √(5.084 + 3.083) = 2.858.
- t = (80.2 − 71.67) / 2.858 = 8.533 / 2.858 = 2.986.
- Welch df = 8.168² / (5.084²/9 + 3.083²/8) = 16.43.
- Two-tailed p = 0.0085, the 95% confidence interval for μ₁ − μ₂ is 2.49 to 14.58 points, and Cohen’s d = 1.35 (large).
The pooled test on the same data gives t = 2.937 with df = 17 and p = 0.0092. The answers are close because the two SDs are similar.
Paired: a skill score before and after practice
Eight students scored 68, 74, 71, 80, 77, 65, 72, 79 after practice and 64, 70, 72, 74, 73, 62, 69, 75 before. The differences are 4, 4, −1, 6, 4, 3, 3, 4, with mean d̄ = 3.375 and s(d) = 1.996.
SE = 1.996 / √8 = 0.7055, so t = 3.375 / 0.7055 = 4.784 with df = 7. The two-tailed p-value is 0.0020, the 95% confidence interval for the mean gain is 1.71 to 5.04 points, and d = 3.375 / 1.996 = 1.69.
One-sample: do the bags hold 12 ounces?
Ten bags weigh 12.1, 11.4, 13.0, 12.6, 11.9, 12.8, 12.2, 11.7, 12.5 and 13.1 oz. The mean is 12.33 and s = 0.5658, so SE = 0.5658 / √10 = 0.1789 and t = (12.33 − 12) / 0.1789 = 1.844 with df = 9.
The two-tailed p-value is 0.098, which is above 0.05, so the data do not show that the mean differs from 12 oz. The 95% confidence interval, 11.93 to 12.73, contains 12, which tells the same story.
Critical values of t
Reject H₀ when |t| is at least the critical value. The two-tailed α = 0.05 column is the t* used for 95% confidence intervals.
| df | One-tailed 0.05 | Two-tailed 0.05 | Two-tailed 0.01 |
|---|---|---|---|
| 1 | 6.314 | 12.706 | 63.657 |
| 5 | 2.015 | 2.571 | 4.032 |
| 10 | 1.812 | 2.228 | 3.169 |
| 15 | 1.753 | 2.131 | 2.947 |
| 20 | 1.725 | 2.086 | 2.845 |
| 30 | 1.697 | 2.042 | 2.750 |
| 60 | 1.671 | 2.000 | 2.660 |
| 120 | 1.658 | 1.980 | 2.617 |
Assumptions and common mistakes
- Independence. Each observation must be independent of the others. Measuring the same person twice in a “two-sample” test breaks this; use the paired test.
- Roughly normal data. With small samples, check the dot plot for strong skew or outliers. With about 30 or more per group the t-test is fairly robust. For badly skewed small samples, a rank test such as Mann–Whitney or Wilcoxon is safer.
- Using the population SD formula. Use s with n − 1 in the denominator. Many spreadsheets offer both; STDEV.S is the right one.
- Entering the standard error as the SD. If a paper reports mean ± SE, convert with SD = SE × √n before using the Summary mode.
- Choosing the tail after seeing the data. Halving a two-tailed p-value after the fact inflates false positives.
- Reading p as the effect size. A tiny p-value can come from a trivial difference in a huge sample. Report the confidence interval and Cohen’s d as well.
The two-sample formulas above follow the NIST/SEMATECH e-Handbook of Statistical Methods, section 1.3.5.3, Two-Sample t-Test for Equal Means. Every number on this page was re-checked with SciPy’s t-test functions.
T-test practice quiz: 10 questions
Test yourself with 10 multiple-choice questions. Choose an answer and press Submit to see if you are right and why. Your score appears at the end.
Each 'after' value belongs to one 'before' value from the same patient, so the data are paired.
2.228 is the two-tailed 0.05 critical value for df = 10, so p = 2 × 0.025 = 0.05.
d = difference / pooled SD = 6/12 = 0.5, a medium effect by Cohen’s guide.
Welch’s test adjusts the standard error and df for unequal variances and loses little when they are equal.
0 lies inside the 95% interval, so the difference is not significant at the 0.05 level.
Quiz complete
Frequently asked questions
What does a t-test tell you?
It tells you whether the difference between a sample mean and a value, or between two means, is large compared with the random variation you would expect. A small p-value (usually 0.05 or less) means the difference would be unusual if there were no real difference.
Should I use Welch’s or Student’s t-test?
Welch’s test is the safer default for two independent groups because it does not assume equal variances. When the variances really are equal it loses almost nothing; when they are not, the pooled test can give misleading p-values, especially with unequal group sizes.
What is a good t-value?
There is no single cutoff, because it depends on the degrees of freedom. With large samples, |t| above about 2 is significant at 0.05 (two-tailed). With df = 5 you need |t| of at least 2.571.
How do I calculate a t-test in Excel?
Use =T.TEST(range1, range2, tails, type), where tails is 1 or 2 and type is 1 for paired, 2 for equal variances or 3 for Welch. It returns only the p-value; this calculator also gives t, df, the confidence interval and the effect size.
What is the difference between a t-test and a z-test?
A z-test uses a known population standard deviation; a t-test estimates it from the sample, which adds uncertainty, so it uses the t distribution with heavier tails. As the sample grows, the two give nearly the same answer.
Related calculators
- P-value calculator: turn any t, z, chi-square or F statistic into a p-value
- Confidence interval calculator: intervals for one or two means
- Z-score calculator: standardize a value against a known mean and SD
- Standard deviation calculator: the s that goes into every t-test
- Sample size calculator: plan how many observations you need
Related to This Article
More math articles
- Multiplying Fractions for 5th Grade: Numerators and Denominators
- 7th Grade Math Worksheets for Missouri (MAP): 95 Free Printable PDFs
- CPA REG Blueprint and Tax-Law Timing: Check Before You Study (2027 Prep)
- Ratios, Rates, and Proportions in Science
- What is a Good PSAT Score?
- How to Factor Polynomials?
- The Best Grade 7 Math Book for South Carolina Students
- The Best Grade 4 Math Book for Ohio Students
- ISEE Math- Test Day Tips
- 5th Grade M-STEP Math Worksheets: FREE & Printable






What people say about "T-Test Calculator: One-Sample, Two-Sample & Paired"?
No one replied yet.