T-Test Calculator
Run a one-sample, two-sample (independent), or paired t-test from your raw data in seconds. Paste your numbers, choose your test and tail, and get the t-statistic, degrees of freedom, exact p-value, effect size, and a clear reject / fail-to-reject decision — with every step shown.
Textbook-accurate · Reviewed July 2026 · Formulas and the t-distribution follow the NIST e-Handbook of Statistical Methods
Choose Your Test
The known or target value you’re comparing your sample mean against.
Welch’s is the safer default; it doesn’t assume the two groups have equal variance.
Both lists must have the same number of values, in matching order (each pair from the same subject).
Your T-Test Result
t-Distribution
Your t-statistic on the t-distribution
- P-value area
- Your t-statistic
| Measure | Value |
|---|
What Is a T-Test?
A t-test is a statistical test that compares means to decide whether an observed difference is real or just the product of random chance. It answers a simple, practical question: is the gap between two averages big enough — relative to the noise in the data — to be taken seriously? The test produces a t-statistic (a signal-to-noise ratio) and a p-value (the probability of seeing a difference this large if there were really no difference at all). If the p-value falls below your significance level, you conclude the difference is statistically significant.
Every t-test starts from a null hypothesis that there’s no difference — the sample mean equals the target value, or the two group means are equal. The t-test weighs the evidence against that assumption. It’s one of the most widely used tests in research precisely because comparing averages is such a common need, from clinical trials to marketing experiments.
The Three Types of T-Test
Choosing the right test is the most important decision you’ll make, and it comes down to how your data is structured.
| Type | Compares | Use it when… |
|---|---|---|
| One-sample | One sample mean vs a known value | Testing whether your data differs from a benchmark or target |
| Two-sample (independent) | The means of two separate groups | Comparing two unrelated groups, like treatment vs control |
| Paired | Two measurements on the same subjects | Before-and-after or matched-pair designs |
One-sample t-test
The one-sample t-test compares the mean of a single group against a known or hypothesized value (μ₀). You’d use it to ask, for example, whether a production line’s average fill weight differs from the 500 ml printed on the label. The formula is:
t = (x̄ − μ₀) / (s / √n)
with degrees of freedom df = n − 1, where x̄ is the sample mean, s is the sample standard deviation, and n is the sample size.
Two-sample (independent) t-test
The independent-samples t-test — also called the unpaired or two-sample t-test — compares the means of two completely separate groups. This calculator uses Welch’s t-test by default, which does not assume the two groups have equal variance and is the more reliable choice in practice:
t = (x̄₁ − x̄₂) / √( s₁²/n₁ + s₂²/n₂ )
Welch’s test uses the Welch–Satterthwaite equation for its degrees of freedom, which is why the df is often a decimal. If you have good reason to assume equal variances, you can switch to the pooled Student’s version.
Paired t-test
The paired t-test (also called the dependent-samples or repeated-measures t-test) compares two measurements taken on the same subjects — before and after a treatment, or under two conditions. It works by testing whether the mean of the paired differences is zero:
t = d̄ / (s_d / √n)
where d̄ is the mean of the differences and s_d is their standard deviation. Because it removes person-to-person variability from the equation, the paired test is more powerful than an independent test when a matched design is possible.
Paired vs. Independent T-Test: Which Should You Use?
This is the most common point of confusion, and the answer hinges on one question: are your two sets of numbers linked? If each value in one group is naturally paired with a specific value in the other — because they come from the same person or matched unit — use a paired t-test. If the two groups are made up of different, unrelated subjects, use an independent t-test.
For example, measuring blood pressure in the same patients before and after a drug is paired. Comparing blood pressure between a group that got the drug and a separate group that got a placebo is independent. Using a paired test when you can is worthwhile: by cancelling out the differences between individuals, it isolates the effect you care about and typically detects it with a smaller sample.
How to Interpret T-Test Results
Once the calculator returns your results, interpretation follows three quick steps:
- Look at the p-value. Compare it to your significance level (α, usually 0.05). If p ≤ α, the difference is statistically significant and you reject the null hypothesis. If p > α, you fail to reject it — the data doesn’t provide enough evidence of a difference.
- Check the t-statistic’s size and sign. A larger absolute t means a stronger signal relative to noise; the sign tells you which mean is higher.
- Consider the effect size. The p-value tells you whether there’s a difference, not how big it is. Cohen’s d (reported above) measures the magnitude — roughly, 0.2 is small, 0.5 is medium, and 0.8 is large.
A significant result with a tiny effect size may not matter in practice, while a non-significant result in a small study might simply reflect too little data rather than no effect. Reporting the t-statistic, degrees of freedom, and p-value together — for example, “t(15) = 2.31, p = 0.036” — is the standard way to communicate a t-test.
T-Test Assumptions
The t-test is a parametric test, so its conclusions are trustworthy only when a few conditions roughly hold:
- Continuous data measured on an interval or ratio scale.
- Approximate normality — the data (or, for a paired test, the differences) should be roughly normally distributed. The test is fairly robust to mild departures, especially with larger samples.
- Independence of observations within each group.
- Equal variances for the classic independent test — though Welch’s test relaxes this, which is why it’s the safer default.
If these assumptions are badly violated, a nonparametric alternative like the Mann–Whitney U test (independent) or Wilcoxon signed-rank test (paired) may be more appropriate.
T-test vs. z-test
Use a t-test when the population standard deviation is unknown and estimated from the sample — which is almost always the case. Use a z-test only when the population standard deviation is known and the sample is large. In practice, the t-test is the everyday tool; you can explore where its critical values come from with our Z-Score Calculator, and turn any t-statistic into a precise probability with our P-Value Calculator.
When to Use a T-Test (and When Not To)
A t-test compares two means at most. If you need to compare three or more group means, a t-test isn’t the right tool — you’d use analysis of variance (ANOVA) instead, to avoid inflating your false-positive rate by running many tests. The building blocks of every t-test are the sample mean and standard deviation, which you can compute for any dataset with our Standard Deviation Calculator, and the result pairs naturally with a Confidence Interval Calculator to show the plausible range of the difference.
Frequently Asked Questions
A t-test is used to compare means and decide whether a difference is statistically significant or likely due to chance. It can compare one sample mean to a known value (one-sample), the means of two separate groups (independent), or two measurements on the same subjects (paired). It’s widely used in research, medicine, and business to test whether a treatment, change, or intervention produced a real effect. A t-test compares at most two means; for three or more, use ANOVA.
An independent (two-sample) t-test compares two separate, unrelated groups — like a treatment group versus a control group. A paired t-test compares two measurements from the same subjects, such as before-and-after readings on the same people. Use paired when each value in one group is naturally linked to a specific value in the other; use independent when the groups contain different subjects. Paired tests are more powerful because they remove between-subject variability.
Compare the p-value to your significance level, usually 0.05. If the p-value is less than or equal to 0.05, the result is statistically significant and you reject the null hypothesis, concluding the means differ. If it’s greater than 0.05, you fail to reject the null hypothesis — the data doesn’t provide enough evidence of a difference. Remember the p-value tells you whether a difference exists, not how large it is; check the effect size for magnitude.
There’s no single “good” t-value — its meaning depends on the degrees of freedom and your chosen significance level. Broadly, a larger absolute t-value indicates a stronger difference relative to the variability in your data. For many tests, an absolute t around 2 or higher is often significant at the 0.05 level, but the exact threshold (the critical value) rises as degrees of freedom fall. The p-value translates your t-value into a clear significance decision.
Use Welch’s t-test — the default here — when the two groups may have unequal variances or unequal sample sizes, which is common in real data. Welch’s doesn’t assume equal variance, so it stays reliable in more situations. Use the pooled Student’s t-test only when you have good reason to believe the two groups share the same variance. When variances and sample sizes happen to be equal, the two tests give the same result, so Welch’s is the safe general choice.
Use a two-tailed test — the default — when you’re testing for any difference between means in either direction. Use a one-tailed test only when you have a specific directional hypothesis decided before collecting data, such as “the new method is faster.” A one-tailed p-value is half the two-tailed value for the t-distribution, so switching to one-tailed after seeing your results to reach significance is considered p-hacking and should be avoided.
Methodology & formulas used
This calculator computes t-tests using standard formulas, reviewed July 2026. All computation runs locally in your browser; your data is never uploaded.
- One-sample: t = (x̄ − μ₀) / (s/√n), df = n − 1.
- Two-sample, Welch’s (default): t = (x̄₁ − x̄₂) / √(s₁²/n₁ + s₂²/n₂); df from the Welch–Satterthwaite equation.
- Two-sample, pooled Student’s: pooled variance sₚ² = [(n₁−1)s₁² + (n₂−1)s₂²] / (n₁+n₂−2); df = n₁ + n₂ − 2.
- Paired: t = d̄ / (s_d/√n) on the paired differences, df = n − 1.
- P-value: tail area of the t-distribution via the regularized incomplete beta function; two-tailed p = 2·[1 − CDF(|t|)].
- Effect size: Cohen’s d = t-based standardized mean difference for the chosen design.
Sample standard deviations use the n − 1 (Bessel) denominator. Results assume the t-test’s usual conditions (approximate normality, independence). Values are computed at full precision and rounded for display.
References
- NIST/SEMATECH e-Handbook of Statistical Methods. Confidence Limits for the Mean and the t-distribution. itl.nist.gov
- NIST/SEMATECH e-Handbook. Two-Sample t-Test for Equal Means. itl.nist.gov
- Wikipedia. Student’s t-test and the Welch–Satterthwaite equation. en.wikipedia.org
