Skip to content

One Sample T Test Calculator

Calculate one sample t test with instant, accurate results and clear step-by-step output.

By CalcGenius Editorial TeamLast reviewed August 28, 20253 min read
One-Sample T-Test Calculator
📊
Enter your values and click Calculate

About

The one-sample t-test compares the mean of a single sample to a hypothesized population mean μ₀. The test statistic t = (x̄ − μ₀) / (s / √n) follows Student's t-distribution with n − 1 degrees of freedom under the null hypothesis. A large |t| means the sample mean deviates from μ₀ more than would be expected by chance — leading to rejection of the null hypothesis that the true population mean equals μ₀.

The t-test is the small-sample analog of the z-test. Use it when the population standard deviation σ is unknown and must be estimated from the sample (the usual case). The t-distribution has heavier tails than the normal to account for the extra uncertainty in estimating σ — for small n, the critical t is much larger than the critical z. As n grows, t converges to z, and at n ≥ 30 the difference is negligible for most practical purposes.

The p-value is the probability of observing a t-statistic at least as extreme as the computed one, assuming the null hypothesis is true. A small p-value (typically < 0.05) means the observed deviation is unlikely under the null, leading to rejection. A large p-value means the data is consistent with the null — you fail to reject. The two-tailed p-value is twice the one-tailed, checking for any difference (sample mean ≠ μ₀); a one-tailed test checks only for a difference in a pre-specified direction.

The test rests on three assumptions: (1) the data is a simple random sample from the population of interest; (2) observations are independent — no subject is measured twice, no two observations influence each other; (3) the sampling distribution of the mean is approximately normal — guaranteed by the central limit theorem for n ≥ 30, or by approximate normality of the population for smaller n. For clearly non-normal small samples, the Wilcoxon signed-rank test is a non-parametric alternative.

Statistical significance is not the same as practical significance. A large sample can produce a tiny p-value for a trivially small effect; a small sample can produce a non-significant p-value for a real effect. Always report effect size alongside the p-value: Cohen's d = (x̄ − μ₀) / s gives the standardized mean difference. For d, the conventional benchmarks are 0.2 (small), 0.5 (medium), 0.8 (large). A small p with d < 0.2 may be statistically significant but practically meaningless.

How to Use

  1. 1
    Enter sample values
    Type the sample observations separated by commas (e.g., 5.1, 4.8, 5.3, 5.0, 4.9, 5.2, 5.1, 5.0). At least 2 values are required; more is better.
  2. 2
    Enter the hypothesized population mean μ₀
    Type the null hypothesis value — the mean you are testing against. Example: μ₀ = 5 to test if your sample is consistent with a population mean of 5.
  3. 3
    Set the significance level α
    Default 0.05 (95% confidence). Common values: 0.10, 0.05, 0.01. The calculator computes the critical t-value at this α.
  4. 4
    Read t-statistic, p-value, and decision
    The hero shows the t-statistic. Below: p-value, critical t, degrees of freedom, sample mean, sample standard deviation, and the reject / fail-to-reject decision at α.
  5. 5
    Check assumptions before reporting
    Verify the data is a random sample, observations are independent, and n ≥ 30 OR the population is approximately normal. For non-normal small samples, consider the Wilcoxon signed-rank test instead.

Formula

t-statistic:

t = (x̄ − μ₀) / (s / √n)
where x̄ = sample mean, μ₀ = hypothesized mean,
s = sample standard deviation (using ÷ (n − 1)), n = sample size

Degrees of freedom:

df = n − 1

Two-tailed p-value:

p = 2 × P(T ≥ |t|) where T ~ t_(df)
= I_x(df/2, 1/2), x = df / (df + t²)

Two-tailed critical value:

Reject H₀ if |t| > t*_(df, α/2)
t*_(df=10, α=0.05) = 2.228, t*_(df=30) = 2.042, t*_(df=∞) = 1.96

Cohen's d (effect size):

d = (x̄ − μ₀) / s (0.2 small, 0.5 medium, 0.8 large)

Worked Example

Example 1 — Bottling plant quality control:

  • Hypothesis μ₀ = 500 ml (target fill volume).
  • Sample (n = 10): 499.8, 500.1, 499.9, 500.2, 499.7, 500.0, 499.8, 500.3, 500.1, 500.0.
  • x̄ = 499.99 ml, s ≈ 0.197 ml, SE = 0.197 / √10 ≈ 0.0623.
  • t = (499.99 − 500) / 0.0623 ≈ −0.16. df = 9. t*(0.05, 9) ≈ 2.262.
  • |t| = 0.16 < 2.262 → fail to reject. p ≈ 0.876 — consistent with target.

Example 2 — Larger effect:

  • Same setup but sample mean = 499.5, s = 0.2, n = 10.
  • SE = 0.2 / √10 ≈ 0.0632. t = (499.5 − 500) / 0.0632 ≈ −7.91.
  • |t| = 7.91 > 2.262 → reject. p < 0.0001 — strong evidence the fill is off-target.

Example 3 — Small n, ambiguous result:

  • n = 4 sample, μ₀ = 100, sample = {99, 101, 98, 102}.
  • x̄ = 100, s ≈ 1.83, SE = 1.83 / √4 = 0.913. t = 0.
  • t = 0 → p = 1.0 (the sample mean exactly equals μ₀). Fail to reject — but with n = 4 the test has very low power.

Tips

  • Use the t-test when σ is unknown (the usual case). Use the z-test only when σ is known exactly — rare in practice. As n grows, t converges to z, so for n ≥ 30 the choice barely matters.
  • The two-tailed p-value is twice the one-tailed. Only use a one-tailed test if you pre-specified the direction before seeing the data — switching after the fact inflates the false-positive rate.
  • Degrees of freedom = n − 1 for a one-sample test. As df grows, the critical t shrinks toward 1.96 (the z-value at α = 0.05). At df = 30 the difference is negligible for most practical purposes.
  • Check normality for small samples (n &lt; 30). Use a histogram or a Q-Q plot. For clearly non-normal data, the Wilcoxon signed-rank test is a non-parametric alternative that does not require normality.
  • Report effect size alongside the p-value: Cohen&apos;s d = (x̄ − μ₀) / s. A small p-value with a tiny effect size may be statistically significant but practically meaningless — a distinction p-hacking obscures.

Common Mistakes

Warning

The most common mistake is using a one-tailed test after seeing the data — this inflates the false-positive rate. Pre-specify the direction before collecting data. A second error is using the t-test on heavily skewed or non-normal small samples (n < 30); use the Wilcoxon signed-rank test instead. A third error is treating "fail to reject" as "accept the null" — absence of evidence is not evidence of absence. A fourth is forgetting Bessel's correction: use ÷ (n − 1) for the sample standard deviation, not ÷ n. Finally, do not confuse statistical significance (small p) with practical significance (large effect) — always report effect size.

Frequently Asked Questions

What is a one-sample t-test?
A one-sample t-test compares the mean of a single sample to a hypothesized population mean μ₀. The test statistic t = (x̄ − μ₀) / (s / √n) follows Student&apos;s t-distribution with n − 1 degrees of freedom under the null hypothesis. A significant t (large |t| or small p-value) means the sample mean differs from μ₀ more than would be expected by chance.
When should I use a t-test instead of a z-test?
Use the t-test when the population standard deviation σ is unknown and must be estimated from the sample (the usual case). The t-distribution has heavier tails than the normal to account for the extra uncertainty. As n grows, t converges to z — for n ≥ 30 the difference is negligible. Use a z-test only when σ is known exactly, which is rare in practice.
How do I interpret the p-value?
The p-value is the probability of observing a t-statistic at least as extreme as the computed one, assuming the null hypothesis (sample mean = μ₀) is true. A small p-value (typically &lt; 0.05) means the observed deviation is unlikely under the null, so you reject the null. A large p-value means you fail to reject — the data is consistent with the hypothesized mean.
What are degrees of freedom in a t-test?
For a one-sample t-test, df = n − 1, where n is the sample size. The degrees of freedom determine the shape of the t-distribution: lower df means heavier tails (more uncertainty), higher df means the t converges to the standard normal. At df = 30 the t is nearly indistinguishable from z for most practical purposes.
What assumptions does the one-sample t-test make?
The one-sample t-test assumes (1) the data is a simple random sample from the population, (2) observations are independent, (3) the sampling distribution of the mean is approximately normal — guaranteed by the central limit theorem for n ≥ 30, or by approximate normality of the population for smaller n. For clearly non-normal small samples, consider a non-parametric test like the Wilcoxon signed-rank test.
What is the difference between one-tailed and two-tailed tests?
A two-tailed test checks for any difference (sample mean ≠ μ₀, either direction); the p-value is the probability of |t| being at least as large as observed. A one-tailed test checks for a difference in a specific direction (sample mean &gt; μ₀ or &lt; μ₀); the p-value is half the two-tailed value, but only if you pre-specified the direction. This calculator reports the two-tailed p-value, the conventional default.

One-sample t-test

The one-sample t-test compares a sample mean x̄ to a hypothesized population mean μ₀. The test statistic t = (x̄ − μ₀) / (s / √n) follows Student's t-distribution with n − 1 degrees of freedom under the null. A significant t (large |t|) means the sample mean differs from μ₀ more than chance alone would explain — reject the null.

Null hypothesis

The null hypothesis H₀ states that the population mean equals μ₀ (the hypothesized value). The alternative H₁ is that the mean differs from μ₀ (two-tailed) or differs in a specific direction (one-tailed). The test computes how unlikely the observed t would be if H₀ were true. Small p-values lead to rejection of H₀.

t-distribution

Student's t-distribution is similar to the standard normal but with heavier tails to account for the extra uncertainty of estimating σ from a small sample. As df grows, t converges to z — at df = 30 the difference is negligible. The critical value t* shrinks as df grows: t*(df=1, α=0.05) = 12.71; t*(df=10) = 2.228; t*(df=30) = 2.042; t*(df=∞) = 1.96.

p-value

The p-value is the probability of observing a t-statistic at least as extreme as the computed one, under the null. Small p (< α) means the observed deviation is unlikely under H₀ — reject H₀. Large p means the data is consistent with H₀ — fail to reject. The two-tailed p-value is twice the one-tailed p-value; this calculator reports the two-tailed p-value, the conventional default.

Selected t-statistics and their two-tailed p-values at various degrees of freedom. Lower df means heavier tails and larger critical t.
t-statisticdf = 1 p-valuedf = 10 p-valuedf = 30 p-valueDecision at α = 0.05
1.00.50000.34090.3253Fail to reject (all df)
2.00.29520.07340.0546df = 1: fail; df = 10: marginal; df = 30: reject
2.2280.24670.05000.0342df = 10: reject (boundary); df = 30: reject
2.50.18790.03140.0186Reject (df ≥ 10)
3.00.12470.01310.0056Reject (df ≥ 10)
4.00.07800.00300.0007Reject (all df)
Info

As degrees of freedom grow, the t-distribution converges to the standard normal. At df = 1 the critical t (α = 0.05, two-tailed) is 12.71 — a huge value reflecting the extreme uncertainty with one degree of freedom. By df = 10 it falls to 2.228, by df = 30 to 2.042, and by df = ∞ to 1.96 (the z value). This is why small samples need larger effects to reach significance.

Pro tip

Report effect size alongside the p-value: Cohen's d = (x̄ − μ₀) / s. Conventional benchmarks: d = 0.2 small, 0.5 medium, 0.8 large. A study with n = 1000 and d = 0.05 has p < 0.05 but is practically meaningless; a study with n = 20 and d = 0.8 may not reach p < 0.05 but is practically significant. The two together give the complete picture.

Authoritative References

  • Wikipedia — Student&apos;s t-test— wikipedia.org
    Comprehensive treatment of Student&apos;s t-test, including the one-sample, paired, and two-sample variants, the t-distribution, and assumptions about normality and independence.
  • Khan Academy — Hypothesis testing with t-tests— khanacademy.org
    Khan Academy unit on hypothesis testing with one-sample t-tests, with videos and exercises on computing the t-statistic and interpreting the p-value.
  • Stat Trek — T-Distribution— stattrek.com
    Stat Trek reference on the t-distribution with tables of critical values and worked examples of the one-sample t-test.

Try our other free calculators

CalcGenius has 1,200+ free, ad-free, browser-based calculators for finance, health, math, science, and everyday life. No sign-up required.

One Sample T Test Calculator — Mean, Variance & Confidence