Skip to content
Calculator Collection

One-Sample T-Test Calculator

Compute the one-sample t-statistic to test whether your sample mean differs significantly from a known or hypothesised population mean. The first inferential test most students learn — used in survey analysis, quality control, and any single-group comparison against a benchmark.

Last updated: May 2026

Fill in the required fields to see your result.

Compare with similar

About this calculator

The one-sample t-statistic measures how many standard errors your sample mean is from a hypothesised population mean: t = (x̄ − μ₀) / (s / √n), where x̄ is the sample mean, μ₀ is the hypothesised population mean under H₀, s is the sample standard deviation, and n is the sample size. The denominator s/√n is the standard error of the mean — the SD of the sampling distribution of the sample mean. A large |t| means the sample mean is far from μ₀ in standard-error units, providing evidence against H₀. The t-statistic follows a Student’s t-distribution with n − 1 degrees of freedom under the null hypothesis, which has heavier tails than the standard normal for small samples — this is what distinguishes the t-test from a z-test. For sample sizes ≥ 30 the t-distribution converges on the normal, and the two tests give nearly identical p-values; for smaller samples, the t-test is more appropriate. The ‘testType’ field (one-sided vs two-sided) determines how the p-value is computed from the t-statistic but doesn’t affect the t-statistic itself. Variables: x̄ is the observed sample mean, μ₀ is your reference value, s is the sample SD (use Bessel’s-corrected formula with n − 1), n is the count. Edge cases: requires n ≥ 2 (single observation gives s undefined). Assumes data is approximately normal — for severe non-normality use a non-parametric Wilcoxon signed-rank test instead. Assumes independent observations — paired/repeated-measures data needs a paired t-test on the differences. For comparing two groups, use a two-sample t-test (Welch’s or Student’s) instead.

How to use

Example 1 — Quality control: are widgets meeting spec? Spec calls for mean weight of 100 g (μ₀). You sample n = 25 widgets and find x̄ = 98.5 g with s = 3.0 g. t = (98.5 − 100) / (3.0 / √25) = (−1.5) / (3.0/5) = (−1.5)/0.6 = −2.5. ✓ For a two-sided test at α = 0.05 with df = 24, critical t = ±2.064. Since |t| = 2.5 > 2.064, reject H₀ — the widgets are significantly underweight at the 5% level. The p-value is approximately 0.0196. Example 2 — Survey: is the average rating above neutral? On a 1–10 scale, neutral is 5.5. You survey n = 100 customers, finding x̄ = 6.2 with s = 1.8. t = (6.2 − 5.5) / (1.8 / √100) = 0.7 / 0.18 ≈ 3.89. ✓ For a one-sided test (testing if mean is greater than 5.5) at α = 0.05 with df = 99, critical t ≈ 1.660. Since t = 3.89 > 1.660, reject H₀ — customer ratings are significantly above neutral. The p-value is roughly 0.0001 — strong evidence that the average customer rates the product positively.

Frequently asked questions

When should I use a t-test instead of a z-test?

Use the t-test when the population standard deviation σ is unknown and you estimate it from the sample (s); use the z-test when σ is genuinely known (rare in practice) or when the sample size is very large (n ≥ 30+) so that s ≈ σ. The t-distribution has heavier tails than the normal to account for the extra uncertainty from estimating σ. For small samples the difference matters: at n = 5 (df = 4), a t-statistic of 2.0 gives p ≈ 0.116 (two-sided), while the corresponding z gives p ≈ 0.046 — qualitatively different conclusions. As n grows the t-distribution approaches the normal: at n = 30 they nearly coincide, and at n = 100 the difference is negligible. For modern practice, default to the t-test even with large samples — it is conservative and avoids any need to verify whether σ is truly known.

What is the difference between one-sided and two-sided t-tests?

A two-sided test (also called two-tailed) asks whether the sample mean differs from μ₀ in either direction; a one-sided test asks whether it differs in one specific direction. The two-sided test rejects H₀ when |t| exceeds a critical value, while the one-sided rejects only when t is extreme in the pre-specified direction. The one-sided test has more statistical power for that direction (effectively halves the p-value) but cannot detect deviations in the opposite direction. Use one-sided ONLY when a directional hypothesis was pre-specified before seeing the data, AND when an effect in the opposite direction would be of no interest or would still count as ‘no effect’. Deciding the direction after seeing the data is a form of p-hacking and doubles the true Type I error rate. When in doubt, use two-sided — it is the conservative default and what most journals expect.

What are the assumptions of the one-sample t-test?

Four assumptions: (1) random sampling from the population of interest — biased samples invalidate everything downstream; (2) independent observations — each data point contributes independently to the mean; (3) approximate normality of the underlying distribution, OR a large enough sample (n ≥ 30) for the Central Limit Theorem to make the sample mean approximately normal regardless of the data’s distribution; (4) the population SD is unknown (otherwise use z-test). Violations of normality matter more for small samples; with n < 15 use a normal-quantile plot to check, and if data is clearly non-normal use the Wilcoxon signed-rank test as a robust alternative. Heavy outliers can inflate s and pull x̄, distorting t; identify and investigate outliers before running the test. Paired data (before/after measurements on the same subjects) requires a paired t-test on the differences, not a one-sample t-test on each group.

What are the most common mistakes people make with t-tests?

The first is using sample SD without Bessel’s correction (dividing by n instead of n − 1), slightly underestimating spread and inflating t. The second is using the t-test on highly skewed data without checking the assumption of normality; for severely non-normal data with small samples, the Wilcoxon test is more reliable. The third is interpreting a non-significant result as evidence that the means are equal; statistical insignificance is absence of evidence for a difference, not evidence of absence. The fourth is using one-sample tests on data that should be paired (before/after, twin pairs, repeated measures); paired data requires a paired t-test. The fifth is reporting p without effect size or confidence interval; t-statistic and p alone hide the magnitude of the difference. The sixth is using a one-sided test post-hoc after seeing the direction of the data — a classic form of p-hacking. The seventh is conflating statistical significance with practical importance; with very large n even tiny differences become statistically significant.

When should I not use this calculator?

Skip it for two-group comparisons (independent samples) — use an independent-samples t-test or Welch’s t-test instead. Avoid it for paired data (same subjects measured twice) — use a paired t-test on the differences, which has different formulas and more statistical power than treating the data as independent. It is the wrong tool for non-parametric comparisons of severely skewed data or ordinal data — use the Wilcoxon signed-rank or sign test instead. Do not use it when n = 1 (no SD computable) or when the assumption of normality is badly violated and n is small. Skip it for comparing multiple groups (use ANOVA), categorical outcomes (use chi-square), or proportions (use a proportion test or binomial test). Finally, for industrial quality control with established control charts, the Shewhart and CUSUM charts integrate the t-test logic with sequential decision rules that account for repeated testing — a single t-test is not the right framework there.

Sources & references