Hypothesis Test Calculator

Run a one-sample z-test or t-test.
Enter sample mean, hypothesized mean, standard deviation, and sample size to get test statistic and p-value.

Hypothesis Test

A hypothesis test starts with two competing claims. The null hypothesis (H0) says there is no effect: the population mean equals some specified value mu0. The alternative hypothesis (H1) says the mean is different (two-tailed), greater than (right-tailed), or less than (left-tailed) mu0. You use sample data to decide which claim the evidence supports.

The test statistic: z (or t) = (x-bar - mu0) / (sigma / sqrt(n))

This measures how many standard errors the sample mean sits away from the hypothesized mean. A test statistic near zero supports the null. A large absolute value, large enough that such a result would be rare if H0 were true, leads to rejection.

The p-value is the probability of observing a test statistic at least as extreme as yours, assuming H0 is true. If p < alpha, reject H0. If p >= alpha, fail to reject H0.

Use a z-test when the population standard deviation is genuinely known. Use a t-test when you estimated it from the sample, which is nearly always. The t-distribution has heavier tails that account for that extra uncertainty, and they matter most when n is small.

The familiar “use z when n >= 30” rule is a shortcut from the era of printed tables, not a statistical requirement. The t-test is the correct choice whenever sigma is estimated, at any n; it simply converges to the z-test as the sample grows, so past about 30 the two agree closely enough that nobody minded. With a computer doing the arithmetic there is no reason to switch. The difference is not always negligible either: at 9 degrees of freedom the two-tailed 5% cutoff is 2.262 rather than 1.960, so a statistic of 2.0 is significant on the z-test and not significant on the t-test.

Common significance levels:

  • alpha = 0.05: used in most published research; roughly 1 in 20 chance of a false positive
  • alpha = 0.01: more conservative; used in medicine and safety-critical decisions
  • alpha = 0.10: used in exploratory research where false negatives are costly

The chart plots the sampling distribution under H0, showing the test statistic location and shading the rejection region(s) in red.


How we build and check this calculator

This calculator runs entirely in your browser, so the numbers you enter stay on your device. The math behind it is written by hand and tested against worked examples and standard references before the page goes live.

SuperGlobalCalculator is independently built and maintained. See how we build and verify our calculators.

Embed This Calculator

Copy the code below and paste it into your website or blog.
The calculator will work directly on your page.