Z-Test Calculator for Hypothesis Testing
Perform one-sample and two-sample Z-tests for hypothesis testing. Enter sample statistics to get the Z-score, p-value, and critical value with a clear rejection decision.
Select one-sample or two-sample mode, enter your sample statistics, choose a significance level and tail type, then click Calculate.
Z-Test Calculator for Hypothesis Testing
Perform one-sample and two-sample Z-tests for hypothesis testing. Enter sample statistics to get the Z-score, p-value, and critical value with a clear rejection decision.
About the Z-Test
A Z-test is a statistical hypothesis test that uses the standard normal (Z) distribution to assess whether a sample mean differs significantly from a known population mean, or whether two independent sample means differ significantly from each other. The Z-test assumes that the population standard deviation is known and that either the population is normally distributed or the sample size is large enough for the Central Limit Theorem to apply (typically n ≥ 30).
The one-sample Z-test compares a single sample mean to a hypothesized population mean. The formula is Z = (x̄ − μ) / (σ / √n), where x̄ is the sample mean, μ is the hypothesized population mean, σ is the population standard deviation, and n is the sample size. A large absolute Z-value means the sample mean is far from the hypothesized mean, making it unlikely to have occurred by chance.
The two-sample Z-test compares the means of two independent groups when the population standard deviations of both groups are known. The formula is Z = (x̄₁ − x̄₂) / √(σ₁²/n₁ + σ₂²/n₂). This test is commonly used in clinical trials, A/B testing, and manufacturing quality comparisons.
The choice of tail type reflects the direction of the alternative hypothesis. A two-tailed test (H₁: μ ≠ μ₀) tests for any difference, regardless of direction. A right-tailed test (H₁: μ > μ₀) tests whether the sample mean is significantly larger than the hypothesized value. A left-tailed test (H₁: μ < μ₀) tests whether the sample mean is significantly smaller.
The p-value is the probability of obtaining a test statistic as extreme as, or more extreme than, the observed Z-score, assuming the null hypothesis is true. If the p-value is less than the significance level α (commonly 0.05), you reject the null hypothesis. The critical Z-value is the threshold that the Z-statistic must exceed to reject H₀.
The Z-test is distinct from the t-test. The t-test is used when the population standard deviation is unknown and must be estimated from the sample. For large samples (n > 30), the t-distribution and Z-distribution converge, so results are nearly identical. For small samples with unknown population variance, always prefer the t-test.
Common applications include testing whether a new manufacturing process meets a quality standard, whether a clinical intervention changes a health outcome, whether one website variant has a different conversion rate than another, and whether two educational programs produce different student performance outcomes.
Practical Examples
See how the Z-Test Calculator is used in different scenarios.
| Input | Z / p-Value | Decision |
|---|---|---|
| One-sample: x̄=105, μ=100, σ=15, n=30, α=0.05, two-tailed | Z≈1.826, p≈0.068 | IQ scores — fail to reject H₀; new teaching method not significantly different. |
| Two-sample: x̄₁=15, σ₁=3, n₁=35; x̄₂=16, σ₂=3.2, n₂=40; α=0.05, left-tailed | Z≈−1.396, p≈0.081 | Drug recovery — fail to reject H₀; drug not significantly faster. |
| Two-sample: x̄₁=85, σ₁=10, n₁=100; x̄₂=82, σ₂=9, n₂=90; α=0.01, two-tailed | Z≈2.176, p≈0.030 | School scores — reject H₀ at α=0.05 but not at α=0.01. |
How to use the Z-test calculator
- Select One-Sample to compare a sample mean against a known population mean, or Two-Sample to compare two independent group means.
- For one-sample: enter the sample mean, population mean, population standard deviation, and sample size.
- For two-sample: enter the mean, standard deviation, and size for both samples. Leave the Population Mean field empty.
- Choose the significance level α and the tail type based on your hypothesis, then click Calculate.
- Review the Z-statistic, p-value, and critical Z to determine whether to reject the null hypothesis.
FAQ
When should I use a Z-test instead of a t-test?
Use a Z-test when the population standard deviation is known and the sample size is large (n ≥ 30). Use a t-test when the population standard deviation is unknown and must be estimated from the sample, or when the sample is small. In practice, the Z-test is most common in quality control and standardized testing where historical population data is available.
What is the p-value and how do I interpret it?
The p-value is the probability of observing a test statistic as extreme as or more extreme than the one computed from your sample, assuming the null hypothesis is true. A small p-value (typically below 0.05) means the observed data would be unlikely under the null hypothesis, providing evidence to reject it. A large p-value means the data are consistent with the null hypothesis.
What is the difference between a one-tailed and two-tailed Z-test?
A two-tailed test checks for any difference between means (above or below). A one-tailed test checks for a difference in a specific direction. Use a right-tailed test when you expect the sample mean to be higher than the reference; use a left-tailed test when you expect it to be lower. The tail type must be decided based on your hypothesis before collecting data.
What does the critical Z-value mean?
The critical Z-value is the threshold the test statistic must exceed (in absolute value for two-tailed tests) to reject the null hypothesis. For example, for a two-tailed test at α = 0.05, the critical Z is approximately ±1.96. If the absolute value of the computed Z exceeds 1.96, you reject H₀.
Does the Z-test require normally distributed data?
Not necessarily. By the Central Limit Theorem, the sampling distribution of the sample mean is approximately normal for large samples (n ≥ 30) regardless of the population distribution. For small samples, normality of the population is required for the Z-test to be valid. When in doubt, verify normality with a normality test or use the t-test.
What is the two-sample Z-test used for?
The two-sample Z-test compares the means of two independent groups when the population standard deviations of both are known. Common uses include comparing the average test scores of students from two schools, the average recovery times of patients in two treatment arms, or the conversion rates of two website variants in an A/B test.