One-Sample T-Test Calculator
Test whether your sample mean matches a known population value, manufacturer specification, or published benchmark. Compare your data against a claim with formulas and results shown.
Data entry:
§1 The Formula
The one-sample t-test compares a sample mean to a hypothesized population mean, answering: "Does my sample provide evidence that the population mean differs from this known value?"
- x̄
- Sample mean — the average of your measurements
- μ₀
- Hypothesized population mean — from a manufacturer, standard, or prior study
- s
- Sample standard deviation — spread of your measurements
- n
- Sample size — number of observations
- df
- Degrees of freedom = n − 1
§2 Testing a Manufacturer's Claim: Granola Bar Weight
A breakfast cereal company claims their granola bars weigh 42.0 g on average. A quality auditor buys 12 bars at random and measures their weight. The sample values are already loaded above: 41.2, 42.1, 41.8, 42.3, 41.9, 42.0, 41.7, 42.2, 41.6, 42.4, 41.5, 42.1 grams. The question: Does the sample mean significantly differ from the claimed 42.0 g?
Step 1: Organize your data. You have n = 12 measurements. The hypothesized population mean is μ₀ = 42.0 g (the manufacturer's claim).
Step 2: Calculate sample statistics. Sample mean x̄ = 41.9 g, sample SD s = 0.376 g.
Step 3: Compute the t-statistic. SE = 0.376 / √12 = 0.109 g. Then t = (41.9 − 42.0) / 0.109 = −0.92. A negative t means the sample average is slightly below the claimed value.
Step 4: Find degrees of freedom and the p-value. df = 12 − 1 = 11. For t(11) = −0.92 (two-tailed), p ≈ 0.376. This p-value is much larger than α = 0.05.
Step 5: Interpret the result. We fail to reject H₀. The sample mean does not provide statistically significant evidence that the true mean weight differs from 42.0 g. The manufacturer's claim is consistent with the auditor's sample. (The observed difference of 0.1 g is well within normal variation.)
APA-style report: A one-sample t-test showed that granola bar weights (M = 41.9, SD = 0.376) did not significantly differ from the manufacturer's claimed mean of 42.0 g, t(11) = −0.92, p = 0.376, d = −0.27.
§3 When to Use the One-Sample T-Test
The one-sample t-test is the right choice whenever you have a single sample and need to test it against a known or hypothesized population value. Common scenarios:
| Application Domain | Typical Research Question | The Known Value (μ₀) |
|---|---|---|
| Quality Control & Manufacturing | Do our products meet the specification? | Manufacturer target (e.g. 42.0 g, 9.5 V, 2.5% defect rate) |
| Academic Assessment | Does this class's mean score differ from the national average? | Published national or district benchmark (e.g. 75th percentile) |
| Instrument Calibration | Is my scale or thermometer systematically biased? | Known standard (e.g. 100.0°C boiling point, 1000 mg certified weight) |
| Medical & Lab Testing | Do patient blood glucose levels deviate from normal range? | Clinical reference value (e.g. 95–100 mg/dL fasting) |
| Materials Science | Does our alloy tensile strength match the literature value? | Published material property or design spec |
| Retail & Consumer Testing | Are package contents (e.g. coffee, pasta) actually at labeled weight? | Declared net weight on the package label |
§4 Assumptions & When This Test Is Wrong
Independence
Each observation must be independent. If you measure the same object multiple times under identical conditions, the measurements are not independent. If you sample from a production line where consecutive items are correlated (e.g. a machine drift), independence is violated. Use one observation per unit.
Approximate Normality
The data should be approximately normally distributed, or at least not severely skewed. With large samples (n ≥ 30), the Central Limit Theorem provides robustness even if individual data points are non-normal. With small samples (n < 15), check a histogram or Q–Q plot. Mild skewness is usually tolerable; extreme outliers or bimodality may warrant a nonparametric test.
Nonparametric Alternatives
If your data is ordinal (ranked, not measured), or if normality is badly violated, use the Wilcoxon signed-rank test instead. It tests whether the median (not the mean) differs from μ₀. It requires no normality assumption and is robust to outliers.
§5 FAQ
Where do I get the hypothesized population mean (μ₀) if I don't already know it?
The hypothesized population mean must come from outside your sample—never from your data. Common sources: (1) A manufacturer or label claim (e.g. "42 g per bar"). (2) A published norm or standard (e.g. WHO height-for-age reference, SAT average score). (3) A prior study or pilot data. (4) A regulatory or engineering specification. (5) A textbook value or historical baseline. The key is that μ₀ is established before you collect your sample. If you extract μ₀ from your own data, you are essentially testing H₀: sample mean = sample mean, which always fails to reject and is logically meaningless.
What is the difference between a one-sample t-test and a confidence interval?
They answer complementary questions. A one-sample t-test asks: "Is the true mean significantly different from μ₀?" A one-sample confidence interval (CI) answers: "What range of values is plausible for the true mean?" If your 95% CI does not contain μ₀, the t-test will reject H₀ at α = 0.05 (two-tailed); if it does contain μ₀, the test will fail to reject. Both tools are used together: the p-value tells you whether the effect exists, the CI tells you how large it likely is. See our confidence interval calculator for one-sample CIs.
Should I use one-tailed or two-tailed?
Use two-tailed unless you have a specific prior reason to expect the mean to be higher or lower (not both). Two-tailed tests are the default in most fields and are more conservative. One-tailed tests (e.g. "Is the mean greater than 42?") are only appropriate when your research hypothesis is truly directional before you see the data. After seeing your data, switching to one-tailed is p-hacking and inflates false-positive risk.
What if my sample size is very small (n < 5)?
The t-test is valid even for n = 2, but power (the ability to detect a real effect) is very low. With tiny samples, you need a very large difference to reach significance. Additionally, normality assumptions become more critical. Consider whether your study design allows larger samples, or consult a statistician about whether a nonparametric test is more suitable.
How do I report a one-sample t-test in APA format?
Use this template: t(df) = t-value, p = p-value, d = effect size, 95% CI [lower, upper]. Example: "Granola bar weights (M = 41.9, SD = 0.376) did not significantly differ from the claimed mean of 42.0 g, t(11) = −0.92, p = 0.376, d = −0.27, 95% CI [41.67, 42.13]." Always report the hypothesized value (μ₀) in the text, the observed descriptive statistics, and the full confidence interval.
§6 Related Tools & Resources
Extend your analysis with these complementary calculators:
T-Test Calculator
Compare one-sample, paired, or independent samples all in one tool. Switch test types on the fly.
Open calculator →Confidence Interval Calculator
Build confidence intervals for means. The CI is the estimation complement to hypothesis testing.
Open calculator →Effect Size Calculator
Calculate Cohen's d and other standardized effect sizes for reporting impact.
Open calculator →§7 Sources
- OpenStax Introductory Statistics 2e — Chapter on one-sample hypothesis tests and t-distributions.
- NCBI: Common Pitfalls in Statistical Analysis — Discussion of independent samples and common misinterpretations of p-values.
- Kent State University Library: APA 7 Statistics Reporting — Official guidance on formatting t-tests in APA style.