# Hypothesis Testing Calculator

URL: https://speedycalculator.com/calculators/statistics/hypothesis-testing/
Last updated: 2026-11-08

> The hypothesis testing calculator walks through a one-sample test for a mean (z-test with known σ or t-test) or for a proportion. It states H₀ and H₁, computes the test statistic, p-value and critical values, gives the decision at your α and lists every step.

## Inputs

- What are you testing?
- Data
- Hypothesised mean μ₀ (null hypothesis)
- Sample mean (x̄)
- Sample standard deviation (s)
- Sample size (n)
- Population standard deviation (σ)
- Sample data
- Sample size (n)
- Number of successes (x)
- Hypothesised proportion p₀ (%)
- Alternative hypothesis H₁
- Significance level (α)

## Results

- p-value
- Hypotheses
- Test statistic
- Statistic used
- Degrees of freedom
- Decision
- Critical value(s)
- Rejection region
- Sample estimate (x̄ or p̂)
- Standard error
- Confidence interval (two-sided, 1 − α)
- Step-by-step solution
- Test distribution with rejection region

## Formula

```
Mean, σ known: z = (x̄ − μ₀) ÷ (σ/√n) · Mean, σ unknown: t = (x̄ − μ₀) ÷ (s/√n), df = n − 1 · Proportion: z = (p̂ − p₀) ÷ √(p₀(1 − p₀)/n) · reject H₀ when p ≤ α
```

## Explanation

Hypothesis testing is a formal way to decide whether data contradict a claim. You start with a null hypothesis H₀, a specific value such as "the mean fill is 250 g", and an alternative H₁ that says the value is lower, higher or simply different. The test asks how surprising your sample would be if H₀ were true.

The answer comes in five steps: state the hypotheses and the significance level α; compute a test statistic that measures the distance between your estimate and the claimed value in standard-error units; find the p-value from the statistic's distribution; compare it with α (or compare the statistic with the critical value); and state the conclusion in plain words. This calculator shows each step for the three most common one-sample tests.

Remember that "do not reject H₀" is not the same as proving H₀ true. A small sample may simply lack the power to detect a real difference, so report the confidence interval as well, because it shows the range of values the data are consistent with.

### How to use the Hypothesis Testing Calculator

- **What are you testing?**
- **Data**
- **Hypothesised mean μ₀ (null hypothesis)**
- **Sample mean (x̄)**
- **Sample standard deviation (s)**
- **Sample size (n)**
- **Population standard deviation (σ)**
- **Sample data**
- **Sample size (n)**
- **Number of successes (x)**
- **Hypothesised proportion p₀**
- **Alternative hypothesis H₁**
- **Significance level (α)**

Everything is calculated in your browser, so results appear instantly and nothing you type is sent to a server.

### How it works

Choose the test and the form of the alternative hypothesis, then enter either summary statistics or the raw data. The calculator works out the standard error, the z or t statistic, the p-value and the critical value(s), and writes out the decision.

### Worked example

A cereal maker claims a mean pack weight of 250 g. A sample of 36 packs has x̄ = 247.6 g and s = 6.2 g. H₀: μ = 250, H₁: μ ≠ 250, α = 0.05.

The standard error is 6.2 ÷ √36 = 1.0333 g, so t = (247.6 − 250) ÷ 1.0333 = −2.323 with 35 degrees of freedom. The two-tailed critical values are ±2.030 and the p-value is 0.026. Because p ≤ 0.05, we reject H₀: the packs are lighter than claimed. The 95% confidence interval for the mean is 245.50 to 249.70 g.

For a proportion: 118 of 200 customers prefer a new design. Testing H₀: p = 0.5 against H₁: p > 0.5 gives z = (0.59 − 0.5) ÷ 0.03536 = 2.546 and p = 0.0055, a clear majority.

### Choosing the right test

SituationTestStatisticMean, σ knownOne-sample z-testzMean, σ unknownOne-sample t-testt, df = n − 1Proportion, large nOne-proportion z-testzTwo meansTwo-sample t-testtCounts in categoriesChi-square testχ²Three or more meansANOVAF

## Worked example

Inputs: What are you testing?: Mean – σ unknown (t-test); Data: Summary statistics; Hypothesised mean μ₀ (null hypothesis): 250; Sample mean (x̄): 247.6; Sample standard deviation (s): 6.2; Sample size (n): 36; Alternative hypothesis H₁: Two-tailed (H₁: not equal); Significance level (α): 0.05.

Results: **p-value = 0.03**; Hypotheses = H₀: μ = 250 vs H₁: μ ≠ 250; Test statistic = -2.3226; Statistic used = t statistic (df = 35); Degrees of freedom = 35; Decision = Reject H₀ at α = 0.05 – p = 0.0261 ≤ 0.05 and t = −2.3226 lies in the rejection region..

## Key terms

- **Null hypothesis (H₀)**: The claim being tested, usually "no effect" or "equals a stated value".
- **Alternative hypothesis (H₁)**: What you accept if the evidence against H₀ is strong enough: less than, greater than or not equal to.
- **Test statistic**: A number measuring how far the sample estimate is from H₀ in standard-error units.
- **Significance level (α)**: The largest risk of a Type I error you accept, fixed before the test.
- **p-value**: The probability, if H₀ is true, of a statistic at least as extreme as the one observed.

## FAQ

**What are the steps of a hypothesis test?**
State H₀ and H₁, choose α, compute the test statistic, find the p-value or critical value, and decide: reject H₀ if p ≤ α, otherwise do not reject.

**When do I use a z-test and when a t-test?**
Use z when the population standard deviation σ is known (rare) or for proportions. Use t when you estimate σ from the sample with s.

**What does "fail to reject H₀" mean?**
The data are not strong enough to rule out H₀. It does not prove H₀; a bigger sample might detect a difference.

**How do I choose between one- and two-tailed tests?**
Use one-tailed only if the direction was fixed before seeing the data and an effect in the other direction would not matter. Otherwise use two-tailed.

**What is a Type I and a Type II error?**
Type I: rejecting a true H₀ (probability α). Type II: failing to reject a false H₀ (probability β); power is 1 − β.

**Is the 250 g example significant?**
Yes: x̄ = 247.6, s = 6.2 and n = 36 give t = −2.32 with 35 df and p = 0.026, below α = 0.05.

**How large must n be for the proportion test?**
Both n·p₀ and n·(1 − p₀) should be at least about 10; otherwise use an exact binomial test.


## Sources

- [NIST/SEMATECH e-Handbook of Statistical Methods](https://www.itl.nist.gov/div898/handbook/)
- [OpenStax: Introductory Statistics 2e](https://openstax.org/details/books/introductory-statistics-2e)
- [Khan Academy: Statistics and probability](https://www.khanacademy.org/math/statistics-probability)
