Hypothesis Testing Calculator

Run a one-sample z-test: enter your sample mean, the hypothesized population mean, the population standard deviation, and the sample size to get the z-statistic, p-value, and a reject / fail-to-reject decision.

Quick Facts

Formula
z = (x̄ − μ₀) / (σ / √n)
The p-value uses the standard normal CDF; reject H₀ when p < α.

Your Results

Calculated
z-statistic
-
(x̄ − μ₀) / (σ / √n)
p-value
-
Probability under H₀
Critical value
-
z at your α
Standard error
-
σ / √n

Ready

Enter your sample statistics and run the test.

The one-sample z-test formula

This calculator runs a one-sample z-test, the standard procedure for deciding whether a sample mean is consistent with a hypothesized population mean when the population standard deviation is known. The test statistic is:

z = (x̄ − μ₀) / (σ / √n)

Here is the observed sample mean, μ₀ is the value claimed by the null hypothesis (H₀: μ = μ₀), σ is the known population standard deviation, and n is the sample size. The denominator σ / √n is the standard error of the mean — the standard deviation of the sampling distribution of x̄. The z-statistic simply counts how many standard errors separate your sample mean from the hypothesized mean.

Turning z into a p-value

Because the sampling distribution of x̄ is normal (either because the population is normal, or by the Central Limit Theorem when n is large), the standardized statistic z follows the standard normal distribution N(0, 1) under H₀. The p-value is read off that distribution using Φ, the standard normal cumulative distribution function:

  • Two-tailed (Hₐ: μ ≠ μ₀): p = 2 · [1 − Φ(|z|)]
  • Right-tailed (Hₐ: μ > μ₀): p = 1 − Φ(z)
  • Left-tailed (Hₐ: μ < μ₀): p = Φ(z)

You reject the null hypothesis when p < α, where α is your chosen significance level (the tolerated probability of a false positive, or Type I error).

Critical values you should recognize

Equivalently, you can compare |z| against a critical value. For a two-tailed test the standard critical values are 1.645 (α = 0.10), 1.960 (α = 0.05), and 2.576 (α = 0.01). For a one-tailed test they are 1.282, 1.645, and 2.326 respectively. If |z| exceeds the critical value, the result is significant — the same conclusion the p-value gives.

A worked example

Suppose a standardized test has a known σ = 15. A class of n = 36 students scores a mean of x̄ = 103, and you want to know whether that beats the national average μ₀ = 100. The standard error is 15 / √36 = 15 / 6 = 2.5, so z = (103 − 100) / 2.5 = 1.20. A two-tailed p-value is 2 · [1 − Φ(1.20)] ≈ 2 · (1 − 0.8849) ≈ 0.230. Since 0.230 > 0.05, you fail to reject H₀: the 3-point difference is not statistically significant with this sample.

Frequently Asked Questions

When should I use a z-test instead of a t-test?
Use a z-test when the population standard deviation σ is known and either the population is normally distributed or the sample is large enough (n ≥ 30) for the Central Limit Theorem to apply. If σ is unknown and you estimate it from the sample standard deviation s, use a one-sample t-test with n − 1 degrees of freedom. For large samples the t-distribution converges to the normal, so the two tests give nearly identical answers.
What does the p-value actually mean?
The p-value is the probability of getting a sample mean at least as extreme as the one you observed, assuming the null hypothesis is true. It is not the probability that H₀ is true, and it does not measure the size of the effect. A tiny p-value with a huge sample can accompany a difference too small to matter in practice, so always report the effect size alongside the p-value.
One-tailed or two-tailed?
Use a two-tailed test when you care about a difference in either direction (μ ≠ μ₀) — this is the safe default. Use a one-tailed test only when you have a directional hypothesis decided before seeing the data (for example, "the new process is faster"). A one-tailed test puts all of α in one tail, making it easier to reach significance in that direction but blind to effects in the other.
What does "fail to reject" mean — did I prove H₀?
No. Failing to reject the null hypothesis means your data did not provide strong enough evidence against it; it does not prove the null is true. Absence of evidence is not evidence of absence. A larger sample, which shrinks the standard error σ/√n, might reveal a real difference that a small sample could not detect.