Hypothesis Test Calculator
Run a one-sample, Welch, pooled or paired t test, a z test or a chi-square test online, with the p-value, critical value, decision and every step.
Separate values with spaces, commas, semicolons or new lines.
Chi-square tests are always right-tailed.
- Test statistic
- –
- Degrees of freedom
- –
- p-value
- –
- Critical value
- –
- –
- Decision
- –
Expected counts
Step by step
How to run a hypothesis test with this tool
- Choose the Test: one-sample t test, two-sample t test (Welch or pooled), paired t test, one-sample z test (σ known), chi-square goodness of fit or chi-square test of independence.
- For t and z tests, pick the Input: Raw data (paste your values, separated by spaces, commas, semicolons or new lines) or Summary statistics (mean, standard deviation and sample size).
- Enter the null value: the Hypothesized mean μ₀ for a one-sample test, or the Hypothesized difference Δ₀ for two-sample and paired tests (usually 0).
- Choose the Alternative hypothesis: Two-sided (≠), Left-tailed (<) or Right-tailed (>), and the Significance level α (0.05 by default; “5%” also works).
- The results update as you type, or click Calculate. You get the test statistic, the Degrees of freedom, the p-value, the Critical value, a confidence interval, the Decision and a Step by step breakdown. Copy copies a short summary.
For a chi-square goodness-of-fit test, type the Observed counts and, optionally, the Expected proportions or counts (leave empty to test equal proportions). For a test of independence, type the Contingency table with one row per line.
Which test should you use?
- One-sample t test: compare the mean of one sample with a reference value when the population standard deviation is unknown (the usual case).
- One-sample z test: the same question when σ is truly known, for example from a long-running manufacturing process.
- Welch t test: compare the means of two independent groups. It does not assume equal variances and is the safer default.
- Pooled t test (Student): two independent groups whose variances you have good reason to believe are equal.
- Paired t test: two measurements on the same subjects (before/after, left/right). The tool works on the differences d = x₁ − x₂, so both series must be in the same order.
- Chi-square goodness of fit: do observed category counts match a theoretical distribution?
- Chi-square test of independence: are two categorical variables associated in a contingency table?
Formulas
- One-sample: t = (x̄ − μ₀) / (s/√n), df = n − 1. For the z test, σ replaces s and the reference distribution is the standard normal.
- Welch: t = (x̄₁ − x̄₂ − Δ₀) / √(s₁²/n₁ + s₂²/n₂), with Welch–Satterthwaite degrees of freedom df = (v₁ + v₂)² / (v₁²/(n₁ − 1) + v₂²/(n₂ − 1)), where vᵢ = sᵢ²/nᵢ. The df is usually not a whole number.
- Pooled: sp² = ((n₁ − 1)s₁² + (n₂ − 1)s₂²)/(n₁ + n₂ − 2), SE = sp·√(1/n₁ + 1/n₂), df = n₁ + n₂ − 2.
- Chi-square: χ² = Σ(O − E)²/E, with df = k − 1 (goodness of fit) or (r − 1)(c − 1) (independence, where E = row total × column total ÷ N). No continuity correction is applied.
The p-values come from exact distribution functions: the Student t CDF is computed with the regularized incomplete beta function and the chi-square and normal CDFs with the regularized incomplete gamma function, both evaluated with continued fractions. They agree with statistical software to many decimal places, including very small p-values.
Reading the result
If p ≤ α, the tool says Reject H₀: data this extreme would be unlikely if the null hypothesis were true. Otherwise it says Do not reject H₀, which is not the same as proving H₀. The confidence interval (two-sided, level 1 − α) shows the range of plausible values for the mean or the difference and says more about effect size than the p-value alone. The results are an aid for learning and checking your work; the choice of test, the assumptions and the interpretation remain yours.
Frequently asked questions
Should I choose Welch or the pooled t test?
Welch in most cases. It stays accurate when the variances or the sample sizes differ, and loses almost nothing when they are equal. The pooled test is mainly used when a course or a protocol requires it.
When is a one-tailed test appropriate?
Only when the direction was decided before seeing the data and a result in the other direction would be of no interest. A one-tailed p-value is half the two-sided one when the statistic points the expected way, so choosing it after the fact inflates false positives.
What does the warning about expected counts below 5 mean?
The chi-square test relies on an approximation that becomes poor when expected counts are small. Merge sparse categories, collect more data or use an exact test such as Fisher’s for a 2 × 2 table.
Why can the degrees of freedom be a decimal number?
In the Welch test, the Welch–Satterthwaite formula gives an approximate, usually non-integer df. The t distribution is defined for any positive df, so the tool uses it as is instead of rounding.
What are the assumptions of the t test?
Independent observations and, for small samples, roughly normal data (or differences, for the paired test). With larger samples (say 30 or more per group) the t test is robust to moderate non-normality thanks to the central limit theorem.
Related tools
- Standard Deviation Calculator Standard deviation calculator for sample and population data. Get the variance, mean, sum of squares and standard error, with every step of the formula shown.
- Probability Calculator Probability calculator with exact fractions and steps for AND/OR, Bayes' theorem, at least one success, binomial distribution and odds.
- Average Calculator Free average calculator that finds the mean, median, mode and range of a list of numbers, with the sum, count, minimum, maximum and every step shown.