T-Test Calculator

Compare means with t-tests. Choose one-sample, paired, or independent samples. Get results with formulas, effect sizes, and APA-formatted reports.

Choose your test type:

Data entry:

T
DF
P
COHEN'S D
95% CI
Enter data to see results.
T distribution with observed test statistic
Fig. 1 — Observed t statistic (red dashed) on the t distribution.

§1 The Formula

§2 Worked Example: One-Sample Test

A researcher measures reaction time (ms) for 11 participants. Does the sample mean differ from the hypothesized mean of 500 ms?

Reaction Time (ms)
487
509
521
495
518
512
503
491
528
504
515

Step 1: Calculate sample statistics. x̄ = 509.36 ms, s = 12.71 ms, n = 11, μ₀ = 500 ms.

Step 2: Compute the t-statistic. t = (509.36 − 500) / (12.71 / √11) = 9.36 / 3.83 = 2.44

Step 3: Find degrees of freedom. df = 11 − 1 = 10

Step 4: Look up the p-value (two-tailed). For t(10) = 2.44, p ≈ .0349. This is less than α = .05, so the result is statistically significant.

Step 5: Report in APA format. t(10) = 2.44, p = .035, d = 0.74, 95% CI [1.19, 17.53]

§3 Assumptions & When This Test Is Wrong

Independence

Observations must be independent (no repeated measures or clustering). For paired designs, the differences must be independent. If violated, consider multilevel modeling.

Approximate Normality

The sampling distribution of the mean should be approximately normal. With large samples (n > 30), the Central Limit Theorem makes this less critical. With small samples, a Q–Q plot or Shapiro–Wilk test can check normality. Minor departures are usually tolerable; severe skewness or outliers warrant a nonparametric alternative.

Equal Variances (Student's t only)

Student's t-test assumes the two populations have equal variances. Welch's t-test relaxes this. If you use Student's and variances are unequal, your p-value may be biased. Always prefer Welch's t unless you have prior certainty of equal variances.

Nonparametric Alternatives

If assumptions are badly violated:

  • One-sample: Wilcoxon signed-rank test (tests the median, not the mean)
  • Paired: Wilcoxon signed-rank test on the differences
  • Independent: Mann–Whitney U test (compares rank distributions)

§4 How to Report a t-Test in APA Style

Use this format in your methods, results, and tables:

t(df) = t-value, p = p-value, d = effect size, 95% CI [lower, upper]

Example (one-sample): A one-sample t-test revealed that mean reaction time (M = 509.36, SD = 12.71) was significantly greater than the hypothesized mean of 500 ms, t(10) = 2.44, p = .035, d = 0.74.

Example (independent samples): The control group (M = 42.5, SD = 8.3) showed significantly lower scores than the treatment group (M = 48.1, SD = 7.2), t(18) = 1.89, p = .074, d = 0.70, 95% CI [−0.31, 2.51].

Formatting notes:

  • Always include df in parentheses.
  • Report p-values with a leading zero (p = .045) unless p < .001 (then write p < .001).
  • Cohen's d, t, and p are italicized.
  • Report d to 2 decimal places, t and p to 2–3 places.
  • Confidence intervals are always two-sided, even for one-tailed tests.

§5 Which t-Test Do I Need?

Use this table to choose the right test. See Which Statistical Test Should I Use? for a more comprehensive guide.

Research Question Test
Does my sample mean differ from a known population value? One-sample t-test
Do two related groups (before/after, paired measurements) differ? Paired t-test
Do two independent groups differ? Welch's t-test (or Student's if variances are known equal)
Do three or more groups differ? One-way ANOVA (or Kruskal–Wallis if non-normal)

§6 FAQ

What is the difference between Student's and Welch's t-test?

Student's t-test assumes both groups have equal population variances and pools them to estimate a common variance. Welch's t-test makes no assumption about equal variances and uses separate variance estimates for each group. Welch's is generally safer because it controls Type I error better when variances are unequal. R's default t.test() function uses Welch's.

Should I test for equal variances before choosing Student's vs Welch's?

Modern practice says no. Tests like Levene's test can reject equal variances due to non-normality rather than true variance inequality, and they add an extra hypothesis test. Instead, use Welch's by default; it works well regardless and is robust to unequal variances.

What is Cohen's d and what counts as "small" or "large"?

Cohen's d is a standardized effect size. Cohen's own conventions (d ≈ 0.2 small, 0.5 medium, 0.8 large) are rough rules of thumb and are not universal. Always interpret d in your field's context. A d of 0.3 might be large in medicine but small in psychology. Report d alongside p for a complete picture.

What should I do if my data is not normal?

The t-test is fairly robust to moderate non-normality, especially with larger samples (n > 30). Check a histogram or Q–Q plot. Minor skewness is usually fine. If you have severe outliers or skewness, consider a nonparametric alternative (Wilcoxon or Mann–Whitney U). You can also report both t-test and nonparametric results to be safe.

Why does a small p-value not prove the null hypothesis is false?

A p-value is the probability of observing data at least as extreme as yours if the null hypothesis were true. A small p (e.g., .03) just says that such data would be unlikely under H₀. It does not prove H₀ is false; it provides evidence against it. The interpretation depends on context, study design, and effect size.

How do I report a paired t-test with unequal sample sizes?

Paired designs require equal sample sizes by definition—one observation per pair. If your two columns have different lengths, something is wrong with the pairing. Check your data. If you actually have two independent samples, use the independent-samples t-test instead.

§7 Sources

§8 Related Tools

Explore more statistical calculators and guides: