T-Test Calculator
One-sample, paired, Student and Welch t-tests from your data or from means and standard deviations: t, degrees of freedom, p-values, confidence interval and the decision.
Result…
How it's calculated
One-sample: t = (x̄ − μ₀) ÷ (s ÷ √n), df = n − 1 Paired: the same on the differences Student: t = (x̄₁ − x̄₂ − μ₀) ÷ (sₚ √(1/n₁ + 1/n₂)), sₚ² = ((n₁ − 1)s₁² + (n₂ − 1)s₂²) ÷ (n₁ + n₂ − 2) Welch: t = (x̄₁ − x̄₂ − μ₀) ÷ √(s₁²/n₁ + s₂²/n₂), df = (s₁²/n₁ + s₂²/n₂)² ÷ ((s₁²/n₁)²/(n₁ − 1) + (s₂²/n₂)²/(n₂ − 1))
A t-test asks whether a mean, or a difference between means, is far enough from a hypothesised value, given how much the data vary, to be unlikely by chance. The one-sample test compares one mean with a fixed value; the paired test works on the differences within pairs (the same people before and after); the two-sample tests compare independent groups. Student's version pools the two variances and assumes they are equal; Welch's does not and adjusts the degrees of freedom with the Welch–Satterthwaite formula, and is the default in R. The p-values come from the t distribution, computed through the regularised incomplete beta function, so they are exact to many digits rather than read from a table.
Your numbers, step by step
About the T-Test calculator
This t-test calculator runs the four common t-tests: one-sample, paired, Student's two-sample test with pooled variances, and Welch's two-sample test for unequal variances. Paste your raw data, or enter each group's mean, standard deviation and sample size from a paper or report. It returns the t statistic, the degrees of freedom (Welch–Satterthwaite for Welch's test), the two-tailed and one-tailed p-values, a confidence interval for the mean or the difference, and the decision at your significance level. Students use it to check homework, and analysts use it to compare two groups or a before-and-after measurement. The p-values come straight from the t distribution, not a printed table, and every step shows your own numbers: the means, the standard error, t and the critical value.
How to use it
- Choose the “Test”: one-sample, paired, or one of the two-sample tests (Welch is the safer default for two independent groups).
- Under “I have”, pick “The data” and paste “Sample 1” (and “Sample 2”), or pick “Mean, SD and n” and type the summary figures.
- Set the “Hypothesised difference (μ₀)”, usually 0, or the value a one-sample mean is compared with.
- Pick the “Alternative hypothesis” you decided on before looking at the data, and the “Significance level (α)”.
- Read the p-value, t, degrees of freedom, confidence interval and decision, and check the steps.
Worked example
Group 1 is 19, 22, 16, 29, 24 (mean 22, SD 4.95) and group 2 is 20, 11, 17, 12 (mean 15, SD 4.24). Welch's test gives SE = √(4.95²/5 + 4.24²/4) = 3.066 and df = 6.93, so t = (22 − 15) ÷ 3.066 = 2.283. The two-tailed p-value is 0.0568 (one-tailed 0.0284), and the 95% confidence interval for the difference runs from −0.26 to 14.26. Since 0.0568 is not below 0.05, H₀ is not rejected. The pooled Student test on the same data gives t = 2.239 with 7 df and p = 0.0601.
Updated
Questions people ask
How do I do a t-test by hand?
Find the difference between the means, divide it by its standard error to get t, then look up the p-value in the t distribution with the right degrees of freedom. The calculator shows each of those steps with your numbers.
Should I use Welch's t-test or Student's t-test?
Welch's test does not assume the two groups have equal variances and works almost as well when they do, so it is a common default for independent groups. Student's pooled test is fine when the variances are known to be similar and the group sizes are close.
When is a paired t-test the right choice?
When each value in one sample belongs with one value in the other, such as the same people measured before and after. Treating paired data as two independent samples ignores the pairing and usually loses power.
What is the difference between a one-tailed and a two-tailed p-value?
A two-tailed p-value counts extreme results in both directions; a one-tailed p-value counts only the direction you predicted beforehand. Choosing one-tailed after seeing the data is a common mistake that overstates significance. The p-value calculator converts other test statistics.
Does a p-value below 0.05 prove there is a real effect?
No. It says the data would be unusual if H₀ were true, not how big or important the effect is. Look at the confidence interval for the size of the difference, and remember that a t-test assumes independent, roughly normal data; for important decisions, ask a statistician.