Home › Calculators › Z-Test Calculator

Z-Test Calculator

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

  1. Choose the test: one-sample mean, two-sample means, one proportion or two proportions.
  2. Enter your numbers: means, known standard deviations and sample sizes (or raw data), or successes and trials.
  3. Set the hypothesis: the hypothesized mean, difference or proportion, and the alternative (≠, > or <).
  4. Pick α (0.05 is the usual choice) and press Calculate.
  5. Read z, the p-value and the decision, and check the shaded curve and the working steps.

Z-test formulas

TestNull hypothesisz statisticUse 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 proportionp = p₀z = (p̂ − p₀) ÷ √(p₀(1 − p₀)/n)n·p₀ ≥ 10 and n·(1 − p₀) ≥ 10
Two proportionsp₁ = 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?

  1. SE = 15 ÷ √40 = 2.3717.
  2. z = (104.2 − 100) ÷ 2.3717 = 1.771.
  3. Two-tailed p-value = 2 × P(Z > 1.771) ≈ 0.0766.
  4. 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

αConfidenceOne-tailed zTwo-tailed ±z
0.1090%1.2821.645
0.0595%1.6451.960
0.02597.5%1.9602.241
0.0199%2.3262.576
0.00199.9%3.0903.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.

Related tools

T-Test CalculatorOne-sample, two-sample (Welch/pooled) and paired t-tests with p-value and CI.P-Value CalculatorOne- or two-tailed p-values from z, t, chi-square or F statistics, with critical values.Z-Score CalculatorZ-score from a value, mean and SD, plus percentile and p-value; or the value from z.Critical Value CalculatorCritical values of z, t, chi-square and F for any alpha, tails and degrees of freedom.Weighted Average CalculatorCalculate a weighted mean from values and weights, step by step.Average CalculatorMean, weighted average, median, sum, min and max of any list.Standard Deviation CalculatorStandard deviation, variance, mean, median, mode and quartiles.A/B Test Significance CalculatorCheck if your A/B test result is statistically significant.Probability CalculatorFind and, or, not, conditional and at-least-once probabilities from P(A) and P(B).Permutation and Combination CalculatorCalculate nPr and nCr, with or without repetition, as exact big numbers.Mean Median Mode CalculatorFind the mean, median, mode, range, min, max, sum and count of a list of numbers.Confidence Interval CalculatorConfidence interval and margin of error for a mean or a proportion, with steps.Sample Size CalculatorHow many survey responses you need for a given confidence level and margin of error.Percentile CalculatorValue at any percentile, percentile rank of a score, quartiles, IQR and outliers.Correlation Coefficient CalculatorPearson r and Spearman rank correlation with significance and interpretation.Average Order Value CalculatorAverage order value from revenue and orders, plus the revenue impact of raising AOV.Binomial Distribution CalculatorBinomial probabilities P(X = k), at most, at least or between, with mean, variance and chart.Normal Distribution CalculatorNormal probabilities P(X < x), between two values and inverse percentiles, on a shaded bell curve.Poisson Distribution CalculatorPoisson probabilities for a rate λ: exactly k, at most, at least or between, with a chart.Chi-Square CalculatorChi-square goodness-of-fit and independence tests with p-value and expected counts.Variance CalculatorSample and population variance and standard deviation with a step-by-step deviations table.Five Number Summary CalculatorMin, Q1, median, Q3, max, IQR and fences of a data set, with a box plot.Outlier CalculatorFind outliers with 1.5×/3× IQR fences, z-scores or modified z-scores; get the cleaned data.Geometric Mean CalculatorGeometric, harmonic, arithmetic and quadratic means compared, or average growth from % changes.Expected Value CalculatorExpected value, variance and standard deviation from outcomes and their probabilities.One-Way ANOVA CalculatorOne-way ANOVA for 2-10 groups: SS, df, MS, F statistic, p-value, effect size and full table.Bayes Theorem CalculatorPosterior P(A|B) from P(A), P(B|A) and P(B|not A), with a probability tree and table.Box Plot MakerPaste data to draw box-and-whisker plots with quartiles, IQR and outliers. Download PNG or SVG.Coefficient of Variation CalculatorCV % from a dataset (sample or population) with mean, SD and a two-dataset comparison.Dice Probability CalculatorOdds of rolling a sum (exactly, at least, at most) with any dice, plus the full distribution.Effect Size Calculator (Cohen's d)Cohen's d, Hedges' g and Glass's delta from two means, SDs and sample sizes, with CI.Frequency Table GeneratorMake a frequency, relative and cumulative frequency table from numbers or categories.Histogram MakerPaste numbers, choose bins and get a histogram, frequency table and PNG download.Margin of Error CalculatorSurvey margin of error from sample size, confidence and proportion, with population correction.Moving Average CalculatorSimple, exponential and weighted moving averages of a data series, with table and line chart.Odds Ratio and Relative Risk CalculatorOdds ratio, relative risk, risk difference, 95% CIs and p-values from a 2x2 table.Standard Error CalculatorStandard error of the mean from data or SD and n, plus SE of a proportion, with CIs.Descriptive Statistics CalculatorPaste data and get mean, median, mode, quartiles, SD, skewness, kurtosis and a histogram.Permutations GeneratorList all permutations of letters, words or items, with k-permutations and repeats, and export them.Statistical Power CalculatorPower or required sample size for t-tests, proportions and correlations, with a power curve.T Distribution CalculatorStudent's t probabilities and critical values for any df, with the area shaded on the curve.T-Table (Student's t Distribution)Interactive t-table: critical t-values for any df and α, p-values, and a printable full table.Shannon Entropy CalculatorEntropy of text, data or probabilities in bits, nats or hartleys with a frequency table.Empirical Rule Calculator68-95-99.7 rule ranges from a mean and standard deviation, with a shaded bell curve.Z-Table (Standard Normal Table)Interactive z-table: find the area for any z-score, or the z-score for a probability.Average Rate of Change CalculatorAverage rate of change of f(x), two points or a data table over [a, b], with the secant line.Binomial Expansion CalculatorExpand (a + b)^n with the binomial theorem: every term, Pascal coefficients and any specific term.Combinations GeneratorList every k-combination of your items, with or without repetition, and copy or export them.Covariance CalculatorSample and population covariance of paired X and Y data, with a step table and scatter plot.Grouped Data CalculatorMean, median, mode, variance and standard deviation from class intervals and frequencies.Inverse Normal Distribution CalculatorinvNorm: find the x or z value for a left, right, central or two-tail area, with a shaded curve.
See all 52 Statistics & Probability Calculators →