Hypothesis Testing Calculator
Test a claim about a mean or a proportion. Choose a z-test or t-test, enter your sample data, and get the test statistic, p-value, critical value, and a clear reject or fail-to-reject decision with the working shown.
Reject H₀ when the p-value is below α
—
—
—
—
—
—
—
—
—
—
—
—
—
—
—
Sampling Distribution under H₀
—
How it was calculated
Test summary
Notes on this result
Decision at Other Significance Levels
| Significance level (α) | Critical value | Decision |
|---|
How to Use This Calculator
- Choose what you are testing: one mean, the difference between two means, one proportion, or the difference between two proportions.
- Pick the alternative hypothesis. Use two-tailed if you want to detect a difference in either direction, and a one-tailed option only if you decided on a direction before seeing the data.
- For means, choose the t-test when the population standard deviation is unknown (the usual case) and the z-test when it is known. You can enter summary values or paste the raw data.
- Enter the sample values and the hypothesized value, then select the significance level. Most studies use α = 0.05.
- Press Run Test. If the p-value is below α, reject the null hypothesis. Otherwise, fail to reject it.
What Is Hypothesis Testing?
A hypothesis testing calculator evaluates statistical evidence against a null hypothesis using sample data. It calculates test statistics, p-values, and statistical significance for tests such as z-tests and t-tests. Enter sample statistics, the hypothesized population parameter, and a significance level, commonly 0.05, to determine whether to reject the null hypothesis.
Hypothesis testing itself is a way to judge a claim about a population. You start by assuming the claim you want to challenge, the null hypothesis (H₀), is true. You then ask how likely your data would be if that were so. If the data would be very unlikely, you reject H₀ in favor of the alternative hypothesis (H₁). If not, you fail to reject it.
The outcome is never proof. A test only measures how well the data agree with H₀, and every decision carries a risk of error.
H₀
The claim to challenge: no effect, no difference.
H₁
What you suspect instead: a difference, or a change in one direction.
α
The risk of rejecting a true H₀ that you accept. Usually 0.05.
Introduction: Penn State — Hypothesis Testing.
Hypothesis Testing Formulas
z-test for one mean
z = (x̄ − μ₀) ÷ (σ ÷ √n)
Use when the population standard deviation σ is known.
t-test for one mean
t = (x̄ − μ₀) ÷ (s ÷ √n), df = n − 1
Use the sample standard deviation s when σ is unknown.
t-test for two means (Welch)
t = (x̄₁ − x̄₂ − Δ₀) ÷ √(s₁²/n₁ + s₂²/n₂)
Degrees of freedom come from the Welch–Satterthwaite formula. The pooled version assumes equal variances.
z-test for proportions
z = (p̂ − p₀) ÷ √(p₀(1 − p₀) ÷ n)
For two proportions, use the pooled p̄ in the standard error: √(p̄(1 − p̄)(1/n₁ + 1/n₂)).
Decision rules
P-value rule: reject H₀ if p < α.
Critical-value rule: reject H₀ if |statistic| > critical value (two-tailed), statistic > critical value (right-tailed), or statistic < −critical value (left-tailed).
Both rules always give the same answer.
Test definitions: NIST/SEMATECH e-Handbook — Two-sample t-test for equal means.
Worked Example 1: z-test for One Mean
A factory claims its product averages 500 g. A sample of 30 products has a mean of 495 g, and the known standard deviation is 10 g. Test at α = 0.05.
- Hypotheses: H₀: μ = 500 and H₁: μ ≠ 500 (two-tailed).
- Statistic: z = (495 − 500) ÷ (10 ÷ √30) = −2.7386.
- Critical values: ±1.9600. The p-value is 2 × P(Z < −2.7386) = 0.0062.
- Because |z| > 1.96 and p < 0.05, reject H₀: the data are not consistent with a mean of 500 g.
Worked Example 2: t-test for One Mean
A test is designed to have a mean score of 100. A sample of 25 people gives x̄ = 104.5 and s = 9.
- Statistic: t = (104.5 − 100) ÷ (9 ÷ √25) = 2.5, with 24 degrees of freedom.
- P-value: 0.0197 (two-tailed). The critical values are ±2.0639 at α = 0.05 and ±2.7969 at α = 0.01.
- The result is significant at 5% but not at 1%. The 95% confidence interval for the mean is 100.78 to 108.22.
Worked Example 3: z-test for Two Proportions
Page A converts 120 of 1,000 visitors (12%) and page B converts 150 of 1,000 (15%). Is the difference real at α = 0.05, two-tailed?
- Pooled proportion: p̄ = 270 ÷ 2,000 = 0.135, so the standard error is √(0.135 × 0.865 × 2/1000) = 0.01528.
- Statistic: z = (0.12 − 0.15) ÷ 0.01528 = −1.9630, and the p-value is 0.0496.
- The p-value is just below 0.05, so reject H₀, but only narrowly. A different α or a few more visitors could change the decision.
Which Test Should I Use?
Match the test to your data and what you know about the population.
| Situation | Test | Notes |
|---|---|---|
| One mean, σ known | z-test | Rare in practice. Normal data, or a large sample. |
| One mean, σ unknown | t-test | The usual choice. Data roughly normal, or n of about 30 or more. |
| Two independent means | Welch t-test | Safe default. Use pooled only if the variances are clearly similar. |
| One proportion | z-test | Needs at least 10 expected successes and 10 failures. |
| Two proportions | Pooled z-test | Independent groups. Use an exact test for small counts. |
| Paired measurements | One-mean t-test on the differences | Enter each pair's difference as one value, with μ₀ = 0. |
This calculator does not run chi-square tests or ANOVA. Those are used for categorical tables and for three or more group means.
Decisions and Errors
A test can be right or wrong in two different ways.
| H₀ is true | H₀ is false | |
|---|---|---|
| Reject H₀ | Type I error (false positive), probability α | Correct. Probability 1 − β is the power. |
| Fail to reject H₀ | Correct. Probability 1 − α. | Type II error (false negative), probability β |
The p-value is the probability of getting a result at least as extreme as yours if H₀ were true. It is not the probability that H₀ is true, and it says nothing about how large or important the effect is.
P-value definition: Wikipedia — P-value.
Frequently Asked Questions
What is the purpose of hypothesis testing?
Hypothesis testing uses sample data to decide whether a claim about a population is supported. It tests the null hypothesis against the alternative hypothesis and gives a structured, repeatable way to turn evidence into an inference: is an observed difference likely to be real, or could it easily be due to chance? A hypothesis testing calculator like this one runs the steps for you and states the decision.
How do I perform a hypothesis test?
State H₀ (the null hypothesis) and H₁ (the alternative hypothesis), choose α (alpha), collect the sample, and compute the test statistic, which measures how far the sample mean is from the hypothesized population mean in units of the standard error. Then find the p-value (or the critical value) and compare: reject H₀ if p < α. Finally, write the result in plain words about the original claim.
What is the significance level?
The significance level α is the threshold you set, before looking at the data, for how much risk of a false positive you will accept. With α = 0.05 you accept a 5% probability of rejecting a null hypothesis that is actually true, which is a Type I error. The matching confidence level is 1 − α, so 95%. Lower values such as 0.01 are stricter.
What is a p-value, and how do I use it?
The p-value is the probability of seeing a result at least as extreme as yours if H₀ were true, read from the distribution of the test statistic: the normal distribution for a z-test and the t-distribution for a t-test. A small p-value means your data are hard to explain under H₀. Compare it with α: if p < α, reject H₀. A p-value of 0.03 does not mean H₀ has a 3% chance of being true.
What is a Type I error?
A Type I error is rejecting a null hypothesis that is true, also called a false positive. Its probability is the significance level α. A Type II error is the opposite mistake: failing to reject a null hypothesis that is false. Its probability is β, and 1 − β is the statistical power, which grows with the sample size and with the effect size.
Should I use a z-test or a t-test?
Use a z-test only when the population standard deviation is known. When you estimate it from the sample, which is almost always, use a t-test, which relies on the t-distribution with n − 1 degrees of freedom. The two give nearly the same answer for large samples, but the t-test is more cautious for small ones. For yes/no data, a proportion test is the z-based choice, and a chi-square test is the tool for counts in a table; this calculator does not run the latter.
Should I use a one-tailed or a two-tailed test?
Use a two-tailed test unless you would truly ignore an effect in the opposite direction, and you decided that before collecting the data. A one-tailed test puts the whole rejection region in one tail, so its critical value is smaller and it has more power in its chosen direction. A two-tailed test splits α between both tails and leaves the acceptance region in the middle. A one-tailed test cannot detect a change the other way, and choosing it after seeing the data inflates the false-positive rate.
Does failing to reject H₀ mean H₀ is true?
No. It means the data did not give enough evidence against H₀. A small sample or a small effect can easily produce a non-significant result even when H₀ is false. A confidence interval shows which population values the data still allow.
Other Useful Calculators
Bonferroni Correction Calculator
Adjust α when you run several tests.
Power Analysis Calculator
Sample size, power, and detectable effect.
Correlation Coefficient Calculator
Pearson, Spearman, and Kendall with a p-value.
Raw Score Calculator
Convert a z-score or percentile back to a raw score.
Empirical Rule Calculator
The 68-95-99.7 rule for normal data.
Poisson Distribution Calculator
Probability of a number of events in an interval.