← Home

📈 T-Test Calculator

T-Test Calculator is a free statistics tool that performs one-sample and two-sample t-tests directly in your browser. Enter your sample mean, hypothesized mean, standard deviation, and sample size to compute the t-statistic, degrees of freedom, approximate p-value, and the critical t-value at α = 0.05. For comparing two independent groups, switch to the Welch's t-test mode and enter both samples. No data leaves your device and no account is required.

Calculate one-sample and two-sample (Welch's) t-test statistics, degrees of freedom, p-values, and critical values.

What is this tool?

A t-test is a statistical hypothesis test that determines whether a sample mean is significantly different from a known or hypothesized value, or whether two independent samples have different means. The test produces a t-statistic that follows the Student's t-distribution under the null hypothesis. Unlike the z-test, the t-test does not require the population standard deviation to be known, which makes it far more practical for real research with limited data. Researchers pair it with the p-value calculator to report significance and with the confidence interval calculator to express the uncertainty around the estimate.

There are two main scenarios this tool handles. A one-sample t-test compares a single sample against a reference value (μ₀) — for example, testing whether a batch of light bulbs lasts as long as the manufacturer claims. A two-sample (Welch's) t-test compares the means of two independent groups that may have unequal variances, such as test scores from two different teaching methods. Welch's version is preferred over Student's pooled t-test because it is more robust when the two samples have different standard deviations or sizes. Use the standard deviation calculator to obtain s from raw data before running the test.

0 Reject Reject t-distribution −t* +t*

The shaded tails on each side represent the rejection regions. If the computed t-statistic falls beyond the critical value ±t*, we reject the null hypothesis H₀ at the chosen significance level (typically α = 0.05, two-tailed). Otherwise, we fail to reject H₀ and conclude there is insufficient evidence of a difference.

How it works

The calculator applies the standard formulas for the one-sample and Welch's two-sample t-test.

One-sample t-test

t = (x̄ − μ₀) / (s / √n)
df = n − 1

Here x̄ is the sample mean, μ₀ is the hypothesized population mean, s is the sample standard deviation, and n is the sample size. Larger absolute values of t indicate stronger evidence against the null hypothesis.

Two-sample Welch's t-test

t = (x̄₁ − x̄₂) / √(s₁²/n₁ + s₂²/n₂)
df = (s₁²/n₁ + s₂²/n₂)² / [ (s₁²/n₁)²/(n₁−1) + (s₂²/n₂)²/(n₂−1) ]

Welch's formula does not assume equal variances, which is why it is the default choice for two independent samples. The degrees of freedom are typically fractional and are rounded for the critical-value lookup.

P-value and decision

The two-tailed p-value is approximated from the t-distribution. For df ≤ 30 we use a hard-coded critical-value table; for larger df we approximate with the standard normal distribution. If |t| > critical value at α = 0.05, the result is statistically significant and we reject H₀; otherwise we fail to reject H₀.

Critical t-values (two-tailed, α = 0.05 and 0.01)

dfα = 0.05α = 0.01dfα = 0.05α = 0.01
112.70663.657162.1202.921
24.3039.925172.1102.898
33.1825.841182.1012.878
42.7764.604192.0932.861
52.5714.032202.0862.845
62.4473.707212.0802.831
72.3653.499222.0742.819
82.3063.355232.0692.807
92.2623.250242.0642.797
102.2283.169252.0602.787
112.2013.106262.0562.779
122.1793.055272.0522.771
132.1603.012282.0482.763
142.1452.977292.0452.756
152.1312.947302.0422.750
∞1.9602.576

The last row (∞) corresponds to the standard normal (z) distribution.

t-test vs z-test comparison

Featuret-testz-test
Population SD known?No (estimated from sample)Yes (σ known)
Sample sizeAny, best for small nLarge n (≥ 30) or σ known
Distribution usedStudent's t-distributionStandard normal distribution
Critical value (α=0.05)Depends on df, larger for small nAlways ±1.96
As n → ∞Converges to z-testSame
Typical useResearch with estimated SDQuality control, large samples

Because the population SD is almost never known in practice, the t-test is the safer default. The two approaches give nearly identical results once n exceeds 30.

Ad

How to use

  1. Choose the test type — Select One-sample or Two-sample (Welch's) mode from the dropdown at the top of the form.
  2. Enter the sample data — For one-sample, type the sample mean (x̄), hypothesized mean (μ₀), standard deviation (s), and sample size (n). For two-sample, enter both samples' means, SDs, and sizes.
  3. Click Calculate — The tool computes the t-statistic, degrees of freedom, approximate two-tailed p-value, and the critical t-value at α = 0.05.
  4. Read the conclusion — The result states whether to reject or fail to reject the null hypothesis H₀ at the 0.05 significance level.
  5. Interpret with context — Compare the p-value against your chosen α, and consider effect size and confidence interval before drawing real-world conclusions.

Frequently Asked Questions

When should I use a t-test instead of a z-test?

Use a t-test when the population standard deviation is unknown and must be estimated from the sample. The z-test requires the population σ to be known, which is rare in practice. As sample size grows, the t-distribution converges to the normal distribution, so for large samples the two tests give nearly identical results. For small samples (n < 30) the t-test is the correct choice.

What is the difference between Student's t-test and Welch's t-test?

Student's (pooled) two-sample t-test assumes both samples come from populations with equal variances. Welch's t-test does not make this assumption and adjusts the degrees of freedom accordingly. Welch's version is more robust when the two samples have unequal variances or unequal sizes, and it is now recommended as the default for two independent samples.

What is a p-value?

The p-value is the probability of observing a t-statistic at least as extreme as the one computed, assuming the null hypothesis is true. A small p-value (typically below 0.05) indicates that the observed data would be unlikely under H₀, so we reject H₀. It does not measure the probability that the hypothesis is true.

What does 'fail to reject H₀' mean?

It means the evidence is not strong enough to conclude a difference exists. This is not the same as proving H₀ is true — the study may simply lack statistical power. A larger sample, a larger effect size, or a less stringent significance level could change the conclusion.

How accurate is the p-value from this calculator?

The p-value is approximated from a critical-value lookup for df 1–30 and from the standard normal distribution for larger df. It is accurate enough for coursework and general interpretation, but for publication-grade research use dedicated statistical software (R, SPSS, SciPy) that computes the exact cumulative distribution function.

Can I use a one-tailed test?

This tool reports two-tailed p-values and critical values by default. A one-tailed test is appropriate only when you have a strong a priori reason to expect the difference to go in one direction, and you commit to that direction before collecting data. Halving the two-tailed p-value gives the one-tailed value if needed.

Tips & Advice

Always check the assumptions of the t-test before trusting the result: the data should be approximately normally distributed (especially for small n) and the observations should be independent. For sample sizes above 30 the central limit theorem makes the t-test quite robust to non-normality. For paired or matched data (before/after measurements on the same subjects), use a paired t-test instead of the two-independent-sample version — this tool does not cover paired designs. Remember that a significant p-value tells you a difference exists, but not its size or practical importance; always report effect sizes and confidence intervals alongside the p-value.

Related Tools

Sources & References

Limitations

This t-test calculator provides an educational approximation of the p-value. The exact two-tailed p-value depends on the cumulative distribution function of the t-distribution, which this tool approximates using a critical-value table for df ≤ 30 and the normal distribution for larger df. The tool assumes the underlying populations are approximately normally distributed and that the samples are independent and randomly drawn. It does not support paired-sample t-tests, one-tailed tests directly, or ANOVA designs. For publication-grade research, clinical trials, or regulatory submissions, use dedicated statistical software that computes the exact CDF (R, SPSS, SAS, SciPy, Stata). Always verify the normality assumption and inspect your data for outliers before relying on the result.

Ad