Hypothesis Test Calculator

Quick answer

A hypothesis test turns your sample into a test statistic, then into a p-value. If the p-value is at or below alpha, you reject H0. For a mean of 52 against mu0 = 50 with sigma = 8 and n = 64, z = 2.00 and p = 0.0455, so you reject H0 at the 5% level.

Updated 2026-09-27By Shakeel MuzaffarReviewed by Prof. Dr. Khalil Mudassar, PhD
Try
Hypothesis Test
Pick z when sigma is known, t when you only have the sample SD, or the proportion test for yes/no data.
The average of your sample.
The value of the mean under H0.
Known population standard deviation. Must be above 0.
Whole number, at least 2.
Choose the direction before you look at the data.
Common choices are 0.10, 0.05 and 0.01.
Decision
--
Test statistic--
Standard error--
p-value--
Critical value(s)--
Hypotheses--
Conclusion--

Calculations run in your browser. Inputs are not sent to our servers; anything you Save stays in this browser only.

Saved results (0)

How to Use the Calculator

  1. Pick the test type. Use the z-test when sigma is known, the t-test when you only have s, and the proportion test for yes or no data.
  2. Type your sample numbers and the value from your null hypothesis, such as mu0 = 50 or p0 = 0.5.
  3. Choose the alternative hypothesis: not equal, less than, or greater than. Then set alpha, which is usually 0.05.
  4. Read the decision at the top. The cards show the test statistic, standard error, p-value, critical values and a plain-language conclusion.
  5. Check the chart. The shaded tails are the rejection region, and the dashed line is your test statistic.

If the dashed line lands inside a shaded tail, the p-value is below alpha and you reject H0.

The Five Steps of a Hypothesis Test

Every test in this calculator follows the same five steps. Only the formula for the test statistic changes.

Step 1: State H0 and H1

The null hypothesis H0 says nothing has changed. The alternative H1 is the claim you want evidence for.

H0: mu = mu0, and H1: mu is not equal to, less than, or greater than mu0

Step 2: Choose Alpha

Alpha is the risk you accept of rejecting a true H0. Pick it before you collect data. The value 0.05 is the most common choice.

Step 3: Compute the Test Statistic

The statistic counts how many standard errors your sample sits from the H0 value.

z-test for a mean: z = (x-bar - mu0) / (sigma / sqrt(n))
t-test for a mean: t = (x-bar - mu0) / (s / sqrt(n)), with df = n - 1
One-proportion z-test: z = (p-hat - p0) / sqrt(p0 (1 - p0) / n), where p-hat = x / n

Step 4: Find the p-Value

The p-value is the tail area beyond your statistic. A two-sided test counts both tails.

p = 2 P(Z >= |z|) for two-sided, P(Z <= z) for left, P(Z >= z) for right

Step 5: Decide and Explain

Reject H0 if p is less than or equal to alpha. Otherwise, fail to reject H0. Then write the result in plain words about the real question.

Worked Example

A sample of 64 parts has a mean of 52. The target is 50, and sigma is 8. The standard error is 8 / sqrt(64) = 1, so z = (52 - 50) / 1 = 2.00. The two-sided p-value is 2 x 0.02275 = 0.0455. That is below 0.05, so we reject H0.

Choosing a z-Test, t-Test or Proportion Test

The right test depends on the kind of data you have and what you know about the population.

TestUse it whenDistribution
One-sample z-testYou test a mean and know the population SD, sigma.Standard normal
One-sample t-testYou test a mean and only have the sample SD, s.t with n - 1 df
One-proportion z-testYou test a share of yes results, like 58 of 100.Standard normal (approximate)

In real studies, sigma is rarely known. So the t-test is usually the right choice for a mean. The t curve has fatter tails, which makes it a little harder to reject H0 with small samples.

The proportion test needs enough data on both sides. Check that n x p0 and n x (1 - p0) are both at least 10. The calculator warns you when this check fails.

One-Sided vs Two-Sided Tests

A two-sided test asks whether the true value is different in either direction. Alpha is split, so each tail holds alpha / 2.

A one-sided test asks about one direction only, such as greater than. All of alpha sits in one tail, so the critical value is closer to zero.

H1TailCritical z at alpha = 0.05
mu is not equal to mu0Both tails-1.960 and +1.960
mu < mu0Left tail-1.645
mu > mu0Right tail+1.645

Use a one-sided test only when a result in the other direction would not matter to you. That choice has to come from your question, not from your data.

Type I and Type II Errors

Any test decision can be wrong. There are two ways it can happen.

H0 is trueH0 is false
Reject H0Type I error (chance = alpha)Correct decision (power)
Fail to reject H0Correct decisionType II error (chance = beta)

A smaller alpha cuts Type I errors but raises the chance of a Type II error. A larger sample lowers both. Our sample size calculator helps you plan that.

Common Mistakes

1. Saying You Accept H0

A large p-value only means the data are not strong enough to reject H0. It does not prove H0 is true. Say you fail to reject H0 instead.

2. Picking One-Sided After Seeing the Data

Switching to a one-sided test because the sample leaned one way halves the p-value. That doubles your real Type I error rate. Choose the direction before you collect data.

3. Reading p as the Chance H0 Is True

The p-value assumes H0 is true and asks how rare your data are. It is not the probability that H0 is true or false.

4. Using z When sigma Is Unknown

Putting s into the z formula makes p-values too small with small samples. Use the t-test when you estimate the SD from the sample.

5. Confusing Significant With Important

With a huge sample, a tiny difference can be significant. Always ask whether the size of the difference matters in practice.

How We Calculate

Test statistic
z = (x-bar - mu0) / (sigma / sqrt(n)); t = (x-bar - mu0) / (s / sqrt(n)) with df = n - 1; proportion z = (p-hat - p0) / sqrt(p0 (1 - p0) / n).
Normal tail
Computed from the complementary error function, erfc. A power series is used for small arguments and a continued fraction for large ones, accurate to about 1e-13.
t tail
P(T > t) = I_x(df / 2, 1 / 2) / 2 with x = df / (df + t^2). The regularized incomplete beta I uses a Lentz continued fraction, and log-gamma uses the Lanczos method.
Critical values
Found by bisection on the CDF until the bracket is narrower than 1e-12.
Decision rule
Reject H0 when p is less than or equal to alpha.
Chart
The density curve, rejection tails and statistic line are all plotted on the same to-scale axis.
Rounding
Statistics, standard errors, p-values and critical values show 6 decimal places.
Last reviewed
2026-09-27.

Frequently Asked Questions

What is a hypothesis test?

A hypothesis test is a way to check a claim about a population with sample data. You start by assuming the null hypothesis is true. Then you ask how surprising your sample would be under that assumption. A very surprising sample is evidence against the null hypothesis.

What does the p-value tell me?

The p-value is the chance of getting a result at least as extreme as yours if the null hypothesis were true. A small p-value means your data would be rare under H0. It is not the chance that H0 is true.

When do I reject the null hypothesis?

Reject H0 when the p-value is less than or equal to your significance level, alpha. With alpha = 0.05, a p-value of 0.0455 leads to rejecting H0. A p-value of 0.1096 does not.

Should I use a z-test or a t-test?

Use a z-test for a mean only when you know the population standard deviation, sigma. In most real studies sigma is unknown, so you use the sample standard deviation s and a t-test with n - 1 degrees of freedom.

Why do we say fail to reject instead of accept?

A test can only measure evidence against H0. A large p-value means the data do not rule H0 out, but it does not prove H0 is true. A small sample can miss a real effect, so accepting H0 would claim too much.

What is the difference between a one-tailed and a two-tailed test?

A two-tailed test looks for a difference in either direction, so alpha is split between both tails. A one-tailed test looks in one direction only. Choose the direction before you look at the data, based on your research question.

What sample size do I need for a proportion test?

The normal approximation works well when n times p0 and n times (1 - p0) are both at least 10. For p0 = 0.5 that means at least 20 people. If the check fails, an exact binomial test is the safer choice.

Sources

Related Guides

Related Calculators

Looking for more math tools?

Explore all math calculators

This calculator runs one-sample z-tests and t-tests for a mean and the one-proportion z-test. It assumes a random sample, and the proportion test uses the normal approximation. Results are for learning and planning; check important decisions with a statistician. Spotted an error? Let us know.

Author

shakeel-Muzaffar
Founder & Editor-in-Chief at  ~ Web ~  More Posts

Shakeel Muzaffar is the Founder and Editor-in-Chief of MultiCalculators.com, bringing over 15 years of experience in digital publishing, product strategy, and online tool development. He leads the platform's editorial vision, ensuring every calculator meets strict standards for accuracy, usability, and real-world value. Shakeel personally oversees content quality, formula verification workflows, and the platform's commitment to publishing tools that are genuinely useful for students, professionals, and everyday users worldwide.