Hypothesis Test Calculator
Last updated: 6 August 2026
Reviewed by Gavin Meiring, Lead research and primary author · Doctoral Candidate (Corporate Governance) · Research and drafting assisted by AI
Run a z-test for a population proportion or a one-sample t-test (or z-test with known σ) for a population mean. The tool reports the test statistic, two-sided or one-sided p-value, the critical value at the chosen significance level α, an explicit reject/fail-to-reject decision, and the corresponding (1 − α) confidence interval for the parameter. All distributions are computed from first principles — no precomputed tables, no network calls.
Hypothesis Test Calculator
The hypothesis test calculator performs a one-proportion z-test and a one-sample t-test (or one-sample z-test when the population standard deviation σ is known) for a population mean. It is used by clinical researchers testing whether a treatment response rate differs from historical baselines, by quality engineers checking whether a manufacturing line mean has shifted, by educators testing whether an intervention changed test scores, by A/B-testing analysts comparing conversion rates to a target, by ecologists comparing measured species proportions to expected ratios, by survey researchers checking whether a yes/no response rate matches a hypothesis, and by students learning the language of statistical significance. The hypothesis test is the formal machinery that turns "this looks different" into a defensible statement of evidence.
How to Use the Hypothesis Test Calculator
- Pick the test type: Proportion (z-test) or Mean (one-sample z or t).
- choose whether the population standard deviation σ is known (z-test) or must be estimated by the sample SD s (t-test, df = n − 1).
- Enter the inputs, for a proportion: n, x, and p₀; for a mean: n, x̄, μ₀, and the spread.
- Choose the alternative hypothesis: two-sided, greater than, or less than.
- Pick a significance level α (default 0.05).
- Click Calculate to see the test statistic, p-value, critical region, the reject/fail-to-reject decision, and the matching (1 − α) confidence interval.
- Interpret the decision in light of the assumptions and effect size, the p-value alone is never the whole story.
The Formulas
One-proportion z-test (test statistic, two-sided example):
z = (p̂ − p₀) / √(p₀(1 − p₀) / n)
with p̂ = x / n. The denominator is the standard error of p̂ under H₀ (it uses p₀, not p̂). One-sided p-values are 1 − Φ(z) for "greater" and Φ(z) for "less".
One-sample z-test for a mean (σ known):
z = (x̄ − μ₀) / (σ / √n)
One-sample t-test for a mean (σ unknown):
t = (x̄ − μ₀) / (s / √n), df = n − 1
P-value: two-sided → 2 · (1 − F(|stat|)); one-sided → 1 − F(stat) for "greater" or F(stat) for "less". Critical value at level α is the corresponding quantile of the standard normal (z) or Student-t (t, df = n − 1).
Confidence interval (1 − α, two-sided):
- Proportion: p̂ ± z_{α/2} · √(p̂(1 − p̂) / n)
- Mean (z): x̄ ± z_{α/2} · σ / √n
- Mean (t): x̄ ± t_{α/2, df} · s / √n
Worked Examples
Example 1, One-proportion z-test (two-sided)
A coin is flipped 100 times and lands heads 60 times. Is the coin fair?
p̂ = 60/100 = 0.6, p₀ = 0.5, n = 100
z = (0.6 − 0.5) / √(0.5 · 0.5 / 100) = 0.1 / 0.05 = 2.0
p-value (two-sided) = 2 · (1 − Φ(2.0)) ≈ 0.0455
Reject H₀ at α = 0.05. The data provide statistically significant evidence that the coin's true heads-proportion differs from 0.5.
Example 2, One-proportion z-test (right-tailed)
A factory claims that 50% of its products pass inspection. A random sample of 200 finds 120 pass. Test whether the true pass rate is greater than 0.5.
p̂ = 0.6, p₀ = 0.5, n = 200
z = (0.6 − 0.5) / √(0.5 · 0.5 / 200) = 0.1 / 0.0354 ≈ 2.828
p-value (one-sided, greater) = 1 − Φ(2.828) ≈ 0.0023
Strong evidence that the pass rate exceeds 0.5.
Example 3, One-sample t-test (two-sided, σ unknown)
A diet program claims a 75 kg average starting weight. A coach measures 25 new clients: x̄ = 78, s = 10. Test H₀: μ = 75 vs H₁: μ ≠ 75.
t = (78 − 75) / (10 / √25) = 3 / 2 = 1.5, df = 24
p-value (two-sided) ≈ 0.147
Fail to reject H₀ at α = 0.05, the data do not provide enough evidence that the average starting weight differs from 75 kg. (A 95% CI for μ is approximately (73.87, 82.13), which comfortably includes 75.)
Example 4, One-sample z-test (left-tailed, σ known)
A factory's process produces widgets with historical mean μ = 110 N and known σ = 15 N. A new sample of 16 widgets has mean 102 N. Test whether the new process has reduced strength.
z = (102 − 110) / (15 / √16) = −8 / 3.75 ≈ −2.133
p-value (one-sided, less) = Φ(−2.133) ≈ 0.0165
Reject H₀, significant evidence that the new process has reduced mean strength.
Example 5, Confidence interval for a proportion
A poll of 500 voters finds 250 in favour. The 95% CI for the true proportion is
p̂ ± 1.96 · √(0.5 · 0.5 / 500) = 0.5 ± 1.96 · 0.02236 ≈ (0.456, 0.544)
A hypothesis test of H₀: p = 0.5 would fail to reject, consistent with the interval containing 0.5.
Choosing the Right Test
| Scenario | Test |
|---|---|
| One sample proportion, normal approx valid | One-proportion z-test |
| One sample mean, σ known | One-sample z-test |
| One sample mean, σ estimated from data | One-sample t-test |
| Two independent groups, means | Two-sample t-test (not this tool) |
| Paired measurements | Paired t-test (not this tool) |
| Several groups | ANOVA (not this tool) |
| Non-normal small sample | Wilcoxon signed-rank / Mann-Whitney |
Assumptions
The z-test for a proportion requires that the normal approximation to the binomial is appropriate: n·p₀ ≥ 10 and n·(1 − p₀) ≥ 10. When this fails, use an exact binomial test.
The z-test for a mean assumes σ is genuinely known (rare in practice) and the population is approximately normal, or that n is large enough for the central limit theorem to make the sampling distribution of x̄ approximately normal.
The t-test assumes the underlying population is approximately normal. The test is reliable to moderate departures from normality when n is reasonably large; for very small samples (n < 30) with visibly skewed data, prefer a non-parametric alternative (Wilcoxon signed-rank) or a permutation test.
Independence of observations is required for all three tests. Clustered, time-series, or otherwise dependent data violate this and inflate false-positive rates.
Effect Size and Power
Beyond the binary reject/fail-to-reject decision, report a measure of effect size. For a proportion test, the effect is typically reported as p̂ − p₀ (or as a Cohen's h). For a mean test, Cohen's d = (x̄ − μ₀) / s is the standard metric; conventional thresholds label d ≈ 0.2 as small, 0.5 as medium, and 0.8 as large.
Power is the probability of correctly rejecting H₀ when it is false. Power rises with sample size, effect size, and α, and falls with population variance. A "fail to reject" result from an underpowered study is not evidence for H₀, it is just a lack of evidence against it. Use a sample-size calculator before collecting data if you want to guarantee a minimum detectable effect at a chosen power.
Common Mistakes
P-hacking. Running many tests, peeking at the data, and reporting only the significant one. Pre-register hypotheses and analyses; correct for multiple comparisons when you genuinely need many tests (Bonferroni, Holm, or FDR).
Confusing one- and two-sided alternatives. A two-sided test is the default. One-sided tests are appropriate only when the direction of the effect was specified before seeing the data, and even then, reviewers often demand a justification.
Reporting p > 0.05 as "no difference". A non-significant result is consistent with both the null and a range of alternative values. Always report the confidence interval alongside the p-value, so readers can see which alternative values remain plausible.
Mixing up s and σ. The t-test uses the sample standard deviation s; the z-test uses the population standard deviation σ. Using the wrong one gives wrong critical values and wrong p-values.
Confusing statistical and practical significance. A large sample can make a trivially small effect "highly significant". Report effect sizes and confidence intervals, not just p-values.
Where Hypothesis Tests Show Up
A/B testing. Comparing a new design's conversion rate to a target (one-proportion z-test) or comparing two design variants' average order values (two-sample t-test, not this tool, but the same logic).
Clinical trials. Testing whether a new treatment changes a continuous outcome (one-sample t-test against historical control) or changes a binary outcome rate (one-proportion z-test).
Quality engineering. Testing whether a process mean has shifted (one-sample t-test against the target), or whether a defect rate has changed (one-proportion z-test).
Survey research. Testing whether a yes/no response rate matches an expected proportion (one-proportion z-test); testing whether an average attitude score differs from a benchmark (one-sample t-test).
Education research. Testing whether an intervention changed average test scores (one-sample t-test) or changed a pass rate (one-proportion z-test).
Inputs and Their Effects
Sample size (n) is the most powerful lever you control. Larger n shrinks the standard error linearly (the SE scales as 1/√n), which shrinks the test statistic's magnitude and makes the p-value smaller. Doubling n roughly multiplies the test statistic by √2.
The null value (p₀ or μ₀) is the centre of the rejection calculation. As the observed statistic (p̂ or x̄) moves further from the null value, the test statistic grows and the p-value shrinks. Equivalently, the confidence interval widens away from the null value until it eventually excludes it.
The spread (s for the t-test, σ for the z-test) appears in the denominator. Larger spread → larger standard error → smaller |statistic| → larger p-value. The proportion z-test has no user-supplied spread; the SE is determined entirely by p₀ and n.
The significance level (α) defines the rejection threshold. Lower α (e.g. 0.01 instead of 0.05) makes rejecting H₀ harder and reduces false positives at the cost of more false negatives. It does not change the test statistic or the p-value; it only changes how the p-value is interpreted.
The alternative determines which tail(s) of the reference distribution the p-value is computed from. Two-sided tests the absolute magnitude of the statistic; one-sided tests the sign. Use one-sided only when the direction of the effect is fixed in advance.
Common Mistakes to Avoid
Equating "fail to reject H₀" with "H₀ is true". A non-significant result is consistent with H₀ and with a range of alternative values. The confidence interval is the more honest summary.
Forgetting the validity conditions. The proportion z-test needs n·p₀ ≥ 10 and n·(1 − p₀) ≥ 10 under H₀; without them, the normal approximation is poor and p-values are unreliable. The t-test needs approximate normality of the population (or a large n).
Looking up critical values in old tables. Published tables give critical values to two or three decimals. This tool computes them from first principles to high precision, so its answers can differ from a hand-lookup in the third decimal.
Treating the calculator as a decision-maker. The calculator reports the evidence against H₀. The decision to act on that evidence (publish, ship, treat) belongs to you, the domain expert, and depends on the costs of Type I and Type II errors, not just on whether p < 0.05.
When to Use This Tool
Use this tool when you have a single sample of data and want to test whether the underlying population mean or proportion equals a specific null value. It is the right tool for:
- A new feature's conversion rate against a target (proportion z-test).
- A new process's mean against a historical control (mean t-test or z-test).
- A poll's proportion against an expected value (proportion z-test).
- A lab measurement's mean against a published standard (mean t-test or z-test).
It is not the right tool for comparing two groups (use a two-sample t-test), for paired data (use a paired t-test), for more than two groups (use ANOVA), or for non-normal small samples (use a non-parametric test).
How the Math Works
Internally, the calculator uses two statistical functions: the standard-normal cumulative distribution function Φ(z) (approximated by the Abramowitz & Stegun 7.1.26 rational approximation, accurate to about 7.5×10⁻⁸) and its inverse Φ⁻¹(p) (Acklam's algorithm, accurate to about 1×10⁻⁹). These let it convert any z-statistic into a two-sided or one-sided p-value, and convert any α into a critical value, without looking up tables.
t-test, the calculator uses the regularised lower incomplete beta function I_x(a, b) to evaluate the Student-t CDF, and bisects on the t-CDF to find the inverse. Both routines are independent of network connectivity and have been verified against textbook quantiles: t_{0.975, 24} ≈ 2.0639, t_{0.95, 9} ≈ 1.8331, and so on.
The proportion z-test uses p₀ in the standard-error denominator (under the null), while the confidence interval for p̂ uses p̂ in its own SE, a subtle but important distinction. Both are correct; they answer different questions.
Practical Tips
- Default to two-sided tests. A two-sided test is harder to fool by chance and matches the default assumption that any direction of effect is interesting. One-sided tests are appropriate when the direction is genuinely fixed in advance (e.g. a non-inferiority trial, a quality floor you must not breach).
- Report the confidence interval alongside the p-value. A 95% CI tells you which values of the parameter are plausible at the 5% level; a p-value only tells you whether the null is among them.
- Plan the sample size before collecting data. A non-significant result is rarely a problem with the data, it's a problem with the study being too small to detect the effect of interest.
- Beware of multiple testing. Running 20 hypothesis tests at α = 0.05 produces roughly one significant-by-chance result even when every H₀ is true. Correct for this with Bonferroni, Holm, or a false-discovery-rate procedure.
- Match the spread to the test. Use s (sample SD) for the t-test; use σ (population SD) for the z-test. Using the wrong one is a common and silent error.
Troubleshooting Unexpected Results
The p-value is exactly 0.000. For floating-point reasons, very small p-values often round to 0.000 in printed output. The actual value is something like 4.3×10⁻¹²; the conclusion (reject H₀) is unchanged.
The p-value is much larger than I expected. Check the alternative: a two-sided test gives twice the one-sided p-value for |z| > 0. Also check the SD input: a typo in s or σ by a factor of 10 will move the test statistic by a factor of 10 and dramatically change the p-value.
The test statistic and the critical value disagree. They cannot, by construction: the test statistic is a number, the critical value is a number, and the decision (reject or not) follows from comparing them. If they appear to disagree, double-check that you are looking at the same family (z vs t) and the same tail (two-sided, greater, less).
The CI does not match the test decision. A (1 − α) CI and a level-α two-sided test must agree. If they appear to disagree, it is almost always a rounding issue, recompute with more decimal places.
The validity check warns that the normal approximation is questionable. Either collect more data (n large enough that n·p₀ ≥ 10 and n·(1 − p₀) ≥ 10), or use an exact binomial test instead of the normal approximation.
Related Concepts and Where This Fits
A hypothesis test answers the question "is the data consistent with a specific null value?" A confidence interval answers the question "which values of the parameter are plausible?". The two are mathematically equivalent: a (1 − α) two-sided CI that excludes the null value is exactly the same evidence as a level-α two-sided test that rejects H₀. Most modern statistics pedagogy recommends reporting both.
The p-value is a continuous measure of evidence; the 0.05 threshold is a convention, not a natural boundary. Reporting p = 0.049 as "significant" and p = 0.051 as "not significant" is poor practice, the difference is meaningless.
Bayesian methods answer a related but different question: "given the data, what is the posterior probability that H₀ is true?". The Bayesian framework requires a prior on the parameter, which the frequentist hypothesis test does not.
Equivalence testing (TOST, two one-sided tests) is the appropriate tool when you want to show that an effect is small enough to be practically negligible, rather than that it is non-zero.
Worked Examples and Edge Cases
Edge case: n = 1. Not supported for the mean test (df = 0, no t-distribution defined). proportion test, n = 1 with x = 0 or x = 1 gives a degenerate sample, the test is meaningless.
Edge case: x = 0 or x = n (proportion test). The normal approximation to the binomial breaks down; use an exact binomial test instead. The calculator will still compute a number, but the validity warning will fire.
Edge case: s = 0 (mean test). The standard error is zero, the test statistic is undefined, and the test cannot be performed. The calculator reports an error.
Edge case: extremely large n. With very large n, even tiny effects become "highly significant", this is a property of the framework, not a bug. Always interpret in light of effect size and practical significance.
Edge case: nearly-degenerate df. With df = 1, the t-distribution has infinite variance and the critical value for α = 0.05 is 12.706, orders of magnitude larger than the normal value of 1.96. The t-test rapidly becomes a more conservative test as df shrinks, which is why small samples need much larger effects to reach significance.
Frequently Asked Questions
What is a hypothesis test? A formal procedure for deciding whether a sample of data is consistent with a specific null hypothesis. It produces a test statistic, a p-value, a critical value, and a binary reject/fail-to-reject decision at the chosen significance level α.
Who invented the hypothesis test? The modern framework traces to R. A. Fisher in the 1920s (p-values, null hypothesis testing) and Jerzy Neyman and Egon Pearson in the 1930s (Type I/II errors, power, alternative hypothesis). The Student-t distribution underlying the t-test was published by W. S. Gosset in 1908 under the pseudonym "Student".
What is the difference between a one-tailed and a two-tailed test? A two-tailed test measures the probability of observing a test statistic as extreme as the one observed, in either direction. A one-tailed test measures the probability in one specified direction only. The two-tailed p-value is (approximately) twice the one-tailed p-value for a test statistic away from zero.
What does the p-value mean? The probability, under H₀, of observing a test statistic at least as extreme as the one observed. It is not the probability that H₀ is true, and it is not the probability that the result was due to chance alone. Small p-values are evidence against H₀, not evidence for any specific alternative.
What if the normal approximation is invalid? proportion z-test, use an exact binomial test (e.g. via a statistical package). t-test with non-normal small samples, use a non-parametric test (Wilcoxon signed-rank) or a permutation test.
What is a Type I error? Rejecting H₀ when it is actually true. The significance level α is the maximum acceptable Type I error rate.
What is a Type II error? Failing to reject H₀ when it is actually false. The probability β of a Type II error depends on the true parameter value, the sample size, and the significance level. Power = 1 − β is the probability of correctly rejecting H₀.
How do I increase the power of a test? Increase the sample size, increase α (less conservative), reduce measurement noise, or use a more efficient test design. Power analysis before data collection is the standard way to choose n.
**Q:**Can the Hypothesis Test Calculator be used for professional or commercial purposes?A: Yes, the Hypothesis Test Calculator The Hypothesis Test Calculator provides mathematically correct results that are suitable for professional, commercial, and educational use. The formulas used are well-established and validated against reference standards (Walpole-Myers-Myers, Casella-Berger, NIST/SEMATECH).
**Q:**How often are the formulas behind the Hypothesis Test Calculator updated? When standards change (e.g. revised critical-value tables, new normality corrections, updated guidance on multiple-testing corrections), this calculator is updated to reflect the current authoritative source. Each calculator's references section, including the Hypothesis Test Calculator, lists the specific sources used.
References
- Walpole, R. E., Myers, R. H. & Myers, S. L. Probability and Statistics for Engineers and Scientists, 9th ed., Chapters 8 to 10.
- Casella, G. & Berger, R. L. Statistical Inference, 2nd ed., Duxbury (2002).
- NIST/SEMATECH e-Handbook of Statistical Methods, Section 1.3.3 (one-sided and two-sided tests, p-values), https://www.itl.nist.gov/div898/handbook/.
- Student (Gosset, W. S.). "The Probable Error of a Mean" (1908), Biometrika 6: 1 to 25.
- Fisher, R. A. Statistical Methods for Research Workers, Oliver & Boyd.
- Neyman, J. & Pearson, E. S. (1933). "The testing of statistical hypotheses in relation to probabilities a priori", Mathematical Proceedings of the Cambridge Philosophical Society 29: 492 to 510.
- Lehmann, E. L. Testing Statistical Hypotheses, 2nd ed., Springer (1986).
- Cohen, J. Statistical Power Analysis for the Behavioral Sciences, 2nd ed., Lawrence Erlbaum (1988).