One Sample Z-Test Calculator

Use this free online One Sample Z-Test Calculator to test whether an observed sample mean (x̄) differs significantly from a hypothesized population benchmark (μ₀) when the population standard deviation (σ) is known. Enter your sample mean, known standard deviation, sample size (n), and significance level (α) to instantly calculate the standardized z-score, exact one-tailed or two-tailed p-values, critical boundaries, and confidence intervals with complete step-by-step mathematical working.

One Sample Mean Inputs
Test settings
Alternative hypothesis (H₁)
Significance level α

Live Standard Normal Distribution Curve (Z-Curve)

Drag the marker or use the slider below to observe how the test statistic relates to the rejection threshold.

−4−3−2−10+1+2+3+4z = 2.19
Fine Adjust z:2.19
Rejection Zone (α = 0.05)p-value Area (0.0285)

Step-by-Step Mathematical Derivation

1

State the Hypotheses

Null hypothesis assumes equality to benchmark; alternative reflects test direction:

H₀: μ = 100
H₁: μ ≠ 100
2

Calculate the Standard Error

SE measures the standard deviation of sample means across repeated samples:

SE = σ / √n
SE = 15 / √40 = 2.3717
3

Compute the Z-Score

Standardize the difference between observed sample mean and hypothesized mean:

z = (x̄ − μ₀) / SE
z = (105.2 − 100) / 2.3717 = 2.1925
4

Find Critical Boundary and P-Value

Calibrate against the standard normal distribution table:

Critical cutoff z* = ±1.960 (α = 0.05)
Exact p-value = 0.0283
|z| > z* → Reject H₀

What Is a One Sample Z Test Calculator?

A one sample z test calculator is a free online tool that checks whether a sample mean (x̄) is different from a known or claimed population mean (μ₀) when the population standard deviation (σ) is known. You enter 4 numbers, pick the test direction and significance level, and the calculator returns the z statistic, p-value, critical value, standard error, confidence interval, and a reject or fail-to-reject decision.

The one sample z test calculator has 3 main benefits: it removes hand calculation errors, it shows every step of the working, and it draws the result on a normal distribution curve so you can see where your z score falls.

People use a one sample z-test in 4 common situations: quality control (checking if a machine fills bottles to the target weight), education (comparing a class average to a national exam mean), health research (comparing patient readings to a known population value), and farming (checking if this year's crop weight matches past years).

The calculator has 3 parts: the input fields (x̄, μ₀, σ, n), the test settings (tail and α), and the results panel with the verdict, key numbers, and step-by-step working.

How to Use the One Sample Z Test Calculator

To use the one sample z test calculator, follow these 6 steps:

  1. Enter the sample mean (x̄). This is the average of your sample data.
  2. Enter the hypothesized mean (μ₀). This is the population mean you want to test against.
  3. Enter the population standard deviation (σ). This value comes from past research or a large earlier dataset, not from your sample.
  4. Enter the sample size (n). This is the number of values in your sample.
  5. Choose the test settings. Pick two-tailed, left-tailed, or right-tailed, then pick the significance level (α).
  6. Click “Calculate One Sample Z-Test”. Read the verdict, z statistic, and p-value in the results panel.

Click Reset to clear every field and start a new test.

One Sample Z Test Formula

The one sample z test formula divides the difference between the sample mean and the hypothesized mean by the standard error:

Z = (x̄ − μ₀) / (σ / √n)
SymbolMeaning
ZTest statistic
x̄Sample mean (sample average)
μ₀Hypothesized population mean
σPopulation standard deviation
nSample size

The bottom part of the formula, σ / √n, is the standard error (SE). The standard error shows how much sample means vary from one sample to the next. A larger sample size gives a smaller standard error, which makes the test pick up smaller differences.

Null and Alternative Hypotheses

Every one sample z test has 2 hypotheses. The null hypothesis (H₀) says the population mean is equal to the hypothesized value. The alternative hypothesis (H₁ or Hₐ) says the population mean is not equal to, less than, or greater than the hypothesized value.

Test typeH₀H₁When to use it
Two-tailed testμ = μ₀μ ≠ μ₀You want to spot a change in either direction.
Left-tailed testμ ≥ μ₀μ < μ₀You only care if the mean went down.
Right-tailed testμ ≤ μ₀μ > μ₀You only care if the mean went up.

Pick the test direction before you look at your data. Choosing the tail after seeing the results raises the chance of a false positive.

How to Find the P-Value

To find the p-value, look up the z statistic on the standard normal distribution. The formula depends on the test direction:

  • Left-tailed test: p = P(Z < z)
  • Right-tailed test: p = P(Z > z)
  • Two-tailed test: p = 2 × P(Z > |z|)

The calculator works out the exact p-value, so you do not need a Z table.

Critical Z-Values for Common Significance Levels

The critical value is the z score where the rejection region starts. Here are the critical z-values for 4 common significance levels:

Significance level (α)Two-tailedLeft-tailedRight-tailed
0.10±1.645−1.282+1.282
0.05±1.960−1.645+1.645
0.01±2.576−2.326+2.326
0.001±3.291−3.090+3.090

How to Make a Decision

Reject the null hypothesis, if the p-value is less than or equal to α. Fail to reject the null hypothesis, if the p-value is greater than α.

The critical value method gives the same answer: reject H₀ when the z statistic falls inside the rejection region (the red area on the curve above).

“Fail to reject” does not prove H₀ is true. It means the sample does not give enough evidence against H₀.

One Sample Z Test Example

Example 1: Two-Tailed Test (Apple Orchard)

A farmer knows from past harvests that a full crate of apples from the orchard weighs 17 kg (37.5 lb) on average, with a population standard deviation of 2.5 kg (5.5 lb). This year the farmer weighs 36 crates and gets a sample average of 18 kg (39.7 lb). Has the average crate weight changed?

  1. H₀: μ = 17 kg, H₁: μ ≠ 17 kg, α = 0.05
  2. SE = 2.5 / √36 = 2.5 / 6 = 0.4167 kg
  3. Z = (18 − 17) / 0.4167 = 2.40
  4. p = 2 × P(Z > 2.40) = 0.0164
  5. 0.0164 ≤ 0.05 → reject H₀

The average crate weight changed this year. The 95% confidence interval for the true mean is 17.18 kg to 18.82 kg, and that range does not include 17 kg.

Example 2: Left-Tailed Test (Lighter Crates?)

Now the farmer only wants to know if crates got lighter. A new sample of 36 crates averages 16.4 kg (36.2 lb). The population mean is still 17 kg and σ is still 2.5 kg.

  1. H₀: μ ≥ 17 kg, H₁: μ < 17 kg, α = 0.05
  2. SE = 2.5 / √36 = 0.4167 kg
  3. Z = (16.4 − 17) / 0.4167 = −1.44
  4. p = P(Z < −1.44) = 0.0749
  5. 0.0749 > 0.05 → fail to reject H₀

The sample does not give enough evidence that the crates got lighter. The z statistic of −1.44 sits above the left-tailed critical value of −1.645.

Assumptions of the One Sample Z Test

The one sample z test has 4 assumptions:

  • Known σ: The population standard deviation is known from past data or published sources.
  • Random sample: The values are picked at random from the population.
  • Independent values: One value does not affect another.
  • Normal data or a large sample: The population follows a normal distribution, or the sample size is 30 or more so the Central Limit Theorem (CLT) applies.

Check your raw data for outliers before you run the test. Extreme values pull the sample mean and can flip the result. For small samples, run a normality check such as the Shapiro-Wilk test in R, SPSS, or Minitab.

Required Sample Data

The calculator needs 4 values: the sample mean (x̄), the hypothesized mean (μ₀), the population standard deviation (σ), and the sample size (n).

Have raw data instead of a summary? Get the sample average with the Sample Mean Calculator, then count your values to get n. The Standard Deviation Calculator gives the sample standard deviation (s). Do not enter s in place of σ. Use a one sample t-test, if σ is unknown.

One Sample Z Test vs. One Sample T Test

Use the one sample z test when σ is known. Use the one sample t-test when σ is unknown and you estimate it with the sample standard deviation (s).

FeatureOne sample z testOne sample t-test
Spread valueσ (population)s (sample)
DistributionStandard normalt distribution with n − 1 degrees of freedom
Sample sizeAny size with normal data; 30 or more otherwiseAny size; common for small samples
Critical value (two-tailed, α = 0.05)±1.960±2.045 (n = 30)

Run your test with the T Test Calculator, if σ is unknown.

One Sample Z Test for Proportions

The calculator on this page tests a mean. To test a single proportion, such as a pass rate or a conversion rate, use the one-proportion z test formula:

Z = (p̂ − p₀) / √[p₀(1 − p₀) / n]

Here p̂ is the sample proportion and p₀ is the hypothesized proportion. The One Proportion Z-Test Calculator in the list at the bottom of this page runs this test.

How to Run a One Sample Z Test in R and Excel

R Code

R has no built-in function for the one sample z test. This R code gives the same result as the calculator for the apple crate example:

xbar  <- 18    # sample mean
mu0   <- 17    # hypothesized mean
sigma <- 2.5   # population standard deviation
n     <- 36    # sample size

se <- sigma / sqrt(n)
z  <- (xbar - mu0) / se
p_two   <- 2 * pnorm(-abs(z))   # two-tailed
p_left  <- pnorm(z)             # left-tailed
p_right <- 1 - pnorm(z)         # right-tailed

z      # 2.4
p_two  # 0.0164

Excel and Google Sheets

In Excel or Google Sheets, use these 2 formulas:

  • Z statistic: =(18-17)/(2.5/SQRT(36))
  • Two-tailed p-value: =2*(1-NORM.S.DIST(ABS(2.4),TRUE))

Excel's Z.TEST function works on raw data and returns a right-tailed p-value.

Frequently Asked Questions

What is a one sample z test?

A one sample z test is a hypothesis test that compares one sample mean to a known population mean when the population standard deviation is known.

Can I use a one sample z test with a small sample?

Yes, you can use a one sample z test with a small sample, if the population is normally distributed and σ is known. With fewer than 30 values and skewed data, the p-value is not reliable.

Is a one sample z test one-tailed or two-tailed?

A one sample z test can be one-tailed or two-tailed. Use two-tailed to spot a change in either direction. Use left-tailed or right-tailed when only one direction matters.

Does this calculator work out statistical power?

No, this calculator does not work out statistical power. It returns the z statistic, p-value, critical value, standard error, and confidence interval. To plan how many values you need before collecting data, use the Sample Size Calculator.

What does “reject H₀” mean?

Rejecting H₀ means the sample gives enough evidence, at your chosen α, that the population mean is different from μ₀. It does not tell you how big or how important the difference is. Check the confidence interval for that.

Summary

The one sample z test calculator compares a sample mean to a hypothesized population mean when the population standard deviation is known. Enter x̄, μ₀, σ, and n, choose the tail and α, and read the z statistic, p-value, critical value, and decision. Check the 4 assumptions first, and switch to a t-test when σ is unknown.

William Davis

Created by William Davis

Last updated: October 24, 2026

Add to Google Preferred