A/B tests · For studentsStudent's t-test calculator

An online t-test solved step by step: Welch's test for two independent samples (the default), Student's test with equal variances, a paired before-and-after test and a one-sample test against μ₀. The t statistic, degrees of freedom, p-value, critical value, the confidence interval of the difference and Cohen's d; checks of normality and variances, a printable solution and Python and R code.

Your numbers stay in the browser and are never sent anywhere

01Data02Result03Step by step04Assumptions05Code06Problems07Questions08Related
01

Data

Test

Two independent samples without assuming equal variances — the safe default: with equal variances it gives almost the same as Student's test, with unequal ones it does not go wrong.

Numbers separated by spaces, semicolons, “, ” or new lines — you can paste a column from Excel. Decimals with a point or a comma.

α = 0.05 · two-sided test
02

Result

t statistic
2.887
Degrees of freedom
5.54
p-value
0.0305
Effect size, Cohen's d
1.83
large
Significant
|t| = 2.887 > t crit = 2.497, p = 0.0305 < 0.05 — reject H₀: the means differ.
03

Step by step

  1. 1
    Input data
    A: nA = 5, xA = 13, s2A = 2.5B: nB = 5, xB = 18, s2B = 12.5
  2. 2
    Hypotheses
    H0: μA = μBH1: μA ≠ μB
  3. 3
    Formula and substitution
    t = xB − xA√s2A/nA + s2B/nB = 5√0.5 + 2.5 = 2.887df = (s2A/nA + s2B/nB)²(s2A/nA)²/(nA − 1) + (s2B/nB)²/(nB − 1) = 5.54
  4. 4
    Critical value and p-value
    tcrit(0.05; 5.54) = 2.497p = 2 · P(T > |t|) = 0.0305
  5. 5
    Conclusion
    |t| = 2.887 > t crit = 2.497 — reject H₀. Confidence interval of the difference (95%): from 0.6747 to 9.3253. Effect size d = 1.83 — large.
04

Checking the assumptions

Normality (Shapiro–Wilk)

A: W = 0.987, p = 0.967; B: W = 0.836, p = 0.154. No departure from normality is visible. With small n the check is weak.

Equality of variances

Levene (median): W = 0.595, p = 0.463; F-test: F = 5.00, p = 0.148. A difference in variances is not shown.

In B the values 24 lie far from the rest (beyond 1.5 interquartile ranges).

The data are skewed — cross-check with the Mann–Whitney test.Mann–Whitney
05

Check in Python / R

Check in Python / R
from scipy.stats import ttest_ind

ttest_ind([16, 18, 15, 17, 24], [12, 15, 11, 14, 13], equal_var=False)
06

Problems

07

Frequently asked questions

When comparing the means of a numeric measure: height, scores, time, blood pressure. Two independent groups take the independent-samples test, the same subjects before and after take the paired test, one sample against a norm takes the one-sample test. Example: A = 12, 15, 11, 14, 13 and B = 16, 18, 15, 17, 24 give t = 2.887, significant at α = 0.05. For proportions and conversion use a z-test instead.

Updated