Interactive module guide
Two Sample Z-Test Calculator & Guide
A two sample z-test compares the means of two independent numerical populations when both population standard deviations are known from information external to the samples.
It tests a pre-specified mean difference, implemented here as zero.
This condition is uncommon: large samples do not turn sample standard deviations into known population values, and an independent two sample t-test is normally used when either σ must be estimated.
Free · No sign-up · Calculations stay in your browser
Is this the right module for my question?
Use it when
- Use the procedure for two independently sampled or independently assigned groups, a numerical outcome, and genuinely known σ₁ and σ₂ that apply to the current populations. Each row should belong to one group only.
- Choose a two-sided alternative for any difference, a right-sided alternative when μ₁−μ₂>0 is the planned claim, or a left-sided alternative when μ₁−μ₂<0 is planned. The order of samples determines the direction.
- Normal populations support the exact reference. With sufficiently informative independent samples, a normal approximation for the difference in means may be reasonable under finite-variance conditions, but process skew, dependence, and outliers still require review.
Choose another method when
- Do not use this test for the same subjects measured twice; pairwise dependence should be modeled with a paired test. Do not use it for proportions merely because a normal approximation is familiar.
- Avoid supplying sample standard deviations in the population-standard-deviation fields. That discards estimation uncertainty and can yield p-values that are too small.
Interactive tool
The calculator loads as you approach this section so the guide remains fast on mobile connections.
How to read the result
Interpret the sign relative to Sample 1 minus Sample 2 and report both sample means so the direction is transparent. The z magnitude shows how large the difference is relative to its known standard error.
A rejection supports evidence for the stated directional or two-sided alternative at α; it does not measure practical value or establish causation without a randomized design. Failure to reject leaves the difference unresolved rather than demonstrating equality.
Inputs and parameter meaning
Enter raw values for Sample 1 and Sample 2, keeping units and inclusion rules consistent. The calculator derives each mean and sample size; unequal sample sizes are permitted.
Enter σ₁ and σ₂ as known individual-level population standard deviations. The standard error is sqrt(σ₁²/n₁+σ₂²/n₂). Swapping samples changes the sign of z but not a correctly computed two-sided p-value.
Set alpha and tail before calculation. If lower outcomes are better in the application, “greater” is not automatically “better”; write the directional parameter claim in symbols to prevent a sign error.
Formula, hypotheses, and assumptions
Conditions to review
- Population standard deviations are known
- Samples are randomly selected
- Populations are normally distributed or n₁, n₂ ≥ 30
Calculator parameters
- Significance Level (α): default 0.05.
- Population Std Dev 1 (σ₁): default 1.
- Population Std Dev 2 (σ₂): default 1.
- Test Type: default Two-tailed.
What the method is doing
The null implemented is H₀:μ₁−μ₂=0. The numerator x̄₁−x̄₂ measures the observed difference, and the denominator combines independent known-variance contributions. Covariance would be needed if samples were paired or otherwise related.
Under H₀ and the normal model, z follows the standard normal distribution. The p-value is a tail probability for statistics at least as extreme under H₀, not the probability that the groups have equal means or that randomization failed.
Worked example: two calibrated production lines
Two independent calibrated lines produce the same component. Historical validation supplies σ₁=3 grams and σ₂=4 grams. Samples are Line 1: 101, 103, 100, 102, 104 and Line 2: 98, 100, 99, 101, 97. A two-sided comparison at α=0.05 was planned.
- 1Enter the two samples and known standard deviations. The sample means are 102 and 99 grams, so the observed difference is 3 grams.
- 2The known standard error is sqrt(3²/5+4²/5)=sqrt(5)≈2.236. Therefore z≈1.342 and the two-sided p-value is around 0.18.
- 3Because p exceeds 0.05, the test fails to reject equal population means. The three-gram observed gap is not sufficiently extreme relative to the known variability and small sample sizes.
Interpretation
The experiment provides insufficient evidence, at the planned threshold, that the two line means differ. It does not show the lines are equivalent and does not assess whether a three-gram difference is operationally acceptable. The external σ values and independence between sampled units must remain applicable.
Common mistakes
- Calling two groups independent because they are stored in separate columns is not enough. Matching, shared batches, repeated operators, or common time shocks create dependence.
- Switching sample order while keeping a directional alternative unchanged reverses the hypothesis. Write μ₁−μ₂ explicitly.
- Known σ values from an obsolete process or different population are not known for the current comparison. Their provenance belongs in the report.
Limits and independent validation
The output does not provide a confidence interval, equivalence test, power calculation, or adjustment for covariates and clustering. It assumes the supplied population spreads are fixed.
The procedure compares means only. Different variances, shapes, or tails may matter even when mean evidence is weak.
Before using the result
- Confirm independent assignment or sampling, comparable measurement, and the external source of σ₁ and σ₂. Plot each group and review time or batch order.
- Recompute both means, the combined known standard error, z, and the appropriate normal tail independently. State sample order, test direction, α, and the limited conclusion.
- Perform a provenance audit for each population standard deviation: name the dataset or calibration that supplied it, its measurement conditions, and the date or process version it represents. Repeat the calculation with plausible alternative spread values to show how strongly the conclusion depends on treating those quantities as fixed and transportable.
Related modules and resources
See every option in the Statistical Hypothesis Test Calculator or review the DistriScope methodology. Educational information; last reviewed 2026-08-06. Verify consequential calculations independently.