Skip to content

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

  1. 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).
  2. 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.
  3. 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.
  4. 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?
Use a one-sample test to compare one group with a fixed value, a paired test when the same people or items are measured twice, and a two-sample test for two separate groups. If the two groups are different people, a paired test is wrong and will usually overstate or understate significance.
Does this use equal variances or Welch?
The two-sample mode uses Welch t-test, which does not assume equal variances. That is why the degrees of freedom are not a whole number. If you follow a textbook that pools the variances, the t-statistic and p-value will differ slightly.
How do I get the p-value for a one-tailed test?
The result panel lists the one-tailed value next to the two-tailed one. It is half the two-tailed p-value, and is only valid when the direction of the difference matches the direction you predicted in advance.
What sample size do I need for a t-test?
A t-test works for small samples if the data are roughly normal, but it needs at least 2 values per group and has little power with very small groups. For larger samples the test is robust to moderate non-normality. The Sample Size Calculator helps plan how many observations you need.
What is the difference between a z-test and a t-test?
A z-test needs the population standard deviation to be known. A t-test uses the sample standard deviation instead and accounts for that extra uncertainty with the t distribution. In practice the population value is rarely known, so t-tests are far more common.
What does "not significant" mean?
It means the data do not provide enough evidence to reject the null hypothesis at your chosen alpha. It does not prove the means are equal. A small sample can easily miss a real difference.

Related Statistics Calculators

Related Articles