Z-Test Calculator

Z-Test Calculator

Perform one-sample, two-sample, and proportion z-tests with p-value computation. Test statistical hypotheses about means and proportions.

Last updated: March 2026

What is a Z-Test?

A z-test is a parametric statistical test used to determine whether a sample statistic differs significantly from a population parameter when the population standard deviation is known or the sample size is large. It converts data into a z-statistic and computes a p-value using the standard normal distribution.

Z-tests are used for: testing whether a sample mean equals a hypothesized population mean (one-sample), comparing means between two independent groups (two-sample), or testing whether a sample proportion equals a hypothesized proportion. This calculator supports all three scenarios with proper p-value computation.

The z-test assumes normally distributed data and known population standard deviations (or large samples where the t-distribution approximates normal). If these assumptions aren't met, consider using a t-test instead.

How to Perform Z-Tests

One-Sample Z-Test

Tests if a sample mean differs from a known population mean.

z = (x̄ − μ₀) / (σ / √n)

Two-Sample Z-Test

Compares means between two independent samples.

z = (x̄₁ − x̄₂) / √(σ₁²/n₁ + σ₂²/n₂)

Proportion Z-Test

Tests if a sample proportion differs from a hypothesized proportion.

z = (p̂ − p₀) / √(p₀(1−p₀)/n)

Interpretation

  • p-value < 0.05: Reject null hypothesis (significant result)
  • p-value ≥ 0.05: Fail to reject null hypothesis (not significant)
  • Two-tailed test: Tests for differences in both directions
  • Left-tailed: Tests if value is less than null hypothesis
  • Right-tailed: Tests if value is greater than null hypothesis

Worked Examples

One-Sample Example

Question: A company claims products average 500g. We test 36 units with mean 505g and σ=15g. Does this differ from 500g?

z = (505 − 500) / (15 / √36) = 5 / 2.5 = 2
This z-score has a p-value of 0.0455, which is < 0.05
✓ Significant: Products differ from claimed weight

Proportion Example

Question: In 100 trials, 55 succeeded. Is success rate significantly different from 50%?

z = (0.55 − 0.5) / √(0.5×0.5/100) = 0.05 / 0.05 = 1
This z-score has a p-value of 0.3173, which is ≥ 0.05
✗ Not significant: Difference could be due to chance

Two-Sample Example

Question: Group A mean = 52 (n=50, σ=8) vs Group B mean = 48 (n=50, σ=7). Is there a significant difference?

z = (52 − 48) / √(8²/50 + 7²/50) = 4 / √(2.24) ≈ 2.67
This z-score has a p-value ≈ 0.0074, which is < 0.05
✓ Significant: Groups differ meaningfully

Frequently Asked Questions

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

Use z-test when you know the population standard deviation. Use t-test when you only have sample standard deviation or small sample sizes. For large samples (n>30), both are similar.

What does p-value 0.05 mean in a z-test?

A p-value of 0.05 means there's a 5% chance of observing your results if the null hypothesis were true. It's the conventional threshold for statistical significance.

Can I use this calculator for all types of hypothesis tests?

This calculator handles one-sample, two-sample, and proportion z-tests. For other tests (ANOVA, chi-square), use specialized calculators.

What are left-tailed vs. right-tailed tests?

Left-tailed tests the alternative hypothesis that parameter < null value. Right-tailed tests parameter > null value. Two-tailed tests parameter ≠ null value (most common).

How is z-test different from confidence intervals?

Z-tests tell if a parameter is significantly different from a value (hypothesis testing). Confidence intervals estimate the range where the true parameter likely falls.

What sample size do I need for a z-test?

Z-tests work best with n>30 for the normal approximation to be accurate. For smaller samples with unknown population std dev, use t-test instead.

Related Tools