One-Sample T-Test Calculator
Test a sample mean against a known or claimed value — from summary statistics or a pasted data list — with the t statistic, p-value, critical t, Cohen’s d and the 95% confidence interval.
Fail to reject H₀ at α = 0.05 — with t = 1.667 and a p-value of 0.1085, the sample mean of 105 is not significantly different from 100.
Calculation
Shaded t curve — rejection region
The shaded tails beyond ±2.064 are the rejection region at α = 0.05 (two-tailed, df = 24). The dot marks the observed t = 1.667, which falls outside the shaded region.
A one-sample t-test calculator tests whether a sample mean differs from a known or claimed value. Enter the sample mean, standard deviation and size — or paste a raw data list — plus the hypothesised mean, and it returns the t statistic, degrees of freedom, p-value, critical t, Cohen’s d and the 95% confidence interval, with a shaded t curve.
How to use the one-sample t-test calculator
Use Summary stats when you already know the sample mean, standard deviation and size. Use Raw data when you have the individual measurements — the calculator works out the mean and sample standard deviation (s) for you.
- Choose a mode: Summary stats or Raw data.
- Enter the sample mean, sample SD and sample size n — or paste the values in Raw data mode, separated by commas, spaces or line breaks.
- Enter the hypothesised mean (μ₀), the value you are testing against, then choose the significance level (α) and the tail: two-tailed, or one-tailed for μ > μ₀ or μ < μ₀.
- Read the headline t statistic, then check the results grid for the p-value, critical t, degrees of freedom, Cohen’s d, 95% confidence interval and standard error. The calculation ledger shows every step, and the chart shades the rejection region.
Try it now: with x̄ = 105, s = 15, n = 25 and μ₀ = 100, the calculator gives t = 1.667, df = 24 and a two-tailed p-value of 0.1086 — not significant at the 5% level. Paste the raw list 98, 102, 105, 110, 95 with μ₀ = 100 and it gives t = 0.761 with df = 4.
When should you use a one-sample t-test?
Use a one-sample t-test when you have one sample and want to know whether its mean is compatible with a known, claimed or target value — for example, whether packs of coffee really average 250 g, or whether a class mean differs from the national average. It is the right test when:
- The population standard deviation (σ) is unknown and must be estimated from the sample.
- The sample is small to moderate — the t-test was designed for exactly these cases.
- The data are approximately normal, or the sample is large enough that the central limit theorem applies.
- Observations are independent and measured on a continuous scale.
Because σ is unknown, the test uses the sample SD (s) and the t-distribution instead of the normal curve. The same t-distribution powers the t-distribution calculator, where you can look up any area, p-value or critical t for any degrees of freedom.
One-sample t-test vs z-test: which one do you need?
Both tests compare a sample mean with a value, but they assume different things about the population. The t-test is for unknown σ; the z-test is for known σ.
| Question | One-sample t-test | Z-test |
|---|---|---|
| Is σ known? | No — estimated from the sample (s) | Yes — σ is known |
| Sample size | Any, but essential when n < 30 | Large (usually n ≥ 30) |
| Distribution | t with df = n − 1 | Standard normal |
| Two-tailed cut-off at 95% (df = 24) | 2.064 | 1.960 |
| Typical use | Testing a mean with unknown σ | Testing a mean with known σ, or a proportion |
Common t critical values at α = 0.05 (two-tailed) are df = 4 → 2.776, df = 10 → 2.228, df = 24 → 2.064 and df = 30 → 2.042. Notice how the cut-off falls towards 1.960 as the sample grows.
If σ is known, a critical z-value calculator gives the cut-off you need. If you are testing a proportion rather than a mean, use the one-proportion z-test calculator instead. If you need to combine two samples’ spread first, a pooled standard deviation calculator does that step, and if you are starting from a single raw score, first learn how to calculate a z-score.
How do I read the p-value, Cohen’s d and confidence interval together?
Three numbers, one story. Read them as a group rather than in isolation:
- P-value: the probability of getting a sample mean at least as far from μ₀ as yours, if the null hypothesis were true. If p < α, reject H₀; if p > α, do not. Learn more about what a p-value is and what it cannot tell you.
- Cohen’s d: the size of the difference in standard deviation units, d = (x̄ − μ₀) / s. Roughly, 0.2 is small, 0.5 is medium and 0.8 is large. A tiny p-value with a tiny d can mean a real but trivial difference.
- 95% confidence interval: the range of plausible values for the true mean, x̄ ± t* · (s / √n). If the interval excludes μ₀, the two-tailed test at 5% rejects — the two must agree. Its width is set by the margin of error vs confidence interval trade-off, and you can build one directly with a confidence interval calculator for a mean and standard deviation.
Example: in the first worked example below, p = 0.1086 (not significant), d = 0.333 (a small effect) and the 95% CI [98.81, 111.19] contains 100 — all three agree that the evidence against 100 is weak. In the second, p = 0.0073, d = 0.587 (a medium effect) and the CI [102.61, 114.99] excludes 100 — all three point the other way.
Worked examples
Example 1 — not significant (summary stats)
A bakery claims its loaves average 100 g of filling. A sample of 25 loaves has x̄ = 105, s = 15. Testing H₀: μ = 100 at α = 0.05, two-tailed: SE = 15 / √25 = 3.00, so t = (105 − 100) / 3.00 = 1.667 with df = 24. The p-value is 0.1086 and the critical t is 2.064, so |1.667| < 2.064 and we fail to reject H₀. Cohen’s d = 0.333 (small) and the 95% CI is [98.81, 111.19], which contains 100.
Example 2 — significant (summary stats)
With the same s = 15 and n = 25 but a sample mean of x̄ = 108.8, the standard error is still 3.00, so t = (108.8 − 100) / 3.00 = 2.933 with df = 24. The p-value is 0.0073, below 0.05, and 2.933 exceeds the critical t of 2.064, so we reject H₀. Cohen’s d = 0.587 (a medium effect) and the 95% CI is [102.61, 114.99], which excludes 100.
Example 3 — raw data
Five measurements — 98, 102, 105, 110, 95 — tested against μ₀ = 100, two-tailed. The sample mean is 102 and the sample SD is s = 5.874, so SE = 5.874 / √5 = 2.627 and t = (102 − 100) / 2.627 = 0.761 with df = 4. The p-value is 0.4887 and the critical t is 2.776, so we fail to reject H₀. Cohen’s d = 0.341 and the 95% CI is [94.71, 109.29].
Frequently asked questions
When should I use a one-sample t-test?
Use a one-sample t-test when you have one sample and want to test its mean against a known or claimed value, the population standard deviation is unknown and estimated from the sample, and the data are approximately normal. It is the standard choice for small samples, where the t-distribution accounts for the extra uncertainty of estimating σ from the sample.
What is the difference between a one-sample t-test and a z-test?
A one-sample t-test is used when the population standard deviation σ is unknown and estimated from the sample; it uses the t-distribution with df = n − 1. A z-test is used when σ is known, or the sample is large, and it uses the standard normal distribution. With small samples the t-test gives wider intervals and larger cut-offs; as n grows, the two give almost the same answer.
How do I calculate a one-sample t-test by hand?
First find the standard error SE = s / √n. Then compute t = (x̄ − μ₀) / SE and df = n − 1. Look up the critical t for your α and tail, or find the p-value from the t-distribution. For example, x̄ = 105, s = 15, n = 25 and μ₀ = 100 give SE = 3.00, t = 1.667 and df = 24.
How do I read the p-value in a one-sample t-test?
The p-value is the probability of getting a sample mean at least as far from μ₀ as yours, if the null hypothesis were true. If p is smaller than your significance level α (usually 0.05), reject H₀; if p is larger, do not. A p-value of 0.1086, for example, means the result is not significant at the 5% level.
What is Cohen’s d in a one-sample t-test?
Cohen’s d measures the size of the difference in standard deviation units: d = (x̄ − μ₀) / s. Roughly, 0.2 is a small effect, 0.5 is medium and 0.8 is large. A d of 0.333 is small, and a d of 0.587 is medium. Unlike the p-value, d does not depend on sample size, so it says how big the difference is, not just whether it is significant.
How do I read the confidence interval with the p-value?
The 95% confidence interval gives the range of plausible values for the true population mean. If the interval excludes μ₀, the two-tailed test at the 5% level rejects H₀; if it includes μ₀, it does not. The two always agree in a two-tailed test: for example, [98.81, 111.19] contains 100, matching a p-value of 0.1086.
What sample size do I need for a one-sample t-test?
There is no minimum, but the test needs at least 2 observations (df = n − 1) and is most useful for small to moderate samples. With very small samples the data must be close to normal. Larger samples give narrower confidence intervals and more power, so a real difference is easier to detect, and the t-distribution approaches the normal distribution as n grows.
Can I use a one-sample t-test on raw data?
Yes. Paste the individual values into the calculator in Raw data mode and it works out the sample mean and sample standard deviation first, then runs the test. For example, the list 98, 102, 105, 110, 95 has a mean of 102 and a sample SD of 5.874, giving t = 0.761 with df = 4 against a hypothesised mean of 100.
Source: the critical t values quoted on this page are from the NIST/SEMATECH e-Handbook of Statistical Methods, Critical Values of the Student’s t Distribution. All examples on this page were checked against that table.
See all 43 free statistics tools on Empirical Rule Calculators.
More Tools to Explore
Keep going with the calculators that pair with the one-sample t-test — the t-distribution, critical values, confidence intervals and z-scores.
T-Distribution Calculator
Look up any area, p-value or critical t on the t-distribution for any degrees of freedom.
Critical Z-Value Calculator
Find the z cut-offs (1.645, 1.96, 2.576) for your confidence level in one step.
Confidence Interval Calculator
Build a confidence interval for a mean from x̄, s and n — with the t cut-off shown.
One-Proportion Z-Test Calculator
Test a sample proportion against a claimed value with a z-test and a p-value.
Pooled Standard Deviation Calculator
Combine two samples’ spread into one pooled SD for two-sample tests.
Z-Score Calculator
Turn any raw score into a z-score and read off its percentile in seconds.
Explore All Tools →
Browse all 43 free statistics tools — every calculator on this site in one place.