T-Test Calculator — Step-by-Step Solutions
The T-Test Calculator performs hypothesis testing for means using Student's t-distribution. It supports one-sample t-tests, two-sample independent t-tests (Welch's method), and paired t-tests with step-by-step solutions.
Enter your sample data or summary statistics, choose your test type and significance level, and get instant results including the t-statistic, degrees of freedom, p-value, and a clear conclusion about whether to reject the null hypothesis.
Your calculations will appear here
How to Use the T-Test Calculator
- Choose the test that fits your design: One-Sample (compare one sample mean to a known value), Two-Sample (compare the means of two independent groups), Paired (the same subjects measured twice), or P-Value from T-Statistic (you already have t and the degrees of freedom).
- One-Sample: enter the sample mean, the hypothesised population mean (H0), the sample standard deviation and the sample size n. Two-Sample: enter mean, standard deviation and n for each group. Paired: type the list of differences (after minus before) separated by commas.
- Set alpha, usually 0.05. The result shows the t-statistic, degrees of freedom, the two-tailed p-value (and the one-tailed value where relevant) and whether the result is significant. The working below the result shows each step.
- Always enter the sample standard deviation (divide by n - 1), not the population one. If you only have raw data, find the mean and sample standard deviation first.
Formula and Theory
A t-test asks whether an observed difference in means is larger than you would expect from random sampling noise. The t-statistic is the difference divided by its standard error, so it counts how many standard errors the sample mean sits from the value under the null hypothesis.
The one-sample statistic is t = (x bar - mu0) / (s / sqrt(n)) with n - 1 degrees of freedom. The paired test is a one-sample test applied to the list of differences, so t = d bar / (s_d / sqrt(n)) with n - 1 degrees of freedom. Both depend on the standard deviation being estimated from the sample, which is why the t distribution is used instead of the normal.
The two-sample test here is Welch t-test, which does not assume the two groups have equal variances. The standard error is sqrt(s1^2/n1 + s2^2/n2) and the degrees of freedom come from the Welch-Satterthwaite formula, so they are usually not a whole number. Welch is the safer default; when variances really are equal it loses almost nothing.
The p-value is the probability of a t-statistic at least this far from zero if the null hypothesis is true. Compare it with alpha to decide, and report the confidence interval or effect size alongside it.
Worked Examples
Example 1: One-sample t-test
Problem: A class of 30 students has a mean score of 105 with a standard deviation of 15. Test whether the mean differs from 100 at alpha = 0.05.
Solution: Standard error = 15 / sqrt(30) = 15 / 5.4772 = 2.7386. t = (105 - 100) / 2.7386 = 1.8257. Degrees of freedom = 29. The two-tailed p-value for t = 1.8257 with 29 degrees of freedom is 0.0782. Since 0.0782 > 0.05, do not reject H0.
Answer: t = 1.826, df = 29, p = 0.0782 (not significant)
Example 2: Two-sample (Welch) t-test
Problem: Group A: mean 85, SD 10, n = 30. Group B: mean 80, SD 12, n = 25. Is there a difference at alpha = 0.05?
Solution: Variance terms: 10^2/30 = 3.3333 and 12^2/25 = 5.76, sum 9.0933. Standard error = sqrt(9.0933) = 3.0155. t = (85 - 80) / 3.0155 = 1.658. Welch degrees of freedom = 9.0933^2 / (3.3333^2/29 + 5.76^2/24) = 82.69 / 1.7655 = 46.83. Two-tailed p = 0.1040.
Answer: t = 1.658, df = 46.83, p = 0.1040 (not significant)
Example 3: Paired t-test
Problem: Eight people are measured before and after a training programme. The after-minus-before differences are 2, -1, 3, 0.5, 1, -0.5, 2.5, 1. Test for a change.
Solution: Sum of differences = 8.5, so the mean difference = 8.5 / 8 = 1.0625. The sum of squared deviations from 1.0625 is 13.7188, so s_d = sqrt(13.7188 / 7) = 1.4000. Standard error = 1.4000 / sqrt(8) = 0.4950. t = 1.0625 / 0.4950 = 2.147 with 7 degrees of freedom. Two-tailed p = 0.0690.
Answer: t = 2.147, df = 7, p = 0.0690 (not significant at 0.05)
Example 4: P-value from a t-statistic you already have
Problem: A paper reports t = 2.45 with 29 degrees of freedom. What is the p-value?
Solution: Enter t = 2.45 and df = 29 in the P-Value mode. The two-tailed area in both tails beyond +/-2.45 is 0.0206; the one-tailed area is half of that, 0.0103.
Answer: Two-tailed p = 0.0206; one-tailed p = 0.0103
Frequently Asked Questions
Which t-test should I use?
Does this use equal variances or Welch?
How do I get the p-value for a one-tailed test?
What sample size do I need for a t-test?
What is the difference between a z-test and a t-test?
What does "not significant" mean?
Related Statistics Calculators
Probability Calculator
Calculate probability of events, complements, unions, and intersections. Free online probability calculator for statistics.
Standard Deviation Calculator
Calculate standard deviation, variance, mean, and more for any dataset. Supports population and sample statistics. Free online tool.
Z-Score Calculator
Calculate z-scores, find values from z-scores, and determine probabilities. Free online z-score calculator with bell curve visualisation.
Binomial Calculator
Calculate binomial probabilities, cumulative distributions, and expected values. Free online binomial distribution calculator with bar chart.
Normal Distribution Calculator
Calculate probabilities for normal distributions. Find areas under the bell curve, percentiles, and inverse values. Free online tool.
Correlation Calculator
Calculate Pearson correlation coefficient, R-squared, and regression line. Free online correlation calculator with scatter plot.