One-Sample t-Test Calculator

StatisticsLast updated: August 22, 2026

The one-sample t-test examines whether the mean of a single group differs significantly from a predetermined reference value (μ₀). It is the test that decides whether a class average departs from the national average, whether the mean weight of manufactured parts departs from the nominal value, or whether the mean score on a scale departs from its theoretical midpoint.

The calculator works with raw data as well as with summary statistics alone (x̄, s, n). It reports the t statistic, the degrees of freedom, the p-value for the direction you select, the critical t, the difference between the means with its confidence interval, and the Cohen d effect size with its label; the shaded t curve shows visually where you stand relative to the rejection region.

If you enter raw data, descriptive measures, a box plot, and a normality check are produced as well.
You can write the numbers separated by commas or spaces, or one per line. A comma may be used as the decimal separator (3,14).
The theoretical value, standard, or target the mean is compared with.
A directional hypothesis should be chosen only if the direction of the difference can be justified in advance.
Sets the false positive risk. In the social sciences 5% is the common choice.
The probability that the interval covers the true parameter.

One-Sample t-Test Formulas

Hypotheses:        H₀: μ = μ₀   ·   H₁: μ ≠ μ₀ (two-tailed)
Standard error:    SE = s / √n
Test statistic:    t = (x̄ − μ₀) / SE
Degrees of freed.: df = n − 1
Confidence int.:   (x̄ − μ₀) ± t₍₁−α/₂; df₎ · SE
Effect size:       d = (x̄ − μ₀) / s
Critical value:    two-tailed ±t₍₁−α/₂₎ · one-tailed t₍₁−α₎

Cohen d thresholds: 0.20 small · 0.50 medium · 0.80 large. The p-value is taken from one or both tails of the t distribution, depending on the hypothesis direction you select.

How to Calculate

  1. Paste your raw data, or switch to summary statistics mode and enter x̄, s, and n.
  2. Enter the test value (μ₀) the mean will be compared with: a benchmark score, a nominal value, or a theoretical midpoint.
  3. Set the hypothesis direction; if you cannot justify a direction in advance, stay with the two-tailed option.
  4. Choose the significance level (α) and the confidence level; α = 0.05 and 95% are the most common choices in the literature.
  5. Read the t value, the degrees of freedom, and the p-value together with the decision line, and see on the shaded t curve whether t falls inside the rejection region.
  6. Report the confidence interval for the difference and the Cohen d value: significance alone says nothing about the size of the effect.

Worked Examples

Exam scores from raw data

The 12 students have a mean of 73.58 and a standard deviation of 3.75. The standard error is 1.08, so t = 3.308 and, with df = 11, p = 0.007; because that falls below the α = 0.05 threshold, H₀ is rejected. The mean difference is 3.58 units, the 95% confidence interval for the difference runs from 1.20 to 5.97, and Cohen d = 0.955 points to a large effect.

t statistic: 3.3077 · Degrees of freedom (df): 11 · p-value: p = 0.007

One-tailed test from summary statistics

For x̄ = 78, s = 12, and n = 30 the standard error is 2.19; this gives t = 1.369 with df = 29. In a right-tail test p = 0.091, so H₀ cannot be rejected at the α = 0.05 level. The 95% confidence interval for the difference runs from -1.48 to 7.48 and therefore includes zero; Cohen d = 0.250 is a small effect.

t statistic: 1.3693 · Degrees of freedom (df): 29 · p-value: p = 0.091

A non-significant production check

The 10 packages have a mean of 500.00 grams and a standard deviation of 1.83 grams. Because the difference is exactly 0, t = 0.000 and p = 1.000; H₀ cannot be rejected and production is treated as not departing from the nominal value. The 95% confidence interval for the difference runs from -1.31 to 1.31 grams.

t statistic: 0.0000 · Degrees of freedom (df): 9 · p-value: p = 1.000

Frequently Asked Questions

What is the difference between a one-sample t-test and a z-test?
Both tests compare a mean with a theoretical value; they differ in where the standard deviation comes from. If the population standard deviation σ is known, the z-test is used; if it is unknown and estimated from the sample, the t-test is used. Because of that estimation uncertainty the tails of the t distribution are heavier; as n grows the two tests give practically the same result.
Should I choose a two-tailed or a one-tailed test?
If you cannot justify the direction of the difference on theoretical grounds before collecting data, choose the two-tailed test; that is the default in the literature. A one-tailed test is more powerful at the same α, but it cannot detect a difference in the opposite direction no matter how large it is. Changing the direction after seeing the data artificially shrinks the p-value and cannot be reported.
The result is significant but Cohen d is small; how should I interpret that?
The p-value tells you whether a difference exists, while Cohen d tells you how large it is. In large samples even a very small difference can come out significant; in that case the finding may be statistically significant yet practically unimportant. This is why the p-value, the effect size, and the confidence interval should be reported together.
What should I do if the normality assumption is violated?
If the sample is small (n < 30) and the Q-Q plot together with the Shapiro–Wilk test show a marked departure, the p-value of the t-test loses its reliability. In that case consider a nonparametric alternative such as the Wilcoxon signed-rank test, or a data transformation (logarithm, square root). You should also check whether any outliers are measurement errors.
How do I get the same result in SPSS and Excel?
In SPSS, follow Analyze → Compare Means → One-Sample T Test and type μ₀ into the Test Value box; the t, df, and Sig. (2-tailed) values in the output match the results here. In Excel the T.TEST function does not work directly for a single sample; compute t by hand and obtain the p-value with T.DIST.2T(|t|, df). In R, t.test(x, mu = 70) produces the same output.
What does it mean if the confidence interval includes zero?
If the two-sided confidence interval for the difference includes zero, the two-tailed test at the corresponding confidence level cannot reject H₀. If the interval lies entirely on one side of zero, the difference is significant in that direction. The width of the interval also shows how precise the estimate is: a wide interval means the sample is not large enough to pin the result down.
Can I use this test on pretest–posttest data?
Not directly; two measurements taken from the same people are not independent. The correct method is the paired samples t-test. Even so, if you paste the difference scores (post − pre) into the one-sample mode and test them against μ₀ = 0, you get exactly the same result as the paired t-test; the two tests are mathematically identical.