Z-Test Calculator
Perform a one-sample z-test or two-proportion z-test. Calculate z-statistics, p-values, and confidence intervals when the population standard deviation is known. Related tools: T-Test Calculator, Normal Distribution Calculator, and P-Value Calculator.
How to Use the Z-Test Calculator
The z-test is a hypothesis test used when the population standard deviation is known or when comparing proportions from large samples. The one-sample z-test compares a sample mean to a known population mean using the known population standard deviation. The two-proportion z-test compares proportions from two independent groups to determine if they differ significantly.
For the one-sample test, enter the sample mean, population mean (null hypothesis value), population standard deviation, and sample size. For the two-proportion test, enter each group's observed proportion and sample size. Select the tail type based on your alternative hypothesis and click Calculate.
The z-test is appropriate when: (1) the population standard deviation σ is known (one-sample), (2) sample sizes are large enough for the normal approximation (np ≥ 5 and n(1-p) ≥ 5 for proportions), and (3) observations are independent. When σ is unknown, use the t-test instead.
Formula
One-Sample Z-Test:
z = (x̄ - μ₀) / (σ / √n)
Two-Proportion Z-Test:
z = (p̂₁ - p̂₂) / √(p̂(1-p̂)(1/n₁ + 1/n₂))
where p̂ = (x₁ + x₂) / (n₁ + n₂) is the pooled proportion
Confidence Interval (one-sample):
CI = x̄ ± z*(α/2) × (σ / √n)
Confidence Interval (proportions):
CI = (p̂₁ - p̂₂) ± z*(α/2) × √(p̂₁(1-p̂₁)/n₁ + p̂₂(1-p̂₂)/n₂)
Example Calculation
A factory claims mean widget weight is 50g (σ = 5g). A sample of 36 widgets has mean 52g. Test at α = 0.05:
Given: x̄ = 52, μ₀ = 50, σ = 5, n = 36
SE = σ/√n = 5/√36 = 5/6 = 0.8333
z = (52 - 50) / 0.8333 = 2.400
p-value (two-tailed) = 2 × P(Z > 2.4) = 2 × 0.0082 = 0.0164
Since p = 0.0164 < α = 0.05, reject H₀
95% CI: [52 - 1.633, 52 + 1.633] = [50.367, 53.633]
Conclusion: The mean weight significantly differs from 50g.
Z Critical Values Reference Table
| α (significance) | z (one-tailed) | z (two-tailed) |
|---|---|---|
| 0.10 | 1.282 | 1.645 |
| 0.05 | 1.645 | 1.960 |
| 0.025 | 1.960 | 2.240 |
| 0.01 | 2.326 | 2.576 |
| 0.005 | 2.576 | 2.807 |
| 0.001 | 3.090 | 3.291 |
| 0.0005 | 3.291 | 3.481 |
| 0.0001 | 3.719 | 3.891 |
Frequently Asked Questions
What is a z-test?
A z-test is a statistical hypothesis test that uses the standard normal distribution to determine whether a sample statistic differs significantly from a hypothesized population parameter. It requires that the population standard deviation is known (for means) or that sample sizes are large enough for the normal approximation (for proportions). The test statistic z measures how many standard errors the sample statistic is from the null hypothesis value.
When should I use a z-test instead of a t-test?
Use a z-test when: (1) the population standard deviation σ is known, (2) you are comparing proportions with large samples (np ≥ 5 and n(1-p) ≥ 5), or (3) your sample size is very large (n > 100) and you treat s as σ. In practice, the t-test is preferred for comparing means because σ is rarely known. The two-proportion z-test is standard for comparing proportions regardless of whether you call it a z-test.
How do I interpret the z-statistic?
The z-statistic tells you how many standard errors your sample statistic is from the null hypothesis value. A z of 0 means the sample exactly matches H₀. A z of ±1.96 corresponds to the 5% significance level (two-tailed). Larger absolute z-values indicate stronger evidence against H₀. The sign indicates direction: positive z means the sample is above H₀, negative means below.
What is the two-proportion z-test used for?
The two-proportion z-test determines whether two population proportions are significantly different. Common applications include A/B testing (comparing conversion rates), clinical trials (comparing treatment success rates), and survey analysis (comparing response rates between groups). It uses a pooled proportion under H₀: p₁ = p₂ to estimate the standard error.
What are the assumptions of the z-test?
The z-test assumes: (1) observations are independent, (2) the sampling distribution of the statistic is approximately normal (guaranteed by CLT for large n), (3) for one-sample mean tests, σ is known, (4) for proportion tests, np ≥ 5 and n(1-p) ≥ 5 in each group. Violations of the normality assumption are less concerning with large samples due to the Central Limit Theorem.
How do I calculate the confidence interval from a z-test?
For a one-sample mean: CI = x̄ ± z*(α/2) × (σ/√n). For two proportions: CI = (p̂₁ - p̂₂) ± z*(α/2) × √(p̂₁(1-p̂₁)/n₁ + p̂₂(1-p̂₂)/n₂). Note that the CI for proportions uses unpooled standard errors (each proportion's own variance), while the test statistic uses the pooled proportion. Common z* values: 1.645 (90%), 1.960 (95%), 2.576 (99%).