Developed by StatCalc.net Team Statistically reviewed by — Senior Statistician & Editor Last updated
Hypothesis Testing

Z Test Calculator

Use this z test calculator to perform a one-sample mean, two-sample mean, one-proportion, or two-proportion z test. Enter the required data to get the z statistic, p-value, critical value, and the calculation used to obtain the z statistic.

1. Choose the Z test

2. Enter the data

Data entry format
Enter values separated by commas, spaces, tabs, semicolons, or line breaks.
Use 0 when testing H₀: μ₁ = μ₂.
Enter values separated by commas, spaces, tabs, semicolons, or line breaks.
Enter the proportion as a decimal.
The test evaluates H₀: p₁ = p₂ using the pooled sample proportion.

3. Choose the alternative hypothesis

4. Set the significance level

Common values are 0.10, 0.05, and 0.01.

How to Use the Z Test Calculator

This calculator performs four common z-tests: a z-test for a single sample mean, a z-test for two sample means, a one-proportion z-test, and a two-proportion z-test.

To use the calculator:

  1. Choose the Z test you want to perform.
  2. For a mean test, choose whether you want to enter Summary Statistics or Raw Data.
  3. Enter the required sample information.
  4. Choose the alternative hypothesis: two-tailed, left-tailed, or right-tailed.
  5. Enter the significance level, α.
  6. Choose the number of decimal places and click Calculate.

The calculator will instantly return the z statistic, p-value, and critical value. Below the answer, the calculator also shows how the z-test statistic for your test was computed.

What Is a Z Test?

A z-test is a hypothesis test that uses the standard normal distribution to determine whether an observed sample result differs significantly from a value specified by the null hypothesis.

The test converts the difference between the observed statistic and the hypothesized value into a z statistic. The general formula is:

z = (observed statistic − hypothesized value) / standard error

The resulting z statistic tells us how many standard errors the observed result lies above or below the value assumed under the null hypothesis.

For example, z = 2.10 means the observed statistic is 2.10 standard errors above the hypothesized value. A negative z statistic indicates that the observed statistic is below the hypothesized value.

Struggling to determine the appropriate z-test? The appropriate z-test depends on whether you are testing a mean or proportion and whether you have one sample or two independent samples. The table below provides a quick summary of how to choose the right z-test depending on the research question.

Research QuestionZ Test to Use
Is one population mean different from a specified value?One-sample mean z-test
Are two independent population means different?Two-sample mean z-test
Is one population proportion different from a specified proportion?One-proportion z-test
Are two independent population proportions different?Two-proportion z-test

Note. You should only use a z-test for a single sample mean when the population standard deviation (σ) is known, or for two independent sample means only when both population standard deviations are known

Z Test Formulas

The formula for the z statistic varies depending on the type of z-test being performed.

One-Sample Z Test for a Mean

A one-sample z-test compares a sample mean with a hypothesized population mean when the population standard deviation (σ) is known.

The test statistic is:

z = (x̄ − μ₀) / (σ / √n)

Where:

  • x̄ is the sample mean
  • μ₀ is the hypothesized population mean
  • σ is the known population standard deviation
  • n is the sample size

The denominator, σ / √n, is the standard error of the sample mean.

Example 1.

A U.S. university uses a standardized quantitative assessment for incoming students. Historical records show that assessment scores have a population standard deviation of 7.7 points.

A random sample of 49 students has a mean score of 78.6. Test whether the population mean score differs from 76 at the 5% significance level.

Solution

The hypotheses are:

  • H₀: μ = 76
  • H₁: μ ≠ 76

From the question, we know that:

  • x̄ = 78.6
  • μ₀ = 76
  • σ = 7.7
  • n = 49
  • Significance level, α = 0.05

Substituting the values into the z-statistic formula, we get:

z = (78.6 − 76) / (7.7 / √49)

= 2.6 / 1.1

= 2.3636

For a two-tailed test, the p-value is 0.0181 (you can verify using the p-value from the z calculator) and the critical values are ±1.9600 (from the z-critical value calculator).

Since p < 0.05, we reject the null hypothesis (H₀). Therefore, at the 0.05 significance level, there is sufficient evidence that the population mean assessment score differs from 76.

Want a tool that performs this test and shows you the six hypothesis testing steps? Use the one-proportion test calculator.

Two-Sample Z Test for Independent Means

A two-sample z-test compares the means of two independent populations when both population standard deviations are known.

The z-test statistic formula is:

z=(x‾1−x‾2)−Δ0σ12n1+σ22n2z=\frac{(\bar{x}_1-\bar{x}_2)-\Delta_0} {\sqrt{\frac{\sigma_1^2}{n_1}+\frac{\sigma_2^2}{n_2}}}

Where:

  • x̄₁ and x̄₂ are the two sample means
  • σ₁ and σ₂ are the known population standard deviations
  • n₁ and n₂ are the sample sizes
  • Δ₀ is the difference between the population means assumed under the null hypothesis

When testing whether the two population means are equal, Δ₀ = 0.

Example 2.

A Canadian university compares scores from two independently administered academic skills programs. Previous institutional data show that the population standard deviations are 10.5 points for Program A and 9.8 points for Program B.

A sample of 60 students from Program A has a mean score of 75.4, while a sample of 55 students from Program B has a mean score of 71.2. Test whether the two population means differ at the 5% significance level.

Solution

The hypotheses are:

  • H₀: μ₁ − μ₂ = 0
  • H₁: μ₁ − μ₂ ≠ 0

From the question, we know that:

  • x̄₁ = 75.4
  • x̄₂ = 71.2
  • σ₁ = 10.5
  • σ₂ = 9.8
  • n₁ = 60
  • n₂ = 55
  • Hypothesized mean difference, Δ₀ = 0
  • Significance level, α = 0.05

Substituting the values into the two-sample z-statistic formula gives:

z = [(75.4 − 71.2) − 0] / √[(10.5² / 60) + (9.8² / 55)]

= 4.2 / 1.8931

= 2.2186

For a two-tailed test, the p-value is approximately 0.0265 (using the p-value from the z calculator), and the critical values are ±1.9600 (using the z-critical value calculator).

Since p < 0.05, we reject the null hypothesis (H₀). Therefore, at the 0.05 significance level, there is sufficient evidence that the population mean scores for the two academic skills programs differ.

Need a tool that performs this test and shows you all six hypothesis steps? Use the two-sample z-test calculator.

One-Proportion Z Test

A one-proportion z-test compares a sample proportion with a hypothesized population proportion.

The z statistic formula is:

z=p^−p0p0(1−p0)nz=\frac{\hat{p}-p_0}{\sqrt{\frac{p_0(1-p_0)}{n}}}

Where:

  • p̂ is the sample proportion, which is estimated using the formula p̂ = x / n, where x is the number of successes and n is the sample size
  • p₀ is the hypothesized population proportion
  • x is the number of successes
  • n is the sample size

Unlike a confidence interval for a proportion, the standard error for the hypothesis test is calculated using the hypothesized proportion, p₀.

Example 3.

A UK university reports that 60% of undergraduate students normally use its academic support services during their first year. After expanding the service, a random sample of 180 first-year students finds that 118 used the service.

Test whether the proportion of first-year students using the service has increased at the 5% significance level.

Solution

The hypotheses are:

  • H₀: p = 0.60
  • H₁: p > 0.60

From the question, we know that:

  • Number of students who used the service, x = 118
  • Sample size, n = 180
  • Hypothesized population proportion, p₀ = 0.60
  • Significance level, α = 0.05

First, calculate the sample proportion:

p̂ = x / n

= 118 / 180

= 0.6556

Substituting the values into the one-proportion z-statistic formula gives:

z = (0.6556 − 0.60) / √[0.60(1 − 0.60) / 180]

= 0.0556 / 0.0365

= 1.5215

For a right-tailed test, the p-value is approximately 0.0641 (using the p-value from the z calculator), and the critical value is approximately 1.6449 (using the z-critical value calculator).

Since p > 0.05, we fail to reject the null hypothesis (H₀). Therefore, at the 0.05 significance level, there is insufficient evidence that the proportion of first-year students using the academic support service has increased above 60%.

Need a tool that performs a one-proportion z-test and shows all the hypothesis steps? Use the one-proportion test calculator.

Two-Proportion Z Test

A two-proportion z-test compares proportions from two independent samples.

The sample proportions are: p̂₁ = x₁ / n₁ and p̂₂ = x₂ / n₂.

When testing H₀: p₁ = p₂, the two samples are combined to calculate the pooled proportion using the formula:

p̂c = (x₁ + x₂) / (n₁ + n₂)

After getting the pooled proportion (p̂c), we then compute the z statistic using the formula:

z=p^1−p^2p^c(1−p^c)(1n1+1n2)z= \frac{\hat{p}_1-\hat{p}_2} {\sqrt{\hat{p}_c(1-\hat{p}_c) \left(\frac{1}{n_1}+\frac{1}{n_2}\right)}}

Where:

  • p̂₁ and p̂₂ are the sample proportions
  • p̂c is the pooled sample proportion
  • x₁ and x₂ are the numbers of successes
  • n₁ and n₂ are the sample sizes

The two-proportion mode in this calculator tests whether the two population proportions are equal.

Example 4.

An Australian university compares completion of an optional online statistics module between students enrolled in two independent course formats.

In the first format, 96 of 140 students completed the module. In the second format, 77 of 135 students completed it. Test whether the population completion proportions differ at the 5% significance level.

Solution

The hypotheses are:

  • H₀: p₁ − p₂ = 0
  • H₁: p₁ − p₂ ≠ 0

From the question, we know that:

  • Number of completions in Sample 1, x₁ = 96
  • Sample 1 size, n₁ = 140
  • Number of completions in Sample 2, x₂ = 77
  • Sample 2 size, n₂ = 135
  • Significance level, α = 0.05

First, calculate the two sample proportions:

p̂₁ = x₁ / n₁

= 96 / 140

= 0.6857

and:

p̂₂ = x₂ / n₂

= 77 / 135

= 0.5704

Under H₀: p₁ = p₂, the pooled sample proportion formula is:p̂c = (x₁ + x₂) / (n₁ + n₂)

Substituting the values into the formula, p̂c = (96 + 77) / (140 + 135)

= 173 / 275

= 0.6291

Since we have all the required values, we substitute them into the two-proportion z-statistic formula.

This gives: z = (0.6857 − 0.5704) / √[0.6291(1 − 0.6291)(1 / 140 + 1 / 135)]

= 0.1153 / 0.0583

= 1.9796

For a two-tailed test, the p-value is approximately 0.0478 (using the p-value from the z calculator), and the critical values are ±1.9600 (using the z-critical value calculator).

Since p < 0.05, we reject the null hypothesis (H₀). Therefore, at the 0.05 significance level, there is sufficient evidence that the population completion proportions differ between the two course formats.

Want a single tool that conducts a two-sample proportion test and shows all the tests? Use the two-proportion test calculator.

When Should You Use a Z Test?

The conditions depend partly on whether you are testing means or proportions.

For a z-test for a mean, the population standard deviation, σ, should be known. The observations should also be independent, and the population should be approximately normal, or the sample should be sufficiently large for the sampling distribution of the mean to be approximately normal.

Knowing the population standard deviation is important. If σ is unknown and you estimate it using the sample standard deviation, s, you would normally use a T-test calculator instead.

For a z-test for proportions, the outcome should have two categories, such as pass/fail, yes/no, or success/failure. The sample should also be sufficiently large for the sampling distribution of the proportion to be approximated by the normal distribution.

For a one-proportion test, a commonly used condition is that both np₀ ≥ 10 and n(1 − p₀) ≥ 10. For a two-proportion test, each sample should contain enough successes and failures for the normal approximation to be reasonable.

The observations should also be independent. If sampling without replacement from a finite population, the sample is commonly kept below about 10% of the population to support the independence assumption.

Frequently Asked Questions

What is a z test calculator?

A z test calculator performs a hypothesis test using the standard normal distribution. This calculator can test one population mean, two independent population means, one population proportion, or two independent population proportions and returns the z statistic, p-value, and critical value.

Can I use a z-test if the population standard deviation is unknown?

No. If the population standard deviation is unknown when testing the hypothesis test for means and you are using the sample standard deviation to estimate it, use a t-test instead.

Does a z-test require a sample size greater than 30?

Not always. If the population is normally distributed and the population standard deviation is known, a z-test for a mean can be used with a smaller sample. For non-normal populations, larger samples may be needed for the sampling distribution of the mean to be approximately normal. Therefore, n = 30 should not be treated as a universal rule.

What is the difference between a z-test and a z-score?

A z-score describes the location of an individual observation relative to a mean in standard deviation units. A z-test statistic measures how far a sample statistic lies from the value specified by a null hypothesis in standard error units. They both use the standard normal distribution but answer different questions.

How do I know whether my z-test result is statistically significant?

Compare the p-value with the significance level, α. If p < α, reject the null hypothesis and conclude that the result is statistically significant at that level. If p ≥ α, fail to reject the null hypothesis.

Cite

Choose APA, MLA, Chicago, or Harvard. Citations credit StatCalc.net as the corporate author.

StatCalc.net. (2026, October 19). Z Test Calculator. Retrieved October 19, 2026, from https://statcalc.net/z-test-calculator/

About This Calculator

This calculator was developed by the StatCalc.net Team and statistically reviewed by , Senior Statistician & Editor.

Formulas, calculation logic, worked examples, and explanatory content are reviewed for statistical accuracy and clarity.