Skip to content

One-Sample T-Test Calculator

Paste one column of numbers and the value you are testing against…

Paste one column of numbers and the value you are testing against, such as a label’s 500 g, to see whether the true mean could be that value.

Enter

Read 12 values; left out the header row (“Box weight (g)”).

More optionsTwo-sided, 95% confidence
Hypothesis
Confidence level

The significance level is 1 − the confidence level (0.05 at 95%).

ExampleP-value

0.0335

The mean is 498.475 (95% CI 497.1 to 499.9), 1.525 below 500. Significant at the 5% level (p < 0.05).

Paste your own numbers to test them.

Box weight (g) n = 12μ₀ = 500

Every value is a dot; the bar under the diamond is the mean’s confidence interval. Drag the target line to test another value.

The distribution the statistic follows if there were no difference; the shaded area beyond it is the p-value.

t, df
−2.4283, 11
Cohen’s d (Hedges g)
−0.701 (−0.652)
Mean, 95% CI
498.475 [497.1 to 499.9]
How this works: 9 sources,

How this works

Method

A one-sample t-test checks a sample’s mean against a fixed value: a label’s 500 g, a target response time, last year’s average, a published norm. In the example, twelve cereal boxes weighed 498.5 g on average, 1.5 g under the label. The test asks whether a shortfall that size could easily come from twelve boxes of a process that really averages 500 g. Full method

How it’s tested

2 worked examples for this page are checked by automated tests before every release: given the inputs, the tool must show the expected answer.

Privacy

On your device. Nothing you enter or open leaves this browser. About privacy labels

Changes

  • First published: live curves with draggable cut-offs, and tests on pasted data (t-tests, ANOVA, chi-square, Fisher’s exact, correlation, regression, A/B), checked against SciPy.

Every change on What’s new

How we make toolsReport a mistake

How the one-sample t-test works

A one-sample t-test checks a sample’s mean against a fixed value: a label’s 500 g, a target response time, last year’s average, a published norm. In the example, twelve cereal boxes weighed 498.5 g on average, 1.5 g under the label. The test asks whether a shortfall that size could easily come from twelve boxes of a process that really averages 500 g.

It divides the distance from the target by the standard error of the mean: t = (x̄ − μ₀) ÷ (s ÷ √n), with n − 1 degrees of freedom. With these boxes the standard error is about 0.6 g, so 1.5 g is about 2.4 standard errors away, and p is about 0.03. Drag the target line on the plot to see how the answer changes for other values: everything inside the confidence interval would not be rejected.

That link between the test and the interval is worth using. The 95% confidence interval for the mean contains exactly the target values a two-sided test at 5% would not reject, and it says more: here the true average is likely between 497.1 and 499.9 g, which a buyer may or may not care about.

t = (x̄ − μ₀) ÷ (s ÷ √n), df = n − 1 · CI = x̄ ± t* × s ÷ √n

How wide the 95% interval is, in standard deviations

The critical t value and the 95% margin of error of a mean as a multiple of the sample standard deviation, by sample size (t* ÷ √n).

The critical t value and the 95% margin of error of a mean as a multiple of the sample standard deviation, by sample size (t* ÷ √n).
Sample sizedft*Margin (× SD)
2112.706±8.985
324.303±2.484
433.182±1.591
542.776±1.242
652.571±1.049
872.365±0.836
1092.262±0.715
12112.201±0.635
15142.145±0.554
20192.093±0.468
Show all 14 rows
30292.045±0.373
50492.01±0.284
100991.984±0.198
1,0009991.962±0.062

Common questions

What value should I test against?

The one you care about before seeing the data: a specification, a label, a target, a known population mean. Testing against a value chosen after looking at the data makes the p-value meaningless.

Can I run it with only two values?

Yes, the test works from n = 2, but with one degree of freedom the critical t is 12.7, so only a huge difference reaches significance. The table above shows how quickly the interval narrows as n grows.

What if every value is the same?

Then there is no spread and the standard error is zero, so the t statistic is undefined; the page says so instead of giving a fake p-value. The mean is simply that value.