Statistics & Probability

Hypothesis Test Calculator (t and z Tests)

One-sample or two-sample t-test or z-test: test statistic, p-value, critical value and decision.

Tool no.
ECT-P05
Rev
1.0
Updated
Oct 2026
Method
One-sample t and z tests
How to use this calculator

Enter the sample mean, standard deviation and size, the mean claimed by the null hypothesis μ₀, the direction of the alternative and the significance level α. Use the t-test when the standard deviation comes from the sample (the usual case) and the z-test only when the population σ is known.

Formulas

t statistic (σ unknown)t = x̄ − μ0s/√n, with n − 1 degrees of freedom
z statistic (σ known)z = x̄ − μ0σ/√n
Decisionreject H0 when the p-value ≤ α

Worked example

25 samples average 52 with s = 5. Is the mean different from 50 at α = 0.05? (the default)

  1. SE = 5/√25 = 1, so t = (52 − 50)/1 = 2.00 with 24 degrees of freedom.
  2. Two-tailed p = 2 P(T > 2.00) = 0.0569; the critical value is t0.025, 24 = 2.064.
  3. p > 0.05 (and 2.00 < 2.064), so fail to reject H0: not enough evidence that the mean differs from 50.

Frequently asked questions

Does “fail to reject” mean the null hypothesis is true?

No. It means the data are not strong enough to rule it out. A bigger sample might detect a difference this one could not.

One-tailed or two-tailed?

Use one tail only when the question asks about one direction before looking at the data (“is the mean greater than…”). Otherwise use two tails; a one-tailed p-value is half the two-tailed one.