Skip to content

T-Test Calculator

Paste your data or type in summary statistics and get t, the degrees of freedom, and exact p-values for every alternative — with the confidence interval, Cohen's d, and each step of the working shown. Welch's test is the default for two independent groups; Student's pooled test and the paired test are one click away. Free, no sign-up.

Test
Input
Variances

0 values

0 values

Direction is sample 1 minus sample 2 (or the mean minus μ₀ in a one-sample test).

Enter at least two numbers in each sample to run the test.

How to Use the T-Test Calculator

  1. 1. Choose the test. One-sample compares a mean with a fixed value μ₀, independent samples compares two separate groups, and paired samples compares two measurements taken on the same people or on matched pairs.
  2. 2. Enter your data. Paste raw numbers separated by commas, spaces, or new lines, or switch to summary statistics and type each group's mean, standard deviation, and n. Paired data go in two lists in the same order — the first value in each list belongs to the same person.
  3. 3. Set the hypothesis. Keep the alternative two-sided unless you predicted a direction before collecting the data, then pick α and the confidence level (.05 and 95% by default).
  4. 4. Read and report. You get t, df, the p-value for each alternative, the mean difference with its confidence interval, Cohen's d, the working, and an APA-style line that copies into Word or Google Docs with its italics intact.

Which T-Test Fits Your Design?

Your dataTestExample
One group, compared with a known or hypothesised valueOne-sample t-testMean nightly sleep of 40 students against the recommended 8 hours
Two unrelated groupsIndependent-samples t-test (Welch by default)Exam scores under two teaching methods
The same people measured twice, or matched pairsPaired t-testAnxiety ratings before and after a workshop

Three or more groups call for a one-way ANOVA, not a series of t-tests. With small, clearly skewed samples, use the Mann-Whitney U test or the Wilcoxon signed-rank test.

The Formulas Behind Each Test

  • One-sample: t = (x̄ − μ₀) / (s / √n), with df = n − 1. The standard error s / √n shrinks as the sample grows, which is why the same difference becomes significant in a larger study.
  • Welch (independent): t = (x̄₁ − x̄₂) / √(s₁²/n₁ + s₂²/n₂). The degrees of freedom come from the Welch–Satterthwaite equation, df = (s₁²/n₁ + s₂²/n₂)² / [(s₁²/n₁)²/(n₁ − 1) + (s₂²/n₂)²/(n₂ − 1)], which is usually not a whole number.
  • Student (independent, pooled): t = (x̄₁ − x̄₂) / (sp √(1/n₁ + 1/n₂)), where sp² = [(n₁ − 1)s₁² + (n₂ − 1)s₂²] / (n₁ + n₂ − 2) and df = n₁ + n₂ − 2.
  • Paired: compute each difference d = first − second, then t = d̄ / (sd / √n) with df = n − 1. It is a one-sample test on the differences against zero.
  • Effect size: Cohen's d divides the mean difference by a standard deviation — the pooled SD for Student's test, √((s₁² + s₂²)/2) for Welch's, and the SD of the differences for a paired test (often written dz).

Worked Example: Two Teaching Methods

Select Independent samples and click Try an example to load these exam scores. Group 1 (new method) has n₁ = 10, x̄₁ = 80.40, s₁ = 7.26; group 2 (old method) has n₂ = 9, x̄₂ = 73.78, s₂ = 5.83. Welch's test runs like this:

Welch's t-test, step by step

SE = √(s₁²/n₁ + s₂²/n₂) = √(5.2711 + 3.7716) = 3.0071

t = (80.40 − 73.78) / 3.0071 = 6.6222 / 3.0071 = 2.2022

df = 9.0427² / (5.2711²/9 + 3.7716²/8) = 16.81

two-sided p = .0419; 95% CI = 6.6222 ± 2.1117 × 3.0071 = [0.27, 12.97]

d = 6.6222 / √((7.2602² + 5.8262²)/2) = 6.6222 / 6.5824 = 1.01

In APA style: the new method produced higher scores (M = 80.40, SD = 7.26) than the old one (M = 73.78, SD = 5.83), t(16.81) = 2.20, p = .042, d = 1.01, 95% CI [0.27, 12.97]. Student's pooled test on the same data gives t(17) = 2.18, p = .044 — nearly identical, because the two SDs and group sizes are similar. The interval is wide: with nine and ten students, the true advantage could be anything from a fraction of a point to thirteen points.

Welch or Student?

Use Welch's test unless you have a specific reason not to. Student's test assumes both groups share one population variance; when they do not — especially with unequal group sizes — its false-positive rate drifts away from α. Welch's test drops that assumption and gives up almost no power when the variances happen to be equal, which is why R's t.test uses it by default (Delacre, Lakens, & Leys, 2017). Testing for equal variances first and then choosing a test is not a safe shortcut: the two-step procedure distorts error rates more than using Welch from the start.

Common Mistakes

  • Running an independent test on paired data. Before-and-after scores from the same people are correlated; the paired test removes the person-to-person variation and is usually far more sensitive.
  • Choosing a one-tailed test after seeing the data. A one-sided p is half the two-sided p when the effect goes the predicted way, so deciding the direction afterwards doubles your real false-positive rate.
  • Reading p > .05 as "no difference". A non-significant result means the data cannot rule out zero. Look at the confidence interval to see how large the difference could plausibly be.
  • Running many t-tests across three or more groups. Every test spends its own α, so the chance of at least one false positive climbs; use an ANOVA followed by post hoc comparisons.
  • Writing p = .000. The software rounded; a p-value is never zero. APA style writes p < .001.

Frequently Asked Questions

Should I use Welch's or Student's t-test?
Welch's, in most cases. It does not assume equal variances, keeps its false-positive rate close to α when the variances or group sizes differ, and gives practically the same answer as Student's test when they do not. Choose Student's pooled test when your course or journal asks for it — the calculator offers both.
How do I calculate the degrees of freedom for Welch's t-test?
Use the Welch–Satterthwaite equation: df = (s₁²/n₁ + s₂²/n₂)² divided by [(s₁²/n₁)²/(n₁ − 1) + (s₂²/n₂)²/(n₂ − 1)]. The answer is usually fractional, and that is correct — do not round it before finding the p-value. APA style reports it to two decimals, as in t(16.81) = 2.20.
What is the difference between a paired and an independent t-test?
A paired test compares two measurements that belong together — the same participant before and after, or matched pairs — by testing whether the mean difference is zero. An independent test compares two separate groups of people. If every value in one list has a partner in the other, use the paired test; treating paired data as independent throws away the pairing and most of the power.
Does a t-test need normally distributed data?
It assumes the sample mean (or the mean difference) is approximately normally distributed. With roughly 30 or more per group the central limit theorem usually covers this unless the data are extremely skewed; with small samples, look at a histogram or a normal Q–Q plot. For small samples that are clearly non-normal, the Mann-Whitney U or Wilcoxon signed-rank test is the safer choice.
How do I report a t-test in APA style?
Give the descriptive statistics, then t(df) = value, p = value, and an effect size with a confidence interval — for example, t(16.81) = 2.20, p = .042, d = 1.01, 95% CI [0.27, 12.97]. Italicise t, p, d, M and SD; give t and d to two decimals and p to three without a leading zero, and write p < .001 for anything smaller. Say what the interval is for — here, the mean difference.
When should I use a one-tailed t-test?
Only when you predicted the direction before seeing the data and a result in the opposite direction would mean the same to you as no difference. One-tailed tests are rare in published research and reviewers often question them, so state the prediction and its basis. The calculator shows the p-value for all three alternatives so you can see how they relate.

Related Tools

More in Statistics Calculators

See all Statistics Calculators