induwara.lk
induwara.lkEducation · Statistics

T-Test Calculator — One-Sample, Paired & Two-Sample

Paste your data and get the t-statistic, degrees of freedom, p-value, confidence interval, and a plain-English verdict in one place. Supports one-sample, paired, and independent two-sample tests (pooled Student's and Welch's), with every step of the working shown.

By Induwara AshinsanaUpdated Jun 11, 2026
Student's t-test
NIST formulas · cross-checked
8 values

Paste numbers separated by commas, spaces, or new lines.

8 values

The second independent group.

Variance assumption
Try an example
Hypothesis tail

Any value from 0.0001 to 0.5. 0.05 is the usual default.

Fail to reject H₀ — not statistically significant (two-tailed p = 0.4111 ≥ α = 0.05).
Method: Two-sample pooled (Student's) t-test, equal variances, df = 14
t-statistic
0.8473
Degrees of freedom
14
p-value (two-tailed)
0.4111
one-tailed: 0.2055
95% CI for difference
[-1.531, 3.531]

Descriptive statistics

SeriesnMeanSample SD
Group 1 (A)852.1381
Group 2 (B)842.5635
Std. error of difference1.1802
Pooled SD (s_p)2.3604

Show working

  1. x̄₁ = 5 (n₁ = 8), x̄₂ = 4 (n₂ = 8)
  2. s_p = √[((n₁−1)s₁² + (n₂−1)s₂²)/(n₁+n₂−2)] = 2.360387
  3. SE = s_p · √(1/n₁ + 1/n₂) = 1.180194
  4. t = (x̄₁ − x̄₂) / SE = 1 / 1.180194 = 0.847319
  5. df = n₁ + n₂ − 2 = 14
  6. two-tailed p = I_{df/(df+t²)}(df/2, ½) = 0.4111

Cross-check: the p-value computed by the direct incomplete-beta identity and by 2·(1 − t-CDF) agree to machine precision.

Sources cited

How it works

A t-test asks whether an observed difference between means is larger than you would expect from random sampling variation alone. Every version reduces to the same shape: a t-statisticequal to the difference you care about divided by its standard error, compared against the Student's t distribution for the right degrees of freedom. The formulas below follow the NIST/SEMATECH e-Handbook of Statistical Methods.

One-sample. To test a sample mean x̄ against a hypothesised value μ₀, compute the sample standard deviation s with the n − 1 denominator, then SE = s / √n and t = (x̄ − μ₀) / SE, with df = n − 1.

Paired. When each value in sample A is matched to one in sample B (before/after the same subject), take the differences dᵢ = aᵢ − bᵢ and run a one-sample test on them against zero: t = d̄ / (s_d / √n), df = n − 1. Pairing removes between-subject variation, which usually makes the test more sensitive.

Two-sample, pooled (Student's). For two independent groups with similar spread, pool the variances: s_p² = [(n₁−1)s₁² + (n₂−1)s₂²] / (n₁+n₂−2). Then SE = s_p · √(1/n₁ + 1/n₂), t = (x̄₁ − x̄₂) / SE, and df = n₁ + n₂ − 2.

Two-sample, Welch's. The default for independent groups, because it does not assume equal variances: SE = √(s₁²/n₁ + s₂²/n₂). The degrees of freedom use the Welch–Satterthwaite formula, which produces a fractional df between the two sample sizes and is shown to two decimals.

The p-valueis read from the Student's t distribution. This tool evaluates that distribution through the regularised incomplete beta function I_x(a, b) — the two-tailed p-value equals Idf/(df+t²)(df/2, ½) — rather than a rounded printed table, so every t and df resolve exactly to display precision. A one-tailed p-value is half of that, in the direction the data point. Each result is cross-checked by computing the p-value a second, independent way; the two agree to machine precision. The displayed values were validated against the NIST table of critical t-values.

Worked examples

Two-sample, pooled (Student's)

Exam scores: Group A vs Group B, n₁ = n₂ = 8

  1. A = {5,7,5,3,5,3,3,9} → x̄₁ = 40/8 = 5
  2. B = {8,1,4,6,6,4,1,2} → x̄₂ = 32/8 = 4
  3. SS₁ = 32 → s₁² = 32/7 = 4.5714; SS₂ = 46 → s₂² = 46/7 = 6.5714
  4. s_p² = (32 + 46)/14 = 5.5714 → s_p = 2.3604
  5. SE = 2.3604 × √(1/8 + 1/8) = 1.1802
  6. t = (5 − 4) / 1.1802 = 0.847, df = 14

Two-tailed p ≈ 0.411 → fail to reject H₀ (no significant difference at α = 0.05).

Paired t-test

Blood pressure before vs after, n = 5 pairs

  1. Before = {120,125,130,118,122}, After = {115,120,128,112,118}
  2. Differences d = {5,5,2,6,4} → d̄ = 22/5 = 4.4
  3. SS_d = 9.2 → s_d² = 9.2/4 = 2.3 → s_d = 1.5166
  4. SE = 1.5166 / √5 = 0.6782
  5. t = 4.4 / 0.6782 = 6.487, df = 4

Two-tailed p ≈ 0.0029 → reject H₀ (the intervention lowered the measure).

One-sample t-test

Bag fill weight vs a 500 g target, n = 8

  1. Sample = {498,502,495,501,499,497,503,496} g → x̄ = 3991/8 = 498.875
  2. SS = 58.875 → s² = 58.875/7 = 8.411 → s = 2.900
  3. SE = 2.900 / √8 = 1.0253
  4. t = (498.875 − 500) / 1.0253 = −1.097, df = 7

Two-tailed p ≈ 0.309 → fail to reject H₀ (no evidence the mean differs from 500 g).

Frequently asked questions

Sources & references

Related tools

Rate this tool
Be the first to rate

Comments & feedback

Spotted a bug or want an improvement? Tell us — our team reviews every comment, and good ideas get built. Comments are public and anonymous.

Found a bug, edge case, or want to suggest an improvement?

Email me at [email protected] — most fixes ship within 24 hours.