T-Test Calculator
Reviewed by CalcMulti Editorial Team·Last updated: ·← Statistics Hub
The t-test is one of the most widely used statistical hypothesis tests. It determines whether there is a significant difference between a sample mean and a known value (one-sample t-test) or between two independent groups (two-sample t-test).
This calculator computes the t-statistic, degrees of freedom, and p-value, then interprets the result at the 0.05 significance level. Use it for A/B testing, clinical comparisons, before/after studies, and research hypothesis testing.
Formula
One-sample: t = (x̄ − μ₀) / (s / √n) Two-sample: t = (x̄₁ − x̄₂) / √(s₁²/n₁ + s₂²/n₂)
- x̄
- sample mean
- μ₀
- hypothesised population mean (one-sample test)
- s
- sample standard deviation
- n
- sample size
- df
- degrees of freedom (n−1 for one-sample; Welch approximation for two-sample)
The value you are testing your sample mean against
When to Use Each t-Test Type
| Test | Use when | Example |
|---|---|---|
| One-sample | Comparing a sample mean to a known constant | Is our product weight significantly different from the stated 500g? |
| Two-sample (independent) | Comparing means of two unrelated groups | Do male and female students score differently on the same test? |
| Paired (not here) | Same subjects measured twice (before/after) | Did blood pressure change after treatment in the same patients? |
Common Mistakes in t-Tests
Confusing statistical and practical significance
A statistically significant result (p < 0.05) does not mean the difference is large or meaningful. With very large samples, tiny differences become significant. Always report effect size (Cohen's d) alongside p-values.
Using paired t-test data in a two-sample test
If the same subjects were measured twice, you must use a paired t-test — not two-sample. Using two-sample on paired data reduces power and may give the wrong answer.
Checking significance after peeking at data
Deciding to run a t-test after seeing the data direction inflates Type I error. Pre-register your hypothesis and analysis plan before collecting data.
t-Test vs z-Test vs Mann-Whitney — Which to Use?
| Condition | t-Test | z-Test | Mann-Whitney U |
|---|---|---|---|
| Population σ known | — | ✓ Preferred | — |
| Population σ unknown (typical) | ✓ Preferred | Acceptable (n≥30) | — |
| Small sample (n < 30) | ✓ Yes | Not ideal | ✓ If non-normal |
| Data is normally distributed | ✓ Yes | ✓ Yes | Not required |
| Data is heavily skewed / non-normal | Robust (n≥15) | Not ideal | ✓ Preferred |
| Ordinal data (rankings, Likert) | No | No | ✓ Yes |
When in doubt, default to the Welch t-test (unequal variances). It is more conservative than the equal-variance t-test and performs well even when assumptions are mildly violated.
Case Study: Comparing Pain Reduction Scores in a Clinical Trial
A clinical researcher ran a two-sample t-test to compare pain reduction scores (VAS scale, 0–100) between a new analgesic drug group (n = 22, mean = 41.3, SD = 12.8) and a placebo group (n = 25, mean = 29.7, SD = 14.1). Both sample sizes were small, σ was unknown, so the Welch t-test was appropriate.
The result: t = 3.02, df ≈ 44.6, p = 0.004. The difference was statistically significant at α = 0.05. However, the researcher also computed Cohen's d = (41.3 − 29.7) / pooled SD ≈ 0.84 — a large effect size — confirming the difference was clinically meaningful, not just statistically detectable.
This distinction matters: with a very large sample, even a 2-point difference on a 100-point scale could produce p < 0.05, yet have no clinical relevance. The t-test tells you whether the difference is real; effect size tells you whether it matters.
Related Calculators
p-value from z or t statistic
Z-Score CalculatorStandardise a value
Normal Distribution CalculatorBell curve probabilities
Sample Size CalculatorHow many subjects needed
Standard Error CalculatorSE of the mean — used in t-test formula
Correlation CalculatorPearson r for two variables
Chi-Square CalculatorCategorical data distribution test
T-Test vs Z-TestWhich test to use for your sample size
Mann-Whitney U TestNon-parametric alternative when normality is not met
Sample vs PopulationWhy n−1 degrees of freedom in the t-test
Statistics HubAll statistics calculators
Disclaimer
This calculator is for educational and exploratory purposes only. Statistical significance does not imply practical importance. Consult a qualified statistician before making decisions based on hypothesis tests.