Run a one-sample Student t-test: is the observed sample mean significantly different from a stated value?
by Calcuatany.com
A one-sample t-test tests whether an observed sample mean differs from a value you state in advance, called the null value. The test statistic is t = (x̄ − μ₀) / (s / √n), where x̄ is the sample mean, μ₀ is the value being tested, s is the sample standard deviation and n is the sample size. The denominator, s / √n, is the standard error of the mean. The result is compared against a t distribution with n − 1 degrees of freedom.
The t distribution is used rather than the normal one because the population standard deviation is almost never known, so s is used in its place. With s estimated from data the distribution is wider in the tails, and the wider the sample the closer it approaches the normal curve. At 24 observations the t distribution with 23 degrees of freedom is visibly wider than the standard normal.
How to use the T-Test Calculator
- Enter the "Sample mean" — the average you actually observed.
- Enter the "Hypothesised mean", which is the value the null hypothesis says the population mean equals. Choosing this before seeing the data is what keeps the test honest.
- Enter the "Sample standard deviation", which measures the spread of your observations.
- Enter the "Sample size". It must be at least 2, since a standard deviation cannot be estimated from a single observation. Read the two-sided p-value first, then use the t statistic, degrees of freedom and direction to understand how that probability was obtained.
Formula
t = (x̄ − μ₀) / (s / √n), with n − 1 degrees of freedom
Example: a sample mean of 72 tested against a hypothesised 70
Suppose a sample of 24 observations has a mean of 72, a standard deviation of 10, and the value being tested is 70. The standard error is 10 / √24, which is 2.0412.
The difference between the sample mean and the hypothesised mean is 2, so the test statistic is 2 / 2.0412, which is 0.9798, with 23 degrees of freedom. The exact two-sided Student t p-value is about 0.3375, which is above 0.05, so this sample does not provide statistically significant evidence that the population mean differs from 70.
How to interpret the result
The two-sided p-value is calculated from the Student t distribution using the displayed degrees of freedom. A value below 0.05 is conventionally described as statistically significant at the 5% level, but that cutoff should not replace context, study design or effect size. Smaller samples require more extreme t statistics than large samples for the same p-value.
The sign matters less than the magnitude. What a t-test settles is whether the difference is larger than sampling variation alone would readily produce.
A significant result says the sample is unlikely to have come from a population with that mean. It does not say by how much the population mean differs, and it does not rule out a small real effect.
Next, you may also find these useful: Average & Standard Deviation, Standard Error Calculator, Z-Score Calculator.
Assumptions and limitations
- The test assumes independent observations drawn from a population that is approximately normal, or a sample large enough for that to be workable.
- It assumes the sample standard deviation is a reasonable stand-in for the unknown population standard deviation, which is why the t distribution is used.
- Only the one-sample case is handled here. A two-sample comparison uses a different statistic with different degrees of freedom, and a paired test uses the differences rather than the raw values.
Frequently asked questions
What does a t-test actually test?
It tests whether a sample mean differs from a value you stated in advance by more than ordinary sampling variation would explain. The result is a statistic and a set of degrees of freedom, not a yes or no.
How many degrees of freedom do I use?
For a one-sample t-test it is n − 1, because one degree of freedom is spent estimating the mean. With 24 observations that is 23.
How do I interpret the two-sided p-value?
It is the probability, under the null hypothesis and model assumptions, of observing a t statistic at least as extreme in either direction. A p-value below 0.05 is often called statistically significant, but it is not the probability that the null hypothesis is true and it does not measure the size or importance of an effect.
Why use the t distribution instead of the normal one?
Because the population standard deviation is not known and is estimated from the sample. That estimate adds uncertainty, and the t distribution is wider in the tails to reflect it.
Does a small t value mean the result is wrong?
No. It means the sample mean is close to the value being tested, so the two cannot be distinguished with the sample you have. That is often a perfectly good outcome.
What if my data is not normally distributed?
The one-sample t-test tolerates mild departures from normality well, especially with a reasonably large sample. With a small sample and strongly skewed data, a test that does not assume normality is safer.
Sources and further reading
- NIST/SEMATECH e-Handbook: Are the data consistent with the assumed process mean?
- NIST/SEMATECH e-Handbook of Statistical Methods
Last reviewed: 2026-10-05. See our editorial policy.
Related calculators
For informational purposes only. Full disclaimer