t-test calculator for one-sample, two-sample (Welch or pooled) and paired tests, plus z-tests for a mean or proportion: p-value, critical value, decision.
Reject H₀ at α = 0.05. If the true mean were 500, a result at least this extreme would turn up with probability 0.0355. The p-value is not the probability that H₀ is true, and a significant result says nothing about how large or important the effect is.
p-value area under t with 11 df (unlabelled line: t = −2.395)
How it's calculated S
Hypotheses
H0:μ=500,H1:μ=500
Sample summary
xˉ=498.641667,s=1.964438,n=12
Standard error
SE=ns=121.964438=0.567084
Test statistic
t=0.567084498.641667−500=−2.395294,ν=n−1=11
p-value
p=2P(t≥∣−2.395294∣)=0.035527177
Decision
p≤α=0.05⇒reject H0
Equivalently, compare |t| with the critical value 2.201.
About the t-test and z-test calculator
A t-test divides the gap between a sample mean and a hypothesised value, or between two sample means, by its standard error. The ratio follows Student's t distribution with n − 1 degrees of freedom for one sample or for paired differences, n₁ + n₂ − 2 for the pooled two-sample test, and the Welch–Satterthwaite value when the variances may differ. With a known population σ the same ratio is a z statistic; the proportion test compares a sample proportion with p₀ the same way.
Quality checks, A/B tests and before-and-after studies are typical uses. The default data are 12 fill weights tested against a target of 500: the mean is 498.64, t = −2.395 on 11 df and the two-sided p = 0.0355, so the mean differs from 500 at α = 0.05.
The t-tests assume independent observations from roughly normal populations. Larger samples tolerate more skew, because the distribution of the sample mean approaches normal as n grows.
Checked against: Python statistics.mean/stdev for t; p-value from the A&S 26.7.3 closed form for odd ν (pyref.t_cdf_int); t₀.₉₇₅,₁₁ = 2.201 (t table)
Welch t from summary statistics
Test
Two-sample t-test, Welch (unequal variances)
Enter
Summary statistics
Sample 1 mean
20.1
Standard deviation s₁
3.2
Sample size n₁
15
Sample 2 mean
17.4
Standard deviation s₂
4.8
Sample size n₂
12
Hypothesised difference Δ₀
0
Alternative hypothesis
≠ (two-sided)
Significance level α
0.05
Test statistic
1.673611
Degrees of freedom
18.3865
p-value
0.111135
Checked against: Welch–Satterthwaite df in Python fractions; p-value by Gauss–Legendre quadrature of the t density (pyref.t_sf_numeric)
Pooled t on the same summaries
Test
Two-sample t-test, pooled variance
Enter
Summary statistics
Sample 1 mean
20.1
Standard deviation s₁
3.2
Sample size n₁
15
Sample 2 mean
17.4
Standard deviation s₂
4.8
Sample size n₂
12
Hypothesised difference Δ₀
0
Alternative hypothesis
≠ (two-sided)
Significance level α
0.05
Test statistic
1.749856
Degrees of freedom
25
p-value
0.09241
Checked against: Pooled variance in Python fractions; p-value from the A&S 26.7.3 closed form with ν = 25
Paired t, right-tailed
Test
Paired t-test
Enter
Raw data
Sample 1
142 138 150 145 160 155 139 148
Sample 2
136 135 146 144 150 149 138 141
Hypothesised difference Δ₀
0
Alternative hypothesis
> (right-tailed)
Significance level α
0.05
Test statistic
4.32649
Degrees of freedom
7
p-value
0.001726
Estimate
4.75
Checked against: Differences' mean and stdev in Python statistics; p-value from the A&S closed form with ν = 7
Questions
What does a p-value tell you?
It is the probability of a test statistic at least as extreme as the one observed, assuming the null hypothesis is true. For the default data p = 0.0355: if the true mean were 500, samples at least this far from 500 would turn up about 3.6% of the time. It is not the probability that H₀ is true and it does not measure effect size, as the American Statistical Association's 2016 statement on p-values stresses.
Should I use Welch's t-test or the pooled t-test?
Use Welch's test unless you have good reason to believe the variances are equal. It drops the equal-variance assumption and loses little power when the variances do match, while the pooled test's false-positive rate drifts from α when variances and group sizes both differ. On the worked example (s = 3.2 and 4.8, n = 15 and 12) Welch gives p = 0.111 on 18.4 df and the pooled test p = 0.092 on 25 df.
When should I use a paired t-test?
When each value in one sample is matched to one in the other: the same patients before and after treatment, or two instruments measuring the same parts. The test is a one-sample t-test on the differences, which removes the variation between subjects. In the paired worked example eight pairs differ by 4.75 on average, giving t = 4.33 on 7 df and a one-sided p of 0.0017.
What is the difference between a t-test and a z-test?
A z-test uses a known population standard deviation σ and the standard normal distribution; a t-test estimates σ from the sample and uses Student's t, whose heavier tails allow for that extra uncertainty. The two-sided 5% critical value is 1.960 for z, 2.201 for t with 11 df and 2.042 with 30 df. σ is rarely known in practice, so the t-test is the usual choice for means.
Should I use a one-tailed or two-tailed test?
Use a two-tailed test unless the direction was fixed before seeing the data and an effect in the other direction would be treated the same as no effect. A one-tailed test puts all of α in one tail, so its p-value is half the two-tailed one when the effect goes the predicted way: t = −2.395 on 11 df gives 0.0355 two-tailed and 0.0178 left-tailed. Picking the tail after looking doubles the real false-positive rate.
How accurate is the t-test and z-test calculator?
Accuracy depends on your inputs and the method's assumptions. Decimal arithmetic uses 50 significant digits, but estimates, numerical methods and source data can be less precise; the displayed rounding does not remove those limits. It is checked against 7 worked examples whose answers come from independent sources; for example, “One-sample t on fill weights (defaults)” is checked against Python statistics.mean/stdev for t; p-value from the A&S 26.7.3 closed form for odd ν (pyref.t_cdf_int); t₀.₉₇₅,₁₁ = 2.201 (t table).
Where does the method come from?
NIST/SEMATECH e-Handbook of Statistical Methods, §1.3.5.3 Two-sample t-test for equal means; NIST/SEMATECH e-Handbook, §7.2.2 Are the data consistent with the assumed process mean?; Welch, B. L. (1947). The generalization of Student's problem when several different population variances are involved. Biometrika 34, 28–35.