T-Test Calculator
Perform a one-sample or two-sample t-test.
Enter your data to calculate the t-statistic, p-value, and determine statistical significance.
The t-test is a statistical test used to determine whether there is a meaningful difference between group means. This calculator supports both one-sample and two-sample (Welch’s) t-tests, computing the t-statistic, degrees of freedom, and p-value.
One-Sample T-Test:
t = (x̄ - μ₀) / (s / √n)
Tests whether a sample mean differs from a known or hypothesized value μ₀.
Two-Sample T-Test (Welch’s, independent):
t = (x̄₁ - x̄₂) / √(s₁²/n₁ + s₂²/n₂)
Tests whether two groups have different means, without assuming equal variances.
What each variable means:
- x̄: the sample mean (average of your data values).
- μ₀: the hypothesized population mean you are testing against.
- s: the sample standard deviation, measuring spread in your data.
- n: the number of observations in the sample.
- s₁², s₂²: the variances of sample 1 and sample 2, respectively.
When to use a t-test: Use it when comparing means and the population standard deviation is unknown (which is almost always the case in practice). Use a one-sample test to check if a group differs from a target value, and a two-sample test to compare two groups.
Practical example: A one-sample test with data [5.1, 4.9, 5.3, 5.0, 4.8] against a hypothesized mean of 5.0. The sample mean = 5.02, SD = 0.192, SE = 0.086. t = (5.02 - 5.0) / 0.086 = 0.233 with 4 degrees of freedom. The p-value is 0.827, which is not significant at 0.05 — so we cannot conclude the mean differs from 5.0.
Interpreting results:
- If the two-tailed p-value is less than 0.05, the difference is statistically significant.
- A larger absolute value of t means a bigger difference relative to variability.
- Degrees of freedom for the two-sample test use Welch’s approximation, which adjusts for unequal variances.
Common mistakes: Make sure your data is roughly normally distributed, especially for small samples. The t-test compares means — it does not test whether distributions are the same shape. Use a chi-square test for categorical data instead.