Z-Test Calculator

Test hypotheses about means and proportions using the Z-distribution.

Z Z-Test Calculator
Z-Statistic
-
p-Value
-
Critical Value
-
Result
-

📖 What is a Z-Test?

A Z-test is a hypothesis test based on the standard normal distribution. It is used to determine whether a sample mean or proportion differs significantly from a hypothesised population value, or whether two population means/proportions are significantly different from each other.

The Z-test is appropriate when the population standard deviation σ is known, or when the sample size is large (n > 30), in which case the Central Limit Theorem (CLT) guarantees that the sampling distribution of the mean is approximately normal regardless of the underlying population distribution.

Z-tests for proportions are widely used in A/B testing, survey analysis, and clinical research. They test whether an observed proportion (e.g., 55% click-through rate) differs significantly from a reference value (e.g., 50%), or whether two proportions (e.g., treatment vs. control conversion rates) are significantly different.

📐 Formulas

One-sample mean: Z = (x̄ − μ₀) / (σ / √n)

One-sample proportion: Z = (p̂ − p₀) / √(p₀(1−p₀)/n)

Two-sample means: Z = (x̄₁ − x̄₂) / √(σ₁²/n₁ + σ₂²/n₂)

Two-sample proportions: Z = (p̂₁ − p̂₂) / √[p̂(1−p̂)(1/n₁+1/n₂)]

where p̂ = (x₁+x₂)/(n₁+n₂) is the pooled proportion

p-value (two-tailed): 2 × (1 − Φ(|Z|))

Critical values: α=0.05: ±1.96 | α=0.01: ±2.576 | α=0.10: ±1.645

📖 How to Use This Calculator

1
Select the test type: one-sample mean (compare one group to a reference), one-sample proportion, two-sample means (compare two groups), or two-sample proportions.
2
Enter the required sample statistics. For mean tests, you need the population standard deviation σ or a good estimate. For proportion tests, enter the number of successes and sample size.
3
Set the null hypothesis value, choose the tail type and significance level, then click Run Z-Test.
4
If p < α or |Z| > critical value, reject H₀. The conclusion is stated automatically.

📝 Example Calculations

Example 1 - One-Sample Mean

A factory claims mean output = 500 units/day (σ = 30). A sample of 40 days gives x̄ = 508. Test at α = 0.05, two-tailed.

Z = (508 − 500) / (30/√40) = 8 / 4.74 = 1.69. p = 0.091 > 0.05 - Fail to reject H₀.

Result = Z = 1.69, p = 0.091 (Not Significant)
Try this example →

Example 2 - One-Sample Proportion

A poll shows 55% of 200 voters support candidate A. H₀: p = 0.50, two-tailed, α = 0.05.

Z = (0.55 − 0.50) / √(0.5×0.5/200) = 0.05 / 0.0354 = 1.41. p = 0.158 > 0.05 - Not significant.

Result = Z = 1.41, p = 0.158 (Not Significant)
Try this example →

Example 3 - Two-Sample Proportions (A/B Test)

Control: 45/100 conversions. Treatment: 55/100 conversions. Two-tailed, α = 0.05.

p̂ = 100/200 = 0.50. Z = (0.55−0.45)/√(0.5×0.5×(1/100+1/100)) = 0.10/0.0707 = 1.41. p = 0.158 - Not significant.

Result = Z = 1.41, p = 0.158 (Not Significant)
Try this example →

Example 4 - Two-Sample Means

City A (σ=8, n=60, x̄=72) vs City B (σ=10, n=50, x̄=68). Two-tailed, α = 0.05.

Z = (72−68)/√(64/60+100/50) = 4/√(1.067+2) = 4/1.751 = 2.28. p = 0.023 < 0.05 - Reject H₀.

Result = Z = 2.28, p = 0.023 (Significant)
Try this example →

❓ Frequently Asked Questions

What is a Z-test?+
A Z-test is a statistical hypothesis test that uses the standard normal (Z) distribution to assess whether a sample mean or proportion differs significantly from a hypothesised value. It is used when the population standard deviation is known, or when the sample size is large enough (n > 30) for the Central Limit Theorem to apply.
When should I use a Z-test vs a t-test?+
Use a Z-test when: (1) the population standard deviation σ is known, or (2) the sample size is large (n > 30) because the t-distribution converges to the Z-distribution for large samples. Use a t-test when σ is unknown and the sample is small (n < 30).
How is the Z-test for proportions different from the one for means?+
For means: Z = (x̄ − μ₀) / (σ/√n). For proportions: Z = (p̂ − p₀) / √(p₀(1−p₀)/n). Both compare the observed value to the hypothesised value in standard error units. The proportion test uses the binomial standard error under the null hypothesis.
What are the assumptions of the Z-test?+
The Z-test assumes: (1) random sampling, (2) independent observations, (3) the population standard deviation is known (for mean tests), and (4) the sampling distribution of the statistic is approximately normal (either because the population is normal or n is large by CLT).
What is a two-sample Z-test?+
A two-sample Z-test compares means or proportions from two independent groups. For means: Z = (x̄₁ − x̄₂) / √(σ₁²/n₁ + σ₂²/n₂). For proportions: Z = (p̂₁ − p̂₂) / √[p̂(1−p̂)(1/n₁+1/n₂)] where p̂ is the pooled proportion. It tests H₀: μ₁ = μ₂ or H₀: p₁ = p₂.
When should I use a z-test instead of a t-test?+
Use a z-test when: (1) sample size is large (n > 30), (2) the population standard deviation is known, or (3) you are testing proportions. Use a t-test when sample size is small (n < 30) and population variance is unknown. With large samples, the t-test and z-test give nearly identical results because the t-distribution approaches the normal distribution.
When should I use a z-test instead of a t-test?+
Use a z-test when: (1) your sample size is large (n >= 30), or (2) the population standard deviation is known. Use a t-test when the population standard deviation is unknown and you estimate it from the sample. With n > 30, the t-distribution approximates the normal distribution so closely that the choice rarely matters.
What is a two-tailed vs one-tailed z-test?+
A two-tailed test checks if the mean differs from the null in either direction. Use it when you have no prior hypothesis about direction. A one-tailed test checks for difference in only one direction. Two-tailed is more conservative and is the default in most research. One-tailed tests require strong theoretical justification.
What is a z-score for a sample mean?+
The z-score for a sample mean is z = (x-bar - mu0) / (sigma / sqrt(n)), where x-bar is the sample mean, mu0 is the hypothesized population mean, sigma is the known population standard deviation, and n is the sample size. This tells you how many standard errors the sample mean is from the null hypothesis value.
What is the one-sample z-test formula?+
z = (sample_mean - null_mean) / (sigma / sqrt(n)), where sigma is the known population standard deviation and n is the sample size. For a two-tailed test at 5% significance, reject H0 if |z| > 1.96. For a one-tailed test, the critical value is 1.645 at alpha = 0.05.
How do I interpret the p-value in a z-test?+
The p-value is the probability of obtaining a z-statistic as extreme as observed, assuming H0 is true. If p < alpha (typically 0.05), reject H0. Example: z = 2.3, two-tailed p = 0.021. Since 0.021 < 0.05, you reject H0 and conclude the population mean differs from the null value. Never interpret p-value as the probability H0 is true - it is a probability about the data given H0.