Two-Tailed Test Z-Score Calculator & Guide
The calculator for this page is switched off while it is checked. The formula is below, and the worked example in the article shows how to use it by hand.
This calculator works out the z-score for a two-tailed hypothesis test. You enter the sample mean, population mean, standard deviation, and sample size, and it returns the z-score and the two-tailed p-value, which tells you whether to reject the null hypothesis at your chosen significance level.
Formula
The z-score for a sample mean is calculated as:
z = (x̄ − μ) / (σ / √n)
Where:
- x̄ = sample mean (what you observed)
- μ = population mean (what the null hypothesis claims)
- σ = population standard deviation (known)
- n = sample size
The two-tailed p-value is the probability of getting a z-score at least as extreme as the one observed, in either direction. It is computed as 2 × (1 − Φ(|z|)), where Φ is the standard normal cumulative distribution function.
Worked Example
Using the default values from the calculator above: sample mean = 105, population mean = 100, population SD = 15, sample size = 30.
- Calculate the standard error: SE = σ / √n = 15 / √30 = 15 / 5.477 = 2.7386
- Compute the z-score: z = (105 − 100) / 2.7386 = 5 / 2.7386 = 1.8257
- Find the one-tailed probability: Φ(1.8257) ≈ 0.9661, so the upper tail is 1 − 0.9661 = 0.0339
- Double it for two tails: p = 2 × 0.0339 = 0.0678
The calculator shows z = 1.826 and p = 0.0678. At the common α = 0.05 level, this p-value is greater than 0.05, so you would not reject the null hypothesis.
When to Use a Two-Tailed Z-Test
Use a two-tailed z-test when you want to know whether a sample mean is different from a population mean, without specifying a direction. This is the default choice in most research because it is more conservative than a one-tailed test—it requires stronger evidence to reach significance.
You need three conditions:
- The population standard deviation is known (if not, use a t-test instead).
- The sample is randomly drawn and independent.
- The sample size is large enough (n ≥ 30) or the population is normally distributed.
If you have a directional hypothesis (e.g., “the new drug increases scores”), a one-tailed test is more powerful but also more prone to Type I error if the direction is wrong. Most textbooks and journals prefer two-tailed tests to avoid bias.
How to Read the Results
The z-score tells you how many standard errors the sample mean is from the population mean. A z-score near 0 means the sample is consistent with the null hypothesis. A z-score far from 0 (say, beyond ±1.96 for α = 0.05) means the difference is unlikely to be due to chance.
The p-value is the probability of observing a sample mean at least as extreme as yours, assuming the null hypothesis is true. Compare it to your significance level (α):
- If p ≤ α, reject the null hypothesis (statistically significant).
- If p > α, fail to reject the null hypothesis (not statistically significant).
Common α levels: 0.05 (95% confidence), 0.01 (99% confidence), 0.10 (90% confidence). The critical z-values for two-tailed tests are ±1.96 for α = 0.05, ±2.576 for α = 0.01, and ±1.645 for α = 0.10.
Common Mistakes and Pitfalls
Several errors frequently trip up students and analysts:
- Using sample SD instead of population SD: The z-test requires the true population standard deviation. If you only have a sample SD, you must use a t-test, which accounts for extra uncertainty.
- Forgetting to divide by √n: The standard error shrinks as sample size grows. Using σ alone (without dividing by √n) inflates the z-score and leads to false significance.
- Confusing one-tailed and two-tailed p-values: A two-tailed p-value is exactly double the one-tailed value. If your software gives a one-tailed result, multiply by 2.
- Rounding too early: Rounding the standard error before computing the z-score can change the result. Keep at least 4 decimal places until the final step.
- Assuming normality for small samples: With n < 30 and a non-normal population, the z-test may be invalid. Use a nonparametric test or a t-test with caution.
Limitations of the Z-Test
The z-test is powerful but has real limitations:
- Requires known σ: In practice, you rarely know the population standard deviation. This is why t-tests are more common in real research.
- Assumes independence: If your sample is clustered or repeated measures, the standard error formula is wrong.
- Only tests means: For proportions, variances, or medians, you need different tests (z-test for proportions, chi-square, etc.).
- Large samples can overstate significance: With huge n, even trivial differences become statistically significant. Always consider effect size, not just p-value.
If you are unsure whether your data meets the assumptions, consult a statistician or use a t-test as a safer default.
Frequently Asked Questions
What is the difference between a z-test and a t-test?
A z-test assumes you know the population standard deviation, while a t-test estimates it from the sample. The t-test is more conservative for small samples. As sample size grows, the t-distribution approaches the normal distribution, so the results converge.
How do I find the critical z-value for a two-tailed test?
For α = 0.05, the critical values are ±1.96. For α = 0.01, they are ±2.576. You can find these from a standard normal table or using the inverse normal function: for α = 0.05, look up the z-score that leaves 0.025 in each tail.
Can I use this calculator for a one-tailed test?
No, this calculator is specifically for two-tailed tests. For a one-tailed test, you would halve the p-value (or use a one-tailed calculator). The z-score itself is the same; only the p-value changes.
What if my sample size is less than 30?
If the population is normally distributed, you can still use a z-test even with small n. If the population is not normal, the z-test may be unreliable. In that case, use a t-test or a nonparametric test like the Mann-Whitney U test.
Why is my p-value exactly 1.0000?
This happens when the sample mean equals the population mean, giving a z-score of 0. The two-tailed p-value is then 1.0, meaning the result is perfectly consistent with the null hypothesis. It does not mean the null hypothesis is true, only that there is no evidence against it.
What does a negative z-score mean?
A negative z-score means the sample mean is below the population mean. The p-value is the same as for the positive counterpart, because the two-tailed test considers both directions equally.
Related
Formula used
in xbar | Sample mean | - | 105 | 0 in mu | Population mean | - | 100 | 0 in sigma | Population SD | - | 15 | 0 in n | Sample size | - | 30 | 1 out z | Z-score | - | (xbar - mu) / (sigma / sqrt(n)) | 3 out p | Two-tailed p-value | - | 2 * (1 - normcdf(abs(z))) | 4
Each line is one input (in, sel, list) or one result (out: label, unit, formula, decimals). How the calculators work
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.