T-Test Calculator (One-Sample)
A one-sample t-test checks whether your sample’s mean is really different from a value you expect. Enter your sample data and the mean you are testing against, and the calculator gives you the t-statistic, the degrees of freedom and the two-tailed p-value.
T-Test Formula
t = (x̄ − μ₀) / (s / √n)
- x̄ = the sample mean
- μ₀ = the hypothesised population mean
- s = the sample standard deviation (with n − 1 in the denominator)
- n = the sample size; degrees of freedom = n − 1
The p-value is the two-tailed probability from the t-distribution with n − 1 degrees of freedom. A p-value under 0.05 is usually read as statistically significant at the 5% level.
Worked Example
Sample: 2, 3, 4, 5, 6, tested against a hypothesised mean of μ₀ = 3.
- Sample mean x̄ = (2 + 3 + 4 + 5 + 6) / 5 = 4.
- Sample standard deviation s = √((4 + 1 + 0 + 1 + 4) / 4) = √2.5 = 1.58.
- Standard error = s / √n = 1.58 / √5 = 0.71.
- t = (4 − 3) / 0.71 = 1.41, with df = 5 − 1 = 4.
- Two-tailed p-value = 0.2302. That is above 0.05, so the difference is not statistically significant — a mean of 4 is plausible for a population with a true mean of 3.
How to Use This Calculator
- Enter your sample values, separated by commas, spaces or line breaks.
- Enter the hypothesised mean (μ₀) — the value you are testing against.
- Click “Run T-Test” to see the t-statistic, degrees of freedom and p-value.
- Read the p-value: under 0.05 means the sample mean differs significantly from μ₀ at the 5% level; 0.05 or above means it does not.
Frequently Asked Questions
What does a one-sample t-test do?
It tests whether the mean of your sample is plausibly equal to a value you specify, called the hypothesised mean. A small p-value means the sample mean is unlikely to be that far from the hypothesised mean by chance alone.
When do I use a t-test instead of a z-test?
Use a t-test when the population standard deviation is unknown and estimated from the sample, which is the usual case, especially with small samples. A z-test needs a known population standard deviation.
What does the p-value mean?
The p-value is the probability of seeing a sample mean at least this far from the hypothesised mean if the hypothesised mean were really true. A p-value under 0.05 is usually called statistically significant.
Is this a one-tailed or two-tailed test?
This calculator gives a two-tailed p-value: it tests for a difference in either direction from the hypothesised mean.
What does the t-test assume?
It assumes the observations are independent and come from a roughly normal population. With small samples, strong skew or heavy outliers can make the result less reliable. Check the spread of your data first with the standard deviation calculator.