Skip to content
K Knidox Search…
Statistics · Inference

T-Test Calculator

One-sample and two-sample t-tests with t-statistic, degrees of freedom, and p-value.

t-statistic
4.1704p < 0.05

df = 8.76 · two-tailed p = 0.0026

A one-sample t-test is t = (x̄ − μ₀) ÷ (s ÷ √n). For a sample mean of 52 against μ₀ = 50 with s = 4 and n = 16, the standard error is 1, so t = 2.0 on 15 df — below the 2.131 critical value, so it’s not significant at 0.05 (p ≈ 0.064).

Comparing means

A t-test asks whether a difference in means is larger than you’d expect from random sampling alone. It divides the observed difference by its standard error, giving a t-statistic: the bigger the t, the less likely the gap is pure chance. Use a one-sample test to compare one group against a known value, and a two-sample test to compare two independent groups.

t = (x̄ − μ₀) ÷ (s ÷ √n)

one-sample t; the denominator s ÷ √n is the standard error

Worked example

One-sample test: sample mean 52, hypothesized μ₀ = 50, sample SD 4, n = 16.

  1. 1
    Compute the standard error. SE = s ÷ √n = 4 ÷ √16 = 4 ÷ 4 = 1.
  2. 2
    Form the t-statistic. t = (52 − 50) ÷ 1 = 2.0, with df = n − 1 = 15.
  3. 3
    Compare to the critical value. At df = 15, the two-tailed 0.05 critical t is 2.131. Since 2.0 < 2.131, the result is not significant (p ≈ 0.064).

Two-tailed critical t-values (α = 0.05)

Reject the null when |t| exceeds the value for your degrees of freedom.

dfCritical tNote
52.571small sample
102.228
152.131example above
302.042
1.960converges to the z-value

Choosing the test and reading the result

Why Welch’s test. The two-sample mode uses Welch’s t-test, which does not assume the two groups share the same variance. It is the safer default and reduces to Student’s t-test when variances and sample sizes are equal.

One-tailed or two-tailed. This reports a two-tailed p-value, testing for a difference in either direction. Halve it for a one-tailed test, but only if you predicted the direction before collecting data.

Assumptions. The t-test assumes roughly normal data (or a large enough sample for the means to be normal) and independent observations. It is fairly robust to mild non-normality but sensitive to strong outliers.

Paired data. For before/after measurements on the same subjects, don’t use the two-sample test — run a one-sample test on the per-subject differences against μ₀ = 0.

One-tailed or two-tailed?
This reports a two-tailed p-value, which tests for a difference in either direction. Halve it for a one-tailed test in a direction you predicted in advance.
What if my groups are paired?
For paired data (before/after on the same subjects), run a one-sample test on the per-subject differences against μ₀ = 0.
How many values do I need?
At least two per group to estimate a variance, though larger samples give more reliable, more powerful results.
Why Welch’s test instead of Student’s?
Welch’s does not assume equal variances, so it stays valid when the two groups have different spreads or sizes. It matches Student’s when those are equal.
What are the assumptions?
Independent observations and approximately normal data (or a large enough sample). The test tolerates mild departures but is sensitive to strong outliers.
When should I use a one-sample versus a two-sample test?
Use the one-sample test to compare a single group’s mean against a known value μ₀; use the two-sample (Welch) test to compare the means of two independent groups.