What Is T-Test?
A t-test checks whether a mean differs from a target value or whether two means differ from each other when the population standard deviation is unknown and has to be estimated from the sample. It is the standard choice for small samples and for most real data.
Choose the test that matches your design: one-sample (one group against a value), paired (the same subjects measured twice) or two-sample. The two-sample test defaults to Welch's version, which does not assume equal variances, and the pooled equal-variance version is available too. The verdict beneath the results flags assumptions worth checking.
Below you will find the t-test formulas, a variables table, worked examples, assumptions and answers to common questions such as t-test versus z-test and when to use a paired test.
How to Use the T-Test Calculator
- Pick the test: two independent groups, paired measurements, or one sample against a known value.
- Choose raw data or summary statistics and enter your numbers.
- Set the alternative hypothesis (two-tailed unless you have a directional hypothesis fixed in advance) and the significance level.
- Read the decision, p-value, confidence interval and effect size. Use the chart to see where your t falls on the t distribution.
- Check the assumptions section below before reporting the result.
T-Test Formula
One-sample and paired t statistic
For paired data, x̄ and s are the mean and SD of the differences.
Welch two-sample t statistic
Welch–Satterthwaite degrees of freedom
Pooled variance (equal-variance test)
Cohen’s d
T-Test Variables Explained
| Symbol | Meaning | Notes |
|---|---|---|
| t | Test statistic | Difference measured in standard errors |
| x̄, s, n | Sample mean, standard deviation and size | For each group |
| μ₀ | Hypothesised mean | One-sample test |
| df | Degrees of freedom | n − 1, or Welch–Satterthwaite for two groups |
| SE | Standard error | Spread of the estimated difference |
T-Test Worked Example
Using the example values (press “Load example” above to try them):
- Test: Welch’s t-test (unequal variances). H₀: μ₁ − μ₂ = 0.
- Standard error = 0.761738; difference being tested = -2.9875.
- t = -2.9875 ÷ 0.761738 = -3.9219 with 14 degrees of freedom.
- p-value (two) = 0.0015341; critical value = 2.1448.
- p < α, so we reject H₀ at α = 0.05.
Result: t statistic = -3.9219; p-value = 0.0015341; Decision at α = 0.05 = Reject H₀.
Which t-test should I use?
If you are unsure whether the groups are independent or paired, ask: is each value in one group linked to a specific value in the other, such as the same person or matched pair? If yes, use the paired test.
| Your data | Test | Why |
|---|---|---|
| Two separate groups of different subjects | Two-sample (Welch) | Independent observations; no equal-variance assumption |
| Same subjects measured twice (before / after) | Paired t-test | Uses the within-subject differences and removes between-subject noise |
| One group compared with a target or standard value | One-sample t-test | Tests whether the mean differs from a fixed number |
| Two groups and you are sure variances are equal | Pooled two-sample | Slightly more power; rarely worth the assumption |
| Three or more groups | ANOVA, not repeated t-tests | Repeated t-tests inflate the false-positive rate |
How to interpret the results
The p-value is the probability of seeing a t statistic at least this extreme if the null hypothesis were true. It is not the probability that the null is true, and it does not measure the size of the effect. If p is below your chosen α, the data are inconsistent enough with the null hypothesis that you reject it.
Always read the confidence interval and effect size alongside the p-value. A very large sample can make a trivial difference significant, while a small sample can make a large difference non-significant. Cohen’s d expresses the difference in standard deviation units so you can judge practical importance.
| |d| | Label | Meaning in practice |
|---|---|---|
| below 0.2 | Negligible | Hard to see in practice |
| 0.2 to 0.5 | Small | Noticeable on careful study |
| 0.5 to 0.8 | Medium | Visible to the naked eye |
| 0.8 and above | Large | Obvious difference |
Assumptions and what to do when they fail
- Independence: each observation is independent of the others (except pairs in a paired test).
- Scale: the outcome is measured on an interval or ratio scale.
- Approximate normality: of the data (or of the differences for paired data). With n of 30 or more per group, the test is robust to moderate non-normality.
- No extreme outliers: they distort both the mean and the SD. Check a plot of the data.
- Equal variances (pooled test only): Welch’s test avoids this assumption.
- If normality fails badly with small samples, consider the Mann-Whitney U test (independent) or Wilcoxon signed-rank test (paired).
How to report a t-test (APA style)
Report the test, degrees of freedom, t value, exact p-value, effect size and confidence interval. The calculator writes this sentence for you in the results list, in the format: t(df) = value, p = value, d = value, CI [low, high]. Add the group means and standard deviations in the text or a table.
Where T-Test Is Used
Comparing a mean with a target
Testing whether an average differs from a specification or published value.
Before and after studies
Using a paired t-test on the same people or items measured twice.
Comparing two groups
Checking whether two independent group means differ.
Reporting results
Copying a ready APA-style sentence with t, df, p and the effect size.
Common T-Test Mistakes to Avoid
- Using an independent-samples test for paired data, which throws away the pairing and loses power.
- Running many t-tests on the same data without correcting for multiple comparisons.
- Choosing a one-tailed test after seeing which direction the data went.
- Interpreting “not significant” as proof of no difference.
- Ignoring unequal sample sizes and variances when using the pooled test.
- Default to Welch’s test for two independent groups.
- Decide one-tailed or two-tailed before collecting data.
- Report an effect size and interval, not only the p-value.
- For paired data, enter before and after in the same order.
T-Test Terms and Definitions
- Degrees of freedom
- The number of independent pieces of information, which determines the shape of the t distribution.
- Standard error
- The standard deviation of the sampling distribution of the difference in means.
- Critical value
- The t value beyond which you reject the null at your chosen α.
- Effect size
- A standardised measure of how large the difference is, independent of sample size.
T-Test FAQs
What is a t-test used for?
To compare means: either one sample against a known value, two independent groups against each other, or two measurements on the same subjects.
What is the difference between a t-test and a z-test?
A z-test uses a known population standard deviation; a t-test uses the sample standard deviation and the heavier-tailed t distribution. With large samples they give nearly the same result.
Should I use Welch’s t-test or the pooled t-test?
Welch’s test is the safer default, because it works whether or not the variances are equal. The pooled test gains only a little power when variances really are equal.
What does the p-value mean?
It is the probability of getting a result at least as extreme as yours if the null hypothesis were true. A small p-value is evidence against the null, not a probability that the null is false.
What sample size do I need for a t-test?
The test works with small samples if the data are close to normal. For skewed data aim for 30 or more per group. Use a power analysis to plan the size you need to detect a given effect.
When should I use a paired t-test?
When each observation in one group is naturally linked to one in the other, such as before-and-after measurements on the same people or matched pairs.
What is Cohen’s d?
A standardised effect size: the difference between means divided by the pooled standard deviation. Roughly 0.2 is small, 0.5 medium and 0.8 large.
Can I use a t-test with more than two groups?
No. Use ANOVA for three or more groups, then follow up with post-hoc comparisons if the overall test is significant.
What is the difference between Student's and Welch's t-test?
Student's two-sample test pools the variances and assumes they are equal. Welch's test does not assume equal variances and adjusts the degrees of freedom, which is why it is the default here.
What if my data are not normally distributed?
The t-test is fairly forgiving with moderate or large samples, but strong skew or outliers in small samples can mislead it. In that case consider a rank-based alternative such as the Mann-Whitney U or Wilcoxon test.