Skip to content

Z-Test Calculator

Test a mean against a hypothesised value, or compare two independent means, when the population standard deviation is known. Enter summary statistics or paste raw data and get z, the exact p-value for any alternative, a confidence interval, Cohen's d, and a picture of where z falls on the normal curve — with every step of the working shown. Free, no sign-up.

Test
Enter the data as

Enter the sample mean, n, σ, and μ₀ — or paste your raw data.

How to Use the Z-Test Calculator

  1. 1. Choose the test. One sample compares a mean with a hypothesised value μ₀. Two independent samples compares two means and tests the difference against Δ₀ (usually 0).
  2. 2. Enter the data. Type the sample mean, sample size, and the known population SD σ, or switch to Raw data and paste the values — the calculator computes the mean and n, and you still supply σ.
  3. 3. Pick the alternative, α, and confidence level. Two-sided is the default; the one-sided choices test a direction you named in advance.
  4. 4. Read the result. z, the p-value, the confidence interval, and Cohen's d appear below, with the rejection region drawn on the normal curve. Copy the APA line when you are done.

What the Z-Test Does

A z-test asks how many standard errors a sample mean lies from the value the null hypothesis claims. For one sample, z = (x̄ − μ₀) / (σ / √n); for two independent samples, z = (x̄₁ − x̄₂ − Δ₀) / √(σ₁²/n₁ + σ₂²/n₂). If the population is normal, or the samples are large enough for the central limit theorem to apply, z follows a standard normal distribution under H₀, so the p-value is a normal tail area: 2·P(Z ≥ |z|) for two-sided tests, and a single tail for one-sided tests. The confidence interval is the estimate ± z × SE, where z = 1.96 for 95%.

The defining requirement is that σ is known — from a standardised test whose norms are published, from a manufacturing process with a long record, or from a theoretical model. That is rarer than textbooks suggest. If you estimate σ from the same sample, you should use a t-test, which allows for the extra uncertainty in the estimate. With large samples (n above about 30 or 40) the two give nearly identical results.

Worked Example: Is This Class Different From the Norm?

Click Try an example. A standardised test has a population mean of 100 and a known SD of 15. A class of 36 students averages 104.2. Is the class different from the norm?

One-sample z-test, step by step

SE = σ / √n = 15 / √36 = 2.5

z = (104.2 − 100) / 2.5 = 1.68

Two-sided p = 2 × P(Z ≥ 1.68) = .0930; one-sided (greater) p = .0465

95% CI = 104.2 ± 1.96 × 2.5 = [99.30, 109.10]; Cohen's d = 4.2 / 15 = 0.28

In APA style: the class mean did not differ significantly from the norm, M = 104.20, z = 1.68, p = .093, 95% CI [99.30, 109.10], d = 0.28. Notice that the one-sided p-value (.047) would cross α = .05 while the two-sided one does not — a reason to choose the alternative before looking at the data, not after.

For two samples, take reaction times of 512 ms (n = 40, σ = 12) and 498 ms (n = 45, σ = 15). SE = √(12²/40 + 15²/45) = 2.93, z = 14 / 2.93 = 4.77, p < .001, and the 95% CI for the difference is [8.25, 19.75] ms.

Z-Test or T-Test?

SituationBetter choice
Population SD known, normal data or large nZ-test
Population SD estimated from the sampleT-test
Two independent means, unequal variances estimated from the dataWelch's t-test
A proportion rather than a meanProportion z-test, or the exact binomial test for small samples
Three or more meansANOVA

Frequently Asked Questions

When should I use a z-test instead of a t-test?
Use a z-test when the population standard deviation is genuinely known and the data are normal or the sample is large. Use a t-test when you estimate the SD from your sample, which is the usual case. For large samples the results are nearly identical, but the t-test is never wrong when σ is unknown.
What is a good z-score or critical value?
The critical values for a two-sided test are ±1.96 at α = .05, ±2.58 at α = .01, and ±3.29 at α = .001. A z outside those bounds is significant at that level. One-sided tests use 1.645 at α = .05. The calculator shows the critical value for the α you pick.
How do I report a z-test in APA style?
Give the mean, z, p, confidence interval, and an effect size: M = 104.20, z = 1.68, p = .093, 95% CI [99.30, 109.10], d = 0.28. Italicise M, z, p, and d, and say how σ was known. For very small p-values write p < .001.
What does the p-value in a z-test mean?
It is the probability of a z at least as extreme as yours if the null hypothesis were true — the area in the tail or tails of the standard normal curve beyond your z. It is not the probability that the null hypothesis is true, and a large p-value does not prove the null.
Can I use a z-test with a small sample?
Only if the population is normal and σ is known. The central limit theorem will not rescue a small sample from a skewed population, so the normal reference distribution may be inaccurate. With small samples and an unknown σ, use a t-test; with non-normal data, a nonparametric test.
What is the difference between a one-tailed and a two-tailed z-test?
A two-tailed test asks whether the mean differs from the hypothesised value in either direction and splits α between both tails. A one-tailed test looks for a difference in one direction only and puts all of α in one tail, which is more powerful for that direction but blind to the other. Choose before collecting data.

Related Tools

More in Statistics Calculators

See all Statistics Calculators