T-Test Calculator

One & Two Sample Paired & Welch Cohen’s d Free · No Signup

Free online t-test calculator for one-sample, two-sample, paired, and Welch t-tests. Compute t-statistic, p-value, degrees of freedom, critical value, confidence interval, Cohen’s d effect size, interactive t-distribution chart, and Python scipy export.

T-Test
Raw data values

Result

📊

Enter data and click Calculate

Perform one-sample, two-sample, paired, or Welch t-tests with full results.

T-Distribution Visualization

Python Compiler

What Is a T-Test?

A t-test is a statistical hypothesis test used to determine whether there is a significant difference between the means of one or two groups. It uses the t-distribution, which accounts for small sample sizes and unknown population standard deviations.

0 t α/2 α/2
🎯

Hypothesis Testing

Compare a sample mean to a known value or compare two group means to determine if the difference is statistically significant.

Statistical Significance

The p-value tells you the probability of observing your data under the null hypothesis. Small p-values suggest significant results.

📏

Effect Size

Cohen’s d measures the practical significance of the difference. A result can be statistically significant but have a small effect.

Types of T-Tests

One-Sample T-Test:  t = (x̄ − μ₀) / (s / √n)
Compares a sample mean to a known or hypothesized population mean μ₀. Uses n−1 degrees of freedom.
Two-Sample T-Test (Pooled):  t = (x̄1 − x̄2) / (sp × √(1/n1 + 1/n2))
Compares means of two independent groups assuming equal variances. sp is the pooled standard deviation with n1+n2−2 degrees of freedom.
Paired T-Test:  t = d̄ / (sd / √n)
Tests whether the mean difference d̄ of paired observations differs from zero. Uses n−1 degrees of freedom where n is the number of pairs.
Welch’s T-Test:  t = (x̄1 − x̄2) / √(s1²/n1 + s2²/n2)
Compares means of two independent groups without assuming equal variances. Uses Welch-Satterthwaite approximation for degrees of freedom.

Choosing the Right T-Test

ScenarioTest TypeWhen to Use
Compare sample mean to a known valueOne-SampleTesting if a batch mean equals the specification value
Compare two independent groups with similar variancesTwo-SampleTreatment vs control, males vs females
Before and after measurements on same subjectsPairedPre-test vs post-test, left eye vs right eye
Two independent groups with unequal or unknown variancesWelchDefault choice when unsure about equal variances

Tip: When in doubt, use the Welch t-test. It is robust to unequal variances and performs well even when variances are actually equal.

Interpreting Results

✅ Significant Result

When p < α, reject the null hypothesis. The observed difference is unlikely due to random chance alone. Report the t-statistic, df, and p-value.

❌ Not Significant

When p ≥ α, fail to reject the null hypothesis. There is insufficient evidence of a significant difference. This does not prove the groups are equal.

📏 Effect Size (Cohen’s d)

Small: d ≈ 0.2, Medium: d ≈ 0.5, Large: d ≈ 0.8. A significant p-value with tiny d may lack practical importance.

↔️ Confidence Interval

The CI for the mean difference shows the range of plausible values. If it excludes zero, the result is significant at that confidence level.

Assumptions & When to Use Alternatives

  • 1. Normality: Data should be approximately normally distributed, or sample size should be large enough (n ≥ 30) for the Central Limit Theorem to apply.
  • 2. Independence: Observations must be independent of each other (except in paired tests where pairs are dependent but differences are independent).
  • 3. Equal Variances: The two-sample t-test assumes equal variances. Use Welch’s t-test if this assumption is violated.
  • 4. Continuous Data: T-tests are designed for continuous (interval or ratio) data, not ordinal or categorical data.

Non-parametric alternatives: If your data violates normality with small samples, consider the Mann-Whitney U test (for independent samples) or Wilcoxon signed-rank test (for paired samples). For comparing more than two groups, use ANOVA instead.

Frequently Asked Questions

Use one-sample to compare a mean to a known value. Use independent two-sample when groups are unrelated with similar variances. Use paired for before/after or matched data. Use Welch when group variances differ or you are unsure about equal variances.
The p-value is the probability of observing data as extreme as yours if the null hypothesis is true. A small p-value below alpha suggests the data is unlikely under the null, so you reject it.
Cohen’s d measures effect size, or practical significance. A statistically significant result with tiny d may not be meaningful. Small d is about 0.2, medium about 0.5, and large about 0.8.
Data should be approximately normal or sample size large enough for CLT. Observations must be independent. Two-sample tests assume equal variances unless using Welch. Paired tests assume the differences are normally distributed.
Use two-tailed when you want to detect a difference in either direction. Use one-tailed only when you have a strong prior hypothesis about the direction of the effect before collecting data.
Avoid t-tests with very small non-normal samples or heavily skewed data. Use non-parametric alternatives like Mann-Whitney U or Wilcoxon signed-rank test. For more than two groups, use ANOVA instead.

Support This Free Tool

Every coffee helps keep the servers running. Every book sale funds the next tool I'm dreaming up. You're not just supporting a site — you're helping me build what developers actually need.

500K+ users
200+ tools
100% private
Privacy Guarantee: Private keys you enter or generate are never stored on our servers. All tools are served over HTTPS.