Perform one-sample, two-sample, and proportion z-tests online. Calculate z statistic, p-value, confidence intervals, and compare against critical values.
The z-test is a fundamental hypothesis test used when the population standard deviation is known or sample sizes are large enough for the normal approximation. It compares sample statistics to hypothesized population parameters using the standard normal distribution.
This calculator supports four z-test variants: one-sample mean test, two-sample mean comparison, one-proportion test, and two-proportion comparison. Enter your data, select the test type and tail direction, and get the z statistic, p-value, confidence interval, and a comparison against critical values at multiple significance levels.
Z-tests are foundational in quality control, epidemiology, political polling, A/B testing, and introductory statistics courses where students learn hypothesis testing concepts.
While the t-test is more common when sigma is estimated from the sample, the z-test is still the right tool for proportion tests, large-sample inference, and settings where the population standard deviation is known. This calculator keeps the mean-based and proportion-based versions together so you can compare the statistic, p-value, and critical value without switching tools.
One-Sample Z-Test: z = (x̄ − μ₀) / (σ / √n) Two-Sample Z-Test: z = (x̄₁ − x̄₂) / √(σ₁²/n₁ + σ₂²/n₂) One-Proportion Z-Test: z = (p̂ − p₀) / √(p₀(1−p₀)/n) Two-Proportion Z-Test: z = (p̂₁ − p̂₂) / √(p̂(1−p̂)(1/n₁ + 1/n₂)) p̂ = (x₁ + x₂) / (n₁ + n₂) (pooled proportion)
Result: z = 1.4142, p = 0.1573 (two-tailed)
Testing whether a sample mean of 103 differs from μ₀ = 100, with σ = 15 and n = 50, gives z = 1.41. The two-tailed p-value of 0.157 exceeds 0.05, so we fail to reject H₀. The 95% CI for the difference is [−1.16, 7.16], which includes zero.
In textbooks, the z-test requires knowing σ. In practice, σ is rarely known, making the t-test the default. The main exceptions are: proportion tests (which naturally use z), quality control with established process parameters, and large-sample situations where t ≈ z. For sample sizes above 120, the t and z distributions are virtually indistinguishable.
Proportion z-tests are heavily used in A/B testing (web conversion rates), political polling (candidate support), epidemiology (disease prevalence), and clinical trials (treatment success rates). The two-proportion test determines whether two groups have different success rates. For important decisions, supplement with confidence intervals for the difference, odds ratios, and relative risk.
Running multiple z-tests on the same data inflates the familywise error rate, just like with t-tests. If comparing multiple proportions, consider the chi-square test of homogeneity or apply Bonferroni correction. For A/B tests with multiple variants, sequential testing methods or Bayesian approaches can be more appropriate.
Last updated:
Use a z-test when the population standard deviation (σ) is known, or for proportion tests. Use a t-test when σ is estimated from the sample. For large samples (n > 30), the results are nearly identical because the t-distribution approaches the normal.
The z-test for proportions assumes the sampling distribution of p̂ is approximately normal, which requires np₀ ≥ 10 and n(1−p₀) ≥ 10. For small samples or extreme proportions, use an exact binomial test instead.
For two-tailed tests: z* = 1.645 (90% CI), 1.960 (95%), 2.326 (98%), 2.576 (99%), and 3.291 (99.9%). For one-tailed tests, use the same values at double the alpha level.
The z-test assumes you know σ and that the sampling distribution is normal. For small samples from non-normal populations, neither may hold. The t-test with unknown σ is almost always more appropriate for small-sample inference.
Under H₀ (both proportions are equal), the best estimate of the common proportion is the pooled proportion: p̂ = (x₁ + x₂)/(n₁ + n₂), where x₁ and x₂ are the counts of successes. This is used in the standard error calculation.
The confidence interval gives the range of plausible values for the true parameter difference. If it includes zero, the difference is not significant at that confidence level. Wider intervals indicate less precision (smaller samples or more variability).