Run a one-sample or two-sample z-test for means with a known population standard deviation, or a one- or two-proportion z-test. Enter summary statistics or raw data and get z, the p-value, the critical value, a confidence interval and a clear reject or fail-to-reject decision.
Last updated:
Type of z-test
Enter
Sample data
Numbers separated by spaces, commas or new lines.
Known population standard deviation
Number of 'yes' outcomes
Hypothesis
Decimal (0.5) or percent (50%)
Enter your values to see the result.
Advertisement
Advertisement
How to use the Z-Test Calculator
Choose the test: one-sample mean, two-sample means, one proportion or two proportions.
Enter your numbers: means, known standard deviations and sample sizes (or raw data), or successes and trials.
Set the hypothesis: the hypothesized mean, difference or proportion, and the alternative (≠, > or <).
Pick α (0.05 is the usual choice) and press Calculate.
Read z, the p-value and the decision, and check the shaded curve and the working steps.
Z-test formulas
Test
Null hypothesis
z statistic
Use when
One-sample mean
μ = μ₀
z = (x̄ − μ₀) ÷ (σ ÷ √n)
σ known; normal population or n ≥ 30
Two-sample means
μ₁ − μ₂ = Δ₀
z = ((x̄₁ − x̄₂) − Δ₀) ÷ √(σ₁²/n₁ + σ₂²/n₂)
Independent samples, both σ known
One proportion
p = p₀
z = (p̂ − p₀) ÷ √(p₀(1 − p₀)/n)
n·p₀ ≥ 10 and n·(1 − p₀) ≥ 10
Two proportions
p₁ = p₂
z = (p̂₁ − p̂₂) ÷ √(p̂(1 − p̂)(1/n₁ + 1/n₂))
Independent groups, ≥ 5–10 successes and failures each
The p-value comes from the standard normal distribution: P(Z > z) for a right-tailed test, P(Z < z) for a left-tailed test and 2 × P(Z > |z|) for a two-tailed test. The confidence interval is estimate ± zα/2 × SE; for proportions it uses the unpooled standard error √(p̂(1 − p̂)/n).
Worked example
A school's 40 students average 104.2 on an IQ-style test where the population has μ = 100 and σ = 15. Is the school different from the population?
SE = 15 ÷ √40 = 2.3717.
z = (104.2 − 100) ÷ 2.3717 = 1.771.
Two-tailed p-value = 2 × P(Z > 1.771) ≈ 0.0766.
p > 0.05, so we fail to reject H₀ at the 5% level. A right-tailed test (is the school higher?) would give p ≈ 0.0383 and reject H₀, which is why the alternative must be chosen before looking at the data.
Critical z values
α
Confidence
One-tailed z
Two-tailed ±z
0.10
90%
1.282
1.645
0.05
95%
1.645
1.960
0.025
97.5%
1.960
2.241
0.01
99%
2.326
2.576
0.001
99.9%
3.090
3.291
Frequently asked questions
When should I use a z-test instead of a t-test?
Use a z-test for a mean when the population standard deviation σ is known (for example from a long history of measurements or a standardized test like IQ with σ = 15), and the population is normal or the sample is large. If σ has to be estimated from the sample, a t-test is the correct choice, especially for small samples. Tests for proportions use z because the standard error comes from the hypothesized proportion.
What is the z-test formula?
For one mean, z = (x̄ − μ₀) ÷ (σ ÷ √n). For two means, z = ((x̄₁ − x̄₂) − Δ₀) ÷ √(σ₁²/n₁ + σ₂²/n₂). For one proportion, z = (p̂ − p₀) ÷ √(p₀(1 − p₀)/n). For two proportions, z = (p̂₁ − p̂₂) ÷ √(p̂(1 − p̂)(1/n₁ + 1/n₂)) with the pooled proportion p̂ = (x₁ + x₂) ÷ (n₁ + n₂).
How is the p-value calculated?
The p-value is the probability, under the null hypothesis, of a z statistic at least as extreme as yours. For a right-tailed test it is P(Z > z), for a left-tailed test P(Z < z), and for a two-tailed test 2 × P(Z > |z|), using the standard normal distribution.
What are the critical values of z?
For α = 0.05 the two-tailed critical values are ±1.960 and the one-tailed value is 1.645. For α = 0.01 they are ±2.576 and 2.326, and for α = 0.10 they are ±1.645 and 1.282. You reject H₀ when z falls beyond the critical value, which is the same as p < α.
What does 'fail to reject H₀' mean?
It means the sample does not provide strong enough evidence against the null hypothesis at your significance level. It does not prove H₀ is true; the effect may be small or the sample too small to detect it. Look at the confidence interval to see which values remain plausible.
Can I use this for an A/B test?
Yes. Use the two-proportion test with the conversions and visitors of each variant. A right-tailed test checks whether variant 1 converts better than variant 2. Make sure each group has at least 5 to 10 conversions and non-conversions so the normal approximation holds.
What conditions must be met for a proportion z-test?
The observations should be independent and the expected counts large enough: n·p₀ and n·(1 − p₀) of at least 10 for one proportion, and at least 5 to 10 successes and failures in each group for two proportions. The calculator warns you when these are not met.
Are all the tools on FreeToolCabin tested for quality and accuracy?
Yes! Every tool on our site undergoes automated Q/A testing in real browser environments to ensure high precision, correct output, and zero errors. If you happen to spot a bug or have a suggestion, please contact us at [email protected] and our team will review it right away.