Z-Test Calculator

Perform one-sample, two-sample, and proportion z-tests online. Calculate z statistic, p-value, confidence intervals, and compare against critical values.

About the Z-Test Calculator

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 (comparing process means to standards), epidemiology (comparing disease rates), political polling (comparing candidate support), A/B testing (comparing conversion rates), and introductory statistics courses where students learn hypothesis testing concepts. Check the example with realistic values before reporting. Use the steps shown to verify rounding and units. Cross-check this output using a known reference case. Use the example pattern when troubleshooting unexpected results. Validate that outputs match your chosen standards.

Why Use This Z-Test Calculator?

While the t-test is more commonly used in practice, the z-test is essential for proportion testing, large-sample inference, and cases where the population standard deviation is known. This calculator handles both mean-based and proportion-based z-tests, provides all three p-value variants (left, right, two-tailed), and includes a critical value reference table for quick interpretation.

How to Use This Calculator

  1. Select the z-test type: one-sample mean, two-sample means, one proportion, or two proportions.
  2. Enter the relevant statistics (means, standard deviations, proportions, sample sizes).
  3. Choose the tail direction for the alternative hypothesis.
  4. Set your significance level alpha.
  5. Review the z statistic and p-value.
  6. Check the confidence interval for the difference.
  7. Compare your z to common critical values in the reference table.

Formula

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)

Example Calculation

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.

Tips & Best Practices

Z-Test vs T-Test: A Practical Guide

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 Tests in Practice

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.

Multiple Z-Tests and Error Control

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.

Frequently Asked Questions

When should I use a z-test vs a t-test?

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.

What is the normal approximation for proportions?

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.

What are the common critical z-values?

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.

Can I use a z-test for small samples?

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.

What is the pooled proportion in the two-proportion test?

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.

How do I interpret the confidence interval?

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).

Related Pages