T-Test Calculator
Calculate one-sample, unpaired (two-sample) and paired t-tests. Returns t-statistic, degrees of freedom, p-value and significance at α = 0.05. Suitable for GCSE, A-Level and university statistics.
Tests whether a sample mean differs from a known population mean. Formula: t = (x̄ − μ) / (s / √n)
Compares means of two independent groups (Welch's t-test, does not assume equal variance). Formula: t = (x̄₁−x̄₂) / √(s²₁/n₁+s²₂/n₂)
Group 1
Group 2
Compares two measurements from the same subjects (e.g. before and after). Formula: t = d̄ / (sₑ / √n)
t-Distribution Critical Values (Two-Tailed)
| Degrees of Freedom (df) | p = 0.10 | p = 0.05 | p = 0.02 | p = 0.01 |
|---|---|---|---|---|
| 1 | 6.314 | 12.706 | 31.821 | 63.657 |
| 2 | 2.920 | 4.303 | 6.965 | 9.925 |
| 3 | 2.353 | 3.182 | 4.541 | 5.841 |
| 5 | 2.015 | 2.571 | 3.365 | 4.032 |
| 10 | 1.812 | 2.228 | 2.764 | 3.169 |
| 15 | 1.753 | 2.131 | 2.602 | 2.947 |
| 20 | 1.725 | 2.086 | 2.528 | 2.845 |
| 25 | 1.708 | 2.060 | 2.485 | 2.787 |
| 30 | 1.697 | 2.042 | 2.457 | 2.750 |
| 50 | 1.676 | 2.009 | 2.403 | 2.678 |
| 100 | 1.660 | 1.984 | 2.364 | 2.626 |
| ∞ | 1.645 | 1.960 | 2.326 | 2.576 |
If |t| > critical value at your chosen significance level, reject the null hypothesis. For df not in the table, use the next lower df (conservative approach).
What is a T-Test?
A t-test is a statistical hypothesis test used to determine whether there is a significant difference between means. It was developed by William Sealy Gosset, writing under the pseudonym "Student," and published in 1908. The test uses the t-distribution—a bell-shaped curve similar to the normal distribution but with heavier tails, particularly when sample sizes are small.
The t-test compares your observed data against a null hypothesis (H₀), which typically states that there is no difference (e.g. the sample mean equals the population mean, or two group means are equal). The outcome is a t-statistic and p-value that tell you how likely your results are under the null hypothesis.
One-Sample vs Two-Sample vs Paired T-Test
| Type | Use case | Null hypothesis | Formula |
|---|---|---|---|
| One-sample | Compare sample to known value | x̄ = μ | t = (x̄−μ)/(s/√n) |
| Two-sample (unpaired) | Compare two independent groups | x̄₁ = x̄₂ | t = (x̄₁−x̄₂)/√(s²₁/n₁+s²₂/n₂) |
| Paired | Same subjects, two conditions | d̄ = 0 | t = d̄/(sₑ/√n) |
The Null Hypothesis and p-Value Explained
Every t-test starts with a null hypothesis (H₀) that assumes no effect or no difference. The alternative hypothesis (H₁) is what you are trying to demonstrate—for example, that a new drug lowers blood pressure more than a placebo.
The p-value is the probability of observing a t-statistic as extreme as (or more extreme than) the one you calculated, assuming H₀ is true. A small p-value means the result would be very unlikely by chance alone.
- p ≤ 0.05: Statistically significant at the 5% level — reject H₀
- p ≤ 0.01: Significant at the 1% level — strong evidence against H₀
- p > 0.05: Not significant — insufficient evidence to reject H₀
A significant result does not prove that H₀ is false, nor does it tell you the size or practical importance of the difference. Always consider effect size (e.g. Cohen's d) alongside p-values.
Worked Example: One-Sample T-Test
A sample of 10 students scored: 72, 68, 75, 80, 65, 77, 71, 73, 69, 78. Is the mean significantly different from 70?
Assumptions of the T-Test
- Normality: Data should be approximately normally distributed. With n > 30, the central limit theorem makes this less critical.
- Independence: Observations within each group must be independent. (Not required for paired tests within groups.)
- Equal variance (for pooled t-test): The standard two-sample t-test assumes equal group variances. This calculator uses Welch's t-test by default, which does not assume equal variances and is generally recommended.
- Interval/ratio scale: Data must be measurable on a continuous scale, not merely categorical or ordinal.
When to Use T-Test vs Z-Test
Use a t-test when: (a) the population standard deviation is unknown (almost always in practice), or (b) the sample size is small. Use a z-test only when the population standard deviation is known and the sample is large. In practice, t-tests are appropriate for almost all real-world applications.
Mann-Whitney U Test: Non-Parametric Alternative
The Mann-Whitney U test (also called the Wilcoxon rank-sum test) is used instead of an unpaired t-test when:
- Data are not normally distributed and the sample is small (cannot rely on CLT)
- Data are on an ordinal scale (e.g. Likert scale responses)
- There are significant outliers that would heavily distort a mean-based test
The test ranks all observations from both groups combined, then compares the sum of ranks between groups. It tests whether one group tends to have systematically higher values than the other. Unlike the t-test, it makes no assumption about the shape of the distribution.
The equivalent non-parametric test for paired data is the Wilcoxon signed-rank test.
GCSE, A-Level and University Context
At GCSE level, students meet hypothesis testing informally through concepts like "is this result significant?" in biology practicals. At A-Level biology, psychology and geography, the t-test (and Mann-Whitney U) appear explicitly in the methodology sections. Students need to: state hypotheses, state whether to use a one- or two-tailed test, calculate or look up the test statistic, compare to the critical value, and state a conclusion in context.
At university level, t-tests are foundational in quantitative methods modules across sciences, social sciences, medicine and engineering. You will also encounter ANOVA (for comparing more than two groups), regression, and multivariate techniques, all of which extend the logic of the t-test.
Frequently Asked Questions
What is the t-test formula?
One-sample: t = (x̄ − μ) / (s / √n). Two-sample unpaired (Welch's): t = (x̄₁ − x̄₂) / √(s²₁/n₁ + s²₂/n₂). Paired: t = d̄ / (sₑ / √n), where d̄ is the mean of pairwise differences.
What is the difference between a paired and unpaired t-test?
An unpaired (independent-samples) t-test compares two completely separate groups. A paired t-test compares the same subjects measured twice (before and after, or under two different conditions). Paired tests are more statistically powerful because they eliminate between-subject variability from the error term.
When do you use a t-test vs z-test?
Use a t-test when the population standard deviation is unknown (almost always). Use a z-test only when the population SD is known and your sample is large. In practice, always use the t-test unless you have a specific reason to use the z-test.
What is the Mann-Whitney U test calculator used for?
The Mann-Whitney U test is the non-parametric alternative to the unpaired t-test. Use it when your data are not normally distributed, are ordinal (ranked responses), or contain extreme outliers. It compares rank sums between two groups rather than means, so it is more robust to non-normality.
How do I interpret a p-value from a t-test?
If p ≤ 0.05, the result is statistically significant at the 5% level—you have enough evidence to reject the null hypothesis. If p > 0.05, you fail to reject the null (this is not the same as proving the null is true). The smaller the p-value, the stronger the evidence against the null hypothesis.
What are the assumptions of the t-test?
The data should be approximately normally distributed, observations should be independent, and (for the standard two-sample t-test) variances should be equal. Welch's t-test (used by this calculator) relaxes the equal-variance assumption. With n > 30 per group, the normality assumption is less critical due to the central limit theorem.