Probability Calculator Using Z-Interval
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 probability that a sample mean falls within a specified range, based on the standard normal (z) distribution. You enter the population mean, population standard deviation, sample size, and the lower and upper bounds of interest; you get back the z-scores for those bounds and the total probability between them. The result tells you how likely it is that a random sample of that size would produce a mean inside that interval.
Formula
The z-interval probability uses the standard normal distribution. For a sample mean, the z-score is calculated as:
z = (xÌ„ – μ) / (σ / √n)
Where:
- x̄ = the sample mean (or the bound you are testing), in the same units as the data
- μ = the population mean, in the same units
- σ = the population standard deviation, in the same units
- n = the sample size (number of observations)
- σ / √n = the standard error of the mean, in the same units
The probability that a sample mean lies between two bounds (L and U) is:
P(L ≤ x̄ ≤ U) = Φ(zU) − Φ(zL)
Where Φ is the cumulative distribution function of the standard normal distribution, and zL and zU are the z-scores for the lower and upper bounds. The calculator uses the standard normal table values (or the equivalent mathematical function) to convert those z-scores into probabilities.
Worked Example
Using the default values from the calculator above:
- Population mean (μ) = 100
- Population standard deviation (σ) = 15
- Sample size (n) = 30
- Lower bound = 95
- Upper bound = 105
First, calculate the standard error:
SE = σ / √n = 15 / √30 ≈ 15 / 5.477 ≈ 2.7386
Now compute the z-score for the lower bound:
zL = (95 − 100) / 2.7386 ≈ −5 / 2.7386 ≈ −1.83
And for the upper bound:
zU = (105 − 100) / 2.7386 ≈ 5 / 2.7386 ≈ 1.83
Looking up these z-scores in a standard normal table (or using the cumulative function):
- Φ(−1.83) ≈ 0.0336
- Φ(1.83) ≈ 0.9664
Subtract the lower from the upper:
Probability = 0.9664 − 0.0336 = 0.9328
So the probability is about 93.28%. That matches the calculator’s output for the default inputs.
When to Use a Z-Interval
Use this calculation when you know the population standard deviation and you are dealing with sample means, not individual data points. The z-interval is appropriate when:
- The sample size is large (typically n ≥ 30), thanks to the Central Limit Theorem, even if the population is not normally distributed.
- The population is normally distributed and the standard deviation is known, regardless of sample size.
- You are working with proportions, using the normal approximation to the binomial (with np ≥ 10 and n(1−p) ≥ 10).
If you do not know the population standard deviation and the sample size is small (n < 30), you should use a t-interval instead. The t-distribution accounts for the extra uncertainty from estimating σ with the sample standard deviation.
How to Read the Result
The probability output is a percentage between 0% and 100%. It represents the likelihood that a randomly selected sample of size n will have a mean within the interval you specified. For example, a result of 93.28% means that if you repeated the sampling process many times, about 93 out of every 100 samples would produce a mean between 95 and 105.
The z-scores themselves tell you how many standard errors the bounds are from the population mean. A z-score of 0 means the bound equals the mean. Positive z-scores are above the mean; negative ones are below. Most sample means (about 95%) fall within ±1.96 standard errors of the population mean, which is why the 95% confidence interval uses that value.
Common Mistakes and Misconceptions
One frequent error is mixing up the standard deviation of the population (σ) with the standard deviation of the sample (s). The formula requires the population standard deviation. If you only have the sample standard deviation, you cannot use this z-interval unless the sample size is large enough to treat it as a good estimate—but strictly, you should switch to a t-interval.
Another mistake is forgetting to divide σ by √n. The standard error shrinks as the sample size grows, so larger samples produce narrower intervals. Using σ alone instead of σ/√n will give z-scores that are too small and probabilities that are too high.
A common misconception is that this probability is a “confidence level� for a specific interval. It is not. The probability refers to the random sample mean, not to the population mean. The population mean is fixed; you are not saying there is a 93% chance that μ lies between 95 and 105. You are saying there is a 93% chance that the sample mean will land in that range.
Limits of the Z-Interval
The z-interval relies on the Central Limit Theorem, which works well for large samples but can be inaccurate for small samples from heavily skewed populations. If the population is extremely non-normal and n is small, the normal approximation may be poor. In those cases, nonparametric methods or exact tests may be more appropriate.
Also, this calculator assumes simple random sampling. If your data comes from a cluster sample, stratified sample, or has dependencies, the standard error formula changes. The z-interval also assumes independence between observations, which is violated in time-series data or repeated measures.
Finally, the z-interval is designed for the mean. If you are interested in a proportion, the formula is slightly different: you use √(p(1−p)/n) as the standard error, and you need to check the normal approximation conditions.
Frequently Asked Questions
What is the difference between a z-interval and a t-interval?
A z-interval uses the population standard deviation and is based on the standard normal distribution. A t-interval uses the sample standard deviation and the t-distribution, which has heavier tails to account for the extra uncertainty. Use a z-interval when σ is known or n is large; use a t-interval when σ is unknown and n is small.
Can I use this calculator for proportions?
Yes, if you treat the proportion as a mean of 0s and 1s. The population mean is p, the population standard deviation is √(p(1−p)), and the sample size is n. The z-score formula becomes z = (p̂ − p) / √(p(1−p)/n). The calculator works as long as you enter those values correctly.
What does “standard error� mean here?
The standard error is the standard deviation of the sampling distribution of the mean. It measures how much sample means vary from the population mean. It is calculated as σ/√n, and it decreases as the sample size increases, because larger samples give more precise estimates.
Why is my probability so high when I enter a wide interval?
That is expected. The wider the interval, the more likely a sample mean will fall inside it. If you set the lower bound far below the mean and the upper bound far above it, the probability approaches 100%. Conversely, a very narrow interval will give a low probability.
What if I only know the sample standard deviation, not the population one?
If the sample size is large (n ≥ 30), you can approximate the population standard deviation with the sample standard deviation, and the z-interval will be reasonably accurate. For small samples, use a t-interval instead, because the z-interval will underestimate the uncertainty.