Quick answer
A one-sample t-test uses t = (x̄ − μ₀) ÷ (s ÷ √n) with df = n − 1. A mean of 52 against 50 with s = 2 and n = 2 gives t = 1.414, df = 1 and p = 0.3918.
Enter the sample mean, hypothesised mean, SD, sample size and test type. The calculator returns t, degrees of freedom, p-value and standard error.
Related tools: One-Sample Z-Test Calculator: Z-test for a mean with known population standard deviation. One-Way ANOVA Calculator: One-way analysis of variance across groups. P-Value Calculator: P-value from a z, t, chi-square or F statistic.
How to use the One-Sample T-Test Calculator
- Enter sample mean.
- Enter hypothesised mean.
- Enter sample standard deviation (s) (above 0).
- Enter sample size (a whole number, 2 or more).
- Choose test type: Two-tailed, Left-tailed and Right-tailed.
- Press Calculate to see the result, and use Reset to start again.
| Input | What to enter | Allowed values |
|---|---|---|
| Sample mean | A number | — |
| Hypothesised mean | A number | — |
| Sample standard deviation (s) | A number | > 0 |
| Sample size | A whole number | ≥ 2 |
| Test type | Choose one: Two-tailed; Left-tailed; Right-tailed | Starts at Two-tailed |
Formula and method
Formula
t = (x̄ − μ₀) ÷ (s ÷ √n), df = n − 1
IEEE-754 double precision; shown to at most 6 decimal places.
p-value from Student's t distribution (regularized incomplete beta).
Worked examples
These examples are verified: each one is an automated test case that the live calculator must reproduce exactly.
Example 1
Inputs: Sample mean = 52; Hypothesised mean = 50; Sample standard deviation (s) = 2; Sample size = 2; Test type = Two-tailed.
| Result | Value |
|---|---|
| t statistic | 1.414214 |
| Degrees of freedom | 1 |
| p-value | 0.391827 |
| Standard error | 1.414214 |
Example 2
Inputs: Sample mean = 52; Hypothesised mean = 50; Sample standard deviation (s) = 10; Sample size = 25; Test type = Two-tailed.
| Result | Value |
|---|---|
| t statistic | 1 |
| Degrees of freedom | 24 |
| p-value | 0.327287 |
| Standard error | 2 |
The first line is the headline result (t statistic). Below it the one-Sample T-Test Calculator lists degrees of freedom, p-value and standard error, which describe the same case from other angles. IEEE-754 double precision; shown to at most 6 decimal places.
Tiny samples
With n = 2 there is only 1 degree of freedom, so the t distribution has very heavy tails and even t = 1.414 is far from significant. It takes |t| > 12.7 to reach 5% significance at df 1.
Interpretation
A large p-value means the data are consistent with the hypothesised mean. The test assumes normality when n is small. n ≥ 2 is required.
How the result changes with sample mean
Holding every other input at the first worked example, this table changes only sample mean. It shows how sensitive the answer is to that one value; each row was produced by running this calculator.
| Sample mean | t statistic | Degrees of freedom | p-value |
|---|---|---|---|
| 26 | -16.970563 | 1 | 0.03747 |
| 52 | 1.414214 | 1 | 0.391827 |
| 104 | 38.183766 | 1 | 0.016669 |
| 208 | 111.722871 | 1 | 0.005698 |
What happens with invalid input
These messages are produced by the calculator itself, so you know what to fix.
- Sample size: entering "1" shows "Sample size must be at least 2." beside that field and no result.
Choosing between the One-Sample T-Test Calculator and similar calculators
Each row shows what a related calculator on this site asks for and what it returns, so you can pick the one that matches your question.
| Calculator | You enter | It returns |
|---|---|---|
| [One-Sample Z-Test Calculator](/statistics/z-test/) | sample mean, hypothesised mean and population σ | z statistic |
| [One-Way ANOVA Calculator](/statistics/anova-calculator/) | groups | F statistic |
| [P-Value Calculator](/statistics/p-value/) | test statistic, statistic value and test type | p-value |
| [T Statistic Calculator](/statistics/t-statistic/) | sample mean, hypothesised mean and sample standard deviation | t statistic |
| [Critical Value Calculator](/statistics/critical-value/) | distribution, significance level and tails | Critical value |
Background: hypothesis testing and inference
A hypothesis test compares a test statistic with what the null hypothesis predicts. The decision rule is to reject the null hypothesis when the p-value is at or below the significance level α, which you should choose before seeing the data (0.05 is conventional, not special). For a two-tailed z test the p-value is 2 × (1 − Φ(|z|)); for a one-sample t test the statistic is (x̄ − μ₀) ÷ (s ÷ √n) with n − 1 degrees of freedom.
Failing to reject the null hypothesis does not prove it true, and a statistically significant result can still be too small to matter in practice.
Assumptions and limitations
- n ≥ 2
If a required value is empty, not a number, or outside its allowed range, the form marks that field with a message and shows no result instead of a misleading number. The automated checks deliberately try invalid entries for sample size to confirm this.
Frequently asked questions
What is df here?
For a one-sample t-test the degrees of freedom are n − 1; the example with n = 2 has 1.
When use the t-test?
Use a t-test when the population standard deviation is unknown and estimated from the sample, which is the usual case.
What does p = 0.39 mean?
No evidence against the null.
What does the One-Sample T-Test Calculator calculate?
One-sample t-test from summary statistics. It returns t statistic, Degrees of freedom, p-value and Standard error.
What formula does the One-Sample T-Test Calculator use?
t = (x̄ − μ₀) ÷ (s ÷ √n), df = n − 1. p-value from Student's t distribution (regularized incomplete beta).
What do I need to enter in the one-Sample T-Test Calculator?
You enter Sample mean, Hypothesised mean, Sample standard deviation (s), Sample size and Test type.
How is the result rounded or limited?
IEEE-754 double precision; shown to at most 6 decimal places. n ≥ 2.
What does the “Test type” option change?
It sets how the one-Sample T-Test is worked out. The choices are Two-tailed, Left-tailed and Right-tailed.
What is an example of a one-Sample T-Test result?
With sample mean 52, hypothesised mean 50, sample standard deviation (s) 2, sample size 2 and test type Two-tailed, the t statistic is 1.414214.
Related calculators
- One-Sample Z-Test Calculator — Z-test for a mean with known population standard deviation.
- One-Way ANOVA Calculator — One-way analysis of variance across groups.
- P-Value Calculator — P-value from a z, t, chi-square or F statistic.
- T Statistic Calculator — t statistic from summary statistics.
- Critical Value Calculator — Critical values for z, t, chi-square and F distributions.
- Degrees of Freedom Calculator — Degrees of freedom for one- and two-sample t-tests.
Sources
- NIST/SEMATECH e-Handbook of Statistical Methods (itl.nist.gov/div898/handbook)
- Standard textbook definitions (e.g. Moore, McCabe & Craig, Introduction to the Practice of Statistics)
Content last reviewed 2026-11-04. Formulas and worked examples are checked by automated tests against independently computed values.