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
p-value
z statistic
Estimate for planning only, not tax, legal, financial or medical advice. This calculator uses the method explained on this page.
This browser did not allow copying. The sentence is in the box below, already selected: copy it with your keyboard or the menu.
How to use this calculator
Fill in the fields in this order; each step takes you to its field.
- Sample mean (x̄): enter a number.
- Hypothesized mean (μ₀): enter a number.
- Population standard deviation (σ): enter 0 or more.
- Sample size (n): enter 1 or more.
- Alternative hypothesis: choose Left-tailed (μ < μ₀), Right-tailed (μ > μ₀) or Two-tailed (μ ≠ μ₀).
- 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
| Symbol | Meaning |
|---|---|
| Sample mean | |
| Hypothesized mean (μ₀) | |
| Population standard deviation | |
| Sample size | |
| Alternative hypothesis (1: Left-tailed (μ < μ₀); 2: Right-tailed (μ > μ₀); 3: Two-tailed (μ ≠ μ₀)) | |
| z statistic | |
| p-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 hypothesis | Two-tailed (μ ≠ μ₀) |
| z statistic | 1.4142 |
|---|
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.