Skip to content
FiftyCalc Free calculators for all 50 states

Z-Test Calculator

Test cases replayed : 3 of 3 match · Methodology · No outside source listed

Enter the sample mean, the hypothesized mean, the known population standard deviation and the sample size.

Result

Sample figures

p-value—

z statistic —

Estimate for planning only, not tax, legal, financial or medical advice. This calculator uses the method explained on this page.

Z-Test Calculator

Sample mean (x̄): enter a number. Prefilled example: 103.

Hypothesized mean (μ₀): enter a number. Prefilled example: 100.

Population standard deviation (σ): enter 0 or more. Prefilled example: 15.

Sample size (n): enter 1 or more. Prefilled example: 50.

Alternative hypothesis

Alternative hypothesis: choose Left-tailed (μ < μ₀), Right-tailed (μ > μ₀) or Two-tailed (μ ≠ μ₀). Prefilled example: Two-tailed (μ ≠ μ₀).

How to use this calculator

Fill in the fields in this order; each step takes you to its field.

  1. Sample mean (x̄): enter a number.
  2. Hypothesized mean (μ₀): enter a number.
  3. Population standard deviation (σ): enter 0 or more.
  4. Sample size (n): enter 1 or more.
  5. Alternative hypothesis: choose Left-tailed (μ < μ₀), Right-tailed (μ > μ₀) or Two-tailed (μ ≠ μ₀).
  6. Read the result: p-value; the panel also shows z statistic.

How this calculator works

z = (x̄ − μ₀) ÷ (σ ÷ √n). The p-value is Φ(z) for a left-tailed test, 1 − Φ(z) for a right-tailed test and 2 × (1 − Φ(|z|)) for a two-tailed test, where Φ is the standard normal distribution function.

The z-test needs a known population σ; with a standard deviation estimated from the sample, use the t-test.

The formula

  1. Z=x̄−mu0σ÷n
  2. P={normcdf⁡(Z)if t=11−normcdf⁡(Z)if t=22×(1−normcdf⁡(|Z|))otherwise
Symbols used in the formula
SymbolMeaning
x̄Sample mean
mu0Hypothesized mean (μ₀)
σPopulation standard deviation
nSample size
tAlternative hypothesis (1: Left-tailed (μ < μ₀); 2: Right-tailed (μ > μ₀); 3: Two-tailed (μ ≠ μ₀))
Zz statistic
Pp-value
normcdf(x, m, s)the probability that a Gaussian variable with mean m and standard deviation s is at most x (mean zero and standard deviation one without m and s).

Worked example

Sample mean (x̄)103
Hypothesized mean (μ₀)100
Population standard deviation (σ)15
Sample size (n)50
Alternative hypothesisTwo-tailed (μ ≠ μ₀)
z statistic1.4142
  1. Z=103−10015÷50=1.41421
  2. P=2×(1−normcdf⁡(|1.41421|))=0.157299

p-value 0.1573

Each step uses the unrounded value of the step before it; figures on this page are rounded for display.

Frequently asked questions

When can I use a z-test?

When σ is known, or the sample is large and the data independent. Otherwise the t-test is the standard choice.

Is a sample mean of 103 different from 100 with σ = 15 and n = 50?

z = 1.4142 and the two-tailed p-value is 0.1573, so not at α = 0.05.

Questions answered

Related calculators