Z-test Calculator
Settings
Results
Action
Important Note: Use this only when population σ is known; otherwise a t-test is usually the right tool.
Use this Z-Test Calculator to compute the z statistic, p-value, standard error, and critical z value for one-sample or two-sample mean tests. It is useful for statistics homework, quick hypothesis-test checking, normal-distribution inference, and situations where the population standard deviation is known.
Reviewed by: AjaxCalculators Editorial Team
Last updated: May 3, 2026
Method source: Standard one-sample and two-sample mean z-test formulas using known population standard deviations and the standard normal distribution
Editorial standards: AjaxCalculators Editorial Policy
What This Z-Test Calculator Calculates
This calculator performs summary-statistics z tests and reports the main values needed for hypothesis testing.
- z statistic: how many standard errors the observed result is from the null value
- p-value: probability of a result at least as extreme under the null hypothesis
- Standard error: estimated sampling variability used in the z statistic
- Critical z value: cutoff for the selected significance level and tail direction
- Decision at α: reject or fail to reject the null hypothesis using the selected threshold
It supports two test types:
- One-sample z test: compares one sample mean with a hypothesized population mean when σ is known
- Two-sample z test: compares two independent sample means when both population standard deviations are known
What Is a Z Test?
A z test is a hypothesis test that uses the standard normal distribution. In mean-based z testing, the test statistic compares an observed sample mean, or difference between sample means, with the value expected under the null hypothesis.
The main idea is:
- If the observed result is close to the null value, the z statistic is near 0.
- If the observed result is far from the null value, the z statistic becomes larger in magnitude.
- The p-value uses the standard normal distribution to judge how unusual that z statistic is under the null hypothesis.
Z tests are most appropriate when the population standard deviation is known. In many real datasets, σ is not known and must be estimated from the sample. In that case, a t-test is usually the better default.
One-Sample Z Test Formula
A one-sample z test compares a sample mean to a known or hypothesized population mean when the population standard deviation is known.
z = (x̄ − μ0) / (σ / √n)
Where:
- z = z test statistic
- x̄ = sample mean
- μ0 = hypothesized population mean under H0
- σ = known population standard deviation
- n = sample size
- σ / √n = standard error of the sample mean
The z statistic is then compared with the standard normal distribution to find the p-value and, if α is provided, the matching critical z threshold.
Two-Sample Z Test Formula
A two-sample z test compares two independent sample means when the population standard deviations for both groups are known.
z = [(x̄1 − x̄2) − Δ0] / √(σ12/n1 + σ22/n2)
Where:
- x̄1, x̄2 = sample means for group 1 and group 2
- σ1, σ2 = known population standard deviations for the two groups
- n1, n2 = sample sizes for the two groups
- Δ0 = hypothesized difference in means
For a no-difference test, use:
Δ0 = 0
The two-sample standard error is:
SE = √(σ12/n1 + σ22/n2)
Formula Summary
| Calculation | Formula | Use |
|---|---|---|
| One-sample standard error | SE = σ / √n | Sampling variability for one sample mean |
| One-sample z statistic | z = (x̄ − μ0) / SE | Compare one sample mean with a hypothesized mean |
| Two-sample standard error | SE = √(σ12/n1 + σ22/n2) | Sampling variability for a difference in means |
| Two-sample z statistic | z = [(x̄1 − x̄2) − Δ0] / SE | Compare two independent sample means |
| Right-tailed p-value | P(Z ≥ z) | Use when the alternative is greater than |
| Left-tailed p-value | P(Z ≤ z) | Use when the alternative is less than |
| Two-tailed p-value | 2 × P(Z ≥ |z|) | Use when the alternative is different from |
One-Sample vs Two-Sample Z Test
| Test Type | Main Question | Common Null Hypothesis | Required Known Value |
|---|---|---|---|
| One-sample z test | Is one sample mean different from a hypothesized population mean? | H0: μ = μ0 | Population σ |
| Two-sample z test | Are two independent population means different? | H0: μ1 − μ2 = Δ0 | Population σ1 and σ2 |
If the standard deviations are calculated from the same sample data rather than known from the population, use a t-test calculator instead.
Tail Direction and Alternative Hypotheses
The p-value and critical z value depend on the alternative hypothesis.
| Tail Type | Alternative Hypothesis | Use When |
|---|---|---|
| Two-tailed | Parameter is different from the null value | You care about differences in either direction |
| Right-tailed | Parameter is greater than the null value | You are testing for an increase |
| Left-tailed | Parameter is less than the null value | You are testing for a decrease |
Tail direction should be chosen before looking at the result. Choosing the tail direction after seeing the data can distort inference.
Critical Z Values
A critical z value is the cutoff from the standard normal distribution for a chosen significance level.
| α Level | Two-Tailed Critical z | Right-Tailed Critical z | Left-Tailed Critical z |
|---|---|---|---|
| 0.10 | ±1.645 | 1.282 | −1.282 |
| 0.05 | ±1.960 | 1.645 | −1.645 |
| 0.01 | ±2.576 | 2.326 | −2.326 |
These common values are useful for checking results, but the calculator can compute the critical value for the α level you enter.
Z Test vs T Test
A z test and a t test can look similar, but they are used under different assumptions.
| Feature | Z Test | T Test |
|---|---|---|
| Standard deviation | Population σ is known | Population σ is unknown and estimated from sample data |
| Distribution used | Standard normal distribution | t distribution |
| Most common in practice | Less common for real mean tests because σ is rarely known | More common when using sample standard deviation |
| Small-sample behavior | Requires strong known-σ and normality assumptions | Accounts for extra uncertainty from estimating standard deviation |
When in doubt for mean testing and σ is not truly known, a t-test is usually the safer choice.
Worked Example A: One-Sample Z Test
Suppose a sample has:
- Sample mean: 110
- Hypothesized mean: 100
- Known population SD: 15
- Sample size: 25
Step 1: Find the standard error
SE = 15 / √25 = 15 / 5 = 3
Step 2: Compute the z statistic
z = (110 − 100) / 3 = 3.33
Step 3: Use the standard normal distribution
The calculator uses z = 3.33 and the selected tail direction to find the p-value, critical z value, and decision.
Interpretation: A z value of 3.33 means the sample mean is about 3.33 standard errors above the hypothesized mean.
Worked Example B: Two-Sample Z Test
Suppose two independent groups have:
- x̄1 = 52, σ1 = 10, n1 = 100
- x̄2 = 48, σ2 = 12, n2 = 100
- Δ0 = 0
Step 1: Find the standard error
SE = √(10²/100 + 12²/100)
SE = √(100/100 + 144/100)
SE = √(1 + 1.44) = √2.44 ≈ 1.562
Step 2: Compute the observed difference
x̄1 − x̄2 = 52 − 48 = 4
Step 3: Compute the z statistic
z = (4 − 0) / 1.562 ≈ 2.56
Step 4: Interpret the result
The calculator uses z ≈ 2.56 and the selected tail direction to find the p-value, critical z value, and decision.
Worked Example C: Tail Direction
Suppose a one-sample test gives:
- z = 2.10
- α = 0.05
Two-tailed test: The result is compared against approximately ±1.96. Since 2.10 is beyond 1.96, it is significant at the 0.05 level.
Right-tailed test: The result is compared against approximately 1.645. Since 2.10 is greater than 1.645, it is significant at the 0.05 level.
Left-tailed test: A positive z value does not support a left-tailed alternative, so it would not be significant for a left-tailed test.
This example shows why tail direction must match the research question.
Worked Example D: When a T Test Is Better
Suppose a sample has:
- Sample mean: 82
- Hypothesized mean: 80
- Sample standard deviation: 10
- Sample size: 16
This is not a proper known-σ z-test setup because the standard deviation is estimated from the sample. A t-test is usually more appropriate, especially with a small sample.
Practical rule: If the standard deviation comes from the sample you entered, use a t-test calculator instead of a z-test calculator.
How to Use This Z-Test Calculator
- Select One-sample Z test or Two-sample Z test.
- Choose the alternative hypothesis: two-tailed, right-tailed, or left-tailed.
- Enter the significance level α if you want critical z values and a decision threshold.
- For one-sample mode, enter x̄, μ0, σ, and n.
- For two-sample mode, enter x̄1, x̄2, σ1, σ2, n1, n2, and Δ0.
- Use Δ0 = 0 for a no-difference two-sample test.
- Click Calculate if the tool requires it.
- Review z, p-value, SE, critical z, and the test decision.
How to Interpret the Result
z statistic tells you how many standard errors your observed result is from the null value.
p-value tells you how unusual a result at least this extreme would be if the null hypothesis were true.
Standard error shows the sampling variability built into the test.
Critical z is the cutoff associated with your chosen α and tail direction.
If p ≤ α, the usual conclusion is to reject H0. If p > α, you do not reject H0.
| Result Pattern | Possible Meaning | What to Check |
|---|---|---|
| Large positive z | Observed result is above the null value | Check whether the alternative hypothesis supports an increase |
| Large negative z | Observed result is below the null value | Check whether the alternative hypothesis supports a decrease |
| Small p-value | Observed result is unusual under H0 | Check assumptions, effect size, and study design |
| Large p-value | Data do not provide strong evidence against H0 | Check sample size, variability, and test power |
| σ was estimated from sample data | A z test may not be appropriate | Use a t-test when population σ is unknown |
Statistical Significance vs Practical Importance
A statistically significant z test means the result is unlikely under the null hypothesis at the selected α level. It does not automatically mean the difference is large, useful, causal, or practically important.
To interpret a z-test result responsibly, also consider:
- the size of the mean difference
- confidence intervals
- sample size
- data quality
- whether σ is truly known
- whether the sample is representative
- whether the direction of the test was chosen in advance
- the real-world context of the result
When This Calculator Is Useful
This calculator is useful for known-σ hypothesis-test practice and quick normal-distribution inference.
- Run a one-sample mean z test when σ is known
- Compare two independent means when population SDs are known
- Check statistics homework or hand calculations
- Get p-values and critical z values quickly
- See how tail choice changes inference
- Review the relationship between z statistics and standard errors
- Compare z-test results with t-test logic
- Practice critical-value and p-value approaches
When You May Need More Than This Calculator
A z-test calculator is useful for learning and quick checks, but more statistical review may be needed when:
- the population standard deviation is not truly known
- the data are paired or repeated measures
- the observations are not independent
- the sample is very small and normality is doubtful
- the data are strongly skewed or contain severe outliers
- the sample comes from a complex survey design
- multiple comparisons are being made
- you need confidence intervals, effect sizes, or power analysis
- you are using results for research, publication, medical, legal, financial, policy, or high-stakes decisions
Common Mistakes to Avoid
- Using a z test when σ is unknown: if the standard deviation comes from the sample, a t-test is usually more appropriate.
- Confusing sample SD with population σ: sample standard deviation is not the same as known population standard deviation.
- Choosing the tail direction after seeing the result: tail direction should match the original research question.
- Ignoring sample size: small samples require stronger assumptions about the population distribution.
- Ignoring independence: standard z tests assume independent observations or independent groups.
- Assuming p-value proves importance: statistical significance does not automatically mean practical importance.
- Using a two-sample z test for paired data: paired designs require a paired method.
- Ignoring confidence intervals: a test decision alone does not show the estimated range of plausible values.
Assumptions and Important Notes
- This calculator is for mean-based z tests with known population standard deviation.
- If σ is not truly known, a t-test is usually more appropriate.
- The data should come from a random sample or a design where independence is reasonable.
- For small samples, normality assumptions matter more strongly.
- For larger samples, the sampling distribution of the mean is often approximately normal under standard conditions.
- Two-sample mode assumes independent groups, not paired observations.
- Sample sizes must be positive, and population standard deviations must be greater than zero.
- The p-value and critical value depend on the selected tail direction.
- This page is best treated as a known-σ z-test tool, not a general-purpose replacement for t-tests.
Practical Uses of a Z-Test Calculator
- Calculate a one-sample z statistic
- Calculate a two-sample z statistic
- Find p-values from z statistics
- Find critical z values for α levels
- Compare one-tailed and two-tailed results
- Check homework and textbook examples
- Review known-σ hypothesis-test logic
- Support introductory statistics learning
References
- Penn State STAT 200: One Sample Mean z Test
- NIST/SEMATECH e-Handbook of Statistical Methods: Test Statistic When Standard Deviation Is Known
- Penn State STAT 200: General Form of a Test Statistic
- Penn State STAT ONLINE: Critical Value Approach to Hypothesis Testing
- Penn State STAT 200: Hypothesis Testing for a Population Mean
Related Calculators
- t-test Calculator
- t-statistic Calculator
- Sample Size Calculator
- Margin of Error Calculator
- Power Analysis Calculator
- Standard Deviation Calculator
- Variance Calculator
Frequently Asked Questions
What does this Z-Test Calculator calculate?
It calculates the z statistic, p-value, standard error, critical z value, and hypothesis-test decision for supported one-sample and two-sample mean z tests.
What is a z test?
A z test is a hypothesis test that uses the standard normal distribution. For mean-based z tests, it is typically used when the population standard deviation is known.
What is the one-sample z-test formula?
The one-sample formula is z = (x̄ − μ0) / (σ / √n).
What is the two-sample z-test formula?
The two-sample formula is z = [(x̄1 − x̄2) − Δ0] / √(σ12/n1 + σ22/n2).
When should I use a one-sample z test?
Use a one-sample z test when comparing one sample mean with a hypothesized population mean and the population standard deviation is known.
When should I use a two-sample z test?
Use a two-sample z test when comparing two independent sample means and both population standard deviations are known.
What does the z statistic mean?
The z statistic tells you how many standard errors the observed result is from the null value.
What does the p-value mean?
The p-value tells you how unusual a result at least as extreme as the observed result would be if the null hypothesis were true.
What does p ≤ α mean?
It usually means the result is statistically significant at the selected α level, so the null hypothesis is rejected.
What does p > α mean?
It usually means the result is not statistically significant at the selected α level, so you fail to reject the null hypothesis.
What is a critical z value?
A critical z value is the cutoff from the standard normal distribution for the selected significance level and tail direction.
What is the difference between a one-tailed and two-tailed z test?
A one-tailed test checks for a difference in one direction. A two-tailed test checks for a difference in either direction.
Should I choose the tail direction before or after seeing the result?
Choose the tail direction before seeing the result. Choosing it afterward can distort the interpretation.
What is the difference between a z test and a t test?
A z test uses known population standard deviation and the standard normal distribution. A t test is usually used when the standard deviation is estimated from sample data.
Can I use a sample standard deviation in a z test?
Usually no. If the standard deviation is estimated from the sample, a t-test is usually more appropriate.
Does a significant z test prove causation?
No. A statistically significant result does not prove causation. Study design, confounding, sampling, and context still matter.
Can this calculator replace statistical software?
No. It is useful for learning and quick checks, but full statistical software may be needed for complex designs, confidence intervals, effect sizes, power analysis, or publication-quality work.
Disclaimer: This Z-Test Calculator provides educational statistical estimates for one-sample and two-sample mean z tests when the population standard deviation is known. Results depend on the sample mean, hypothesized mean, known population standard deviation, sample size, tail direction, significance level, rounding, independence assumptions, and whether a z test is appropriate for the study design. A z test is usually appropriate for mean-based testing only when the population standard deviation is truly known or when a justified normal-approximation method is being used. If the population standard deviation is estimated from the sample, a t-test is usually more appropriate. Small samples require stronger normality assumptions, while larger samples rely more on sampling-distribution approximation under standard conditions. A statistically significant p-value does not prove causation, practical importance, data quality, or real-world usefulness. Use confidence intervals, effect size, study design, assumptions, and subject-matter context when interpreting results. Use this calculator for learning, homework, and quick hypothesis-test checks, and use full statistical software or qualified statistical guidance for research, publication, medical, legal, financial, policy, or other high-stakes decisions.