Calculator Hero

T-Test Calculator

Calculates the t-statistic, degrees of freedom, and p-value for one-sample and two-sample hypothesis tests.

Last updated: June 11, 2026

T-Test Calculator

Mean of your sample

Standard deviation of sample

Number of observations

Known population mean

Enter sample mean, SD, sample size, and hypothesized mean above.

How to Use the T-Test Calculator

This t test calculator supports both a one-sample t-test (comparing a sample mean to a known value) and a two-sample t-test (comparing two independent group means). Select the tail type — two-tailed is appropriate for most research questions. Enter your sample statistics and the calculator instantly returns the t-statistic, degrees of freedom, p-value, and a decision at α = 0.05.

For survey-based research, pair this tool with our margin of error calculator to understand the precision of your estimates before running a formal hypothesis test.

T-Test Formulas

The t-test converts a difference in means into a standardized score relative to sampling variability.

One-Sample T-Test

When comparing a sample mean (x̄) to a known population mean (μ₀):

t = (x̄ − μ₀) / (s / √n)

Where s is the sample standard deviation and n is the sample size. Degrees of freedom: df = n − 1.

Two-Sample T-Test (Welch)

For comparing two independent group means:

t = (x̄₁ − x̄₂) / √(s₁²/n₁ + s₂²/n₂)

Degrees of freedom use the Welch–Satterthwaite equation, which adjusts for unequal group variances. This calculator uses Welch's t-test by default because it performs well whether or not the variances are equal.

AdvertisementResponsive Ad

Understanding P-Values and Statistical Significance

The p-value answers: "If the null hypothesis were true, how often would we see a result this extreme by chance?" A p-value of 0.05 means a 5% chance. The conventional cutoff is α = 0.05, but α = 0.01 is used in stricter contexts (medical trials, for example) and α = 0.10 in exploratory research.

Important caveats: a significant p-value does not mean the effect is large or practically meaningful. Always report the effect size (Cohen's d for t-tests) alongside the p-value. Also, p-values are sensitive to sample size — very large samples can produce significant p-values for trivially small differences.

One-Tailed vs Two-Tailed Tests

Choose two-tailed when you are testing for any difference between means (most common). Choose right-tailed when you predict the sample mean is greater than the reference value, or left-tailed when you predict it is smaller. One-tailed tests have more power but require strong prior justification — using them to "fish" for significance is considered p-hacking.

Step-by-Step Example: One-Sample T-Test

A researcher believes the average resting heart rate in a population is 70 bpm. She measures a sample of 25 people and finds x̄ = 73.2 bpm, s = 8.6 bpm.

  1. State H₀: μ = 70; H₁: μ ≠ 70 (two-tailed)
  2. Calculate t: t = (73.2 − 70) / (8.6 / √25) = 3.2 / 1.72 = 1.860
  3. Degrees of freedom: df = 25 − 1 = 24
  4. Find p-value: for t = 1.860, df = 24, two-tailed → p ≈ 0.075
  5. Decision: p = 0.075 ≥ 0.05 → fail to reject H₀. The evidence is not strong enough to conclude the mean differs from 70 bpm at the 5% significance level.

For more complex inference, our confidence interval calculator can express the same result as an interval estimate.

AdvertisementResponsive Ad

Common Mistakes in T-Tests

  • Confusing one-tailed and two-tailed — always pre-specify the tail type before collecting data
  • Misinterpreting p-value as effect size — a p-value of 0.001 does not mean a large effect, only a highly unlikely result under H₀
  • Using t-tests on non-independent samples — for paired data (before/after measurements on the same subjects), use a paired t-test, not an independent two-sample test
  • Ignoring assumptions — t-tests assume approximately normal data; for small n with heavily skewed data, consider a non-parametric alternative like the Mann-Whitney U test
  • Multiple comparisons without correction — running many t-tests increases the false positive rate; apply Bonferroni or similar corrections
  • Wrong test for categorical data — t-tests compare means of continuous variables; for testing whether categorical counts differ from expected frequencies, use our chi-square calculator instead

Sources & References

  1. Student's t-distributionWikipedia
  2. Welch's t-testWikipedia
  3. Hypothesis TestingKhan Academy

Frequently Asked Questions

Related Calculators

Advertisement

320 × 50 — Mobile Anchor