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
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.
Two independent samples, variances assumed equal. If they are not, Student's test inflates or deflates p — check the equality of variances below.
The same subjects before and after: the test compares the differences within pairs. A and B must have the same number of values.
One sample against a known value μ₀ — a norm, a target, a nominal value.
Enter a number for μ₀
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
Significance level α
Test
Choose it only if you decided in advance that B cannot be worse and a negative result does not interest you.
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.
Check the inputs
Fix the fields marked in red and the solution appears at once.
03
Step by step
1
Input data
A: nA = 5, xA = 13, s2A = 2.5B: nB = 5, xB = 18, s2B = 12.5
|t| = 2.887 > t crit = 2.306 — reject H₀. Confidence interval of the difference (95%): from 1.0059 to 8.9941. Effect size d = 1.83 — large.
1
Input data
Differences d = B − A: 4; 3; 4; 3; 11n = 5, d = 5, sd = 3.3912
2
Hypotheses
H0: μd = 0H1: μd ≠ 0
3
Formula and substitution
t = dsd / √n = 53.391 / 2.236 = 3.297, df = n − 1 = 4
4
Critical value and p-value
tcrit(0.05; 4) = 2.776p = 2 · P(T > |t|) = 0.0300
5
Conclusion
|t| = 3.297 > t crit = 2.776 — reject H₀. Confidence interval of the difference (95%): from 0.7893 to 9.2107. Effect size d = 1.47 — large.
1
Input data
n = 5, x = 13, s = 1.5811, μ0 = 12
2
Hypotheses
H0: μ = 12H1: μ ≠ 12
3
Formula and substitution
t = x − μ0s / √n = 13 − 121.581 / 2.236 = 1.414, df = n − 1 = 4
4
Critical value and p-value
tcrit(0.05; 4) = 2.776p = 2 · P(T > |t|) = 0.2302
5
Conclusion
|t| = 1.414 ≤ t crit = 2.776 — no grounds to reject H₀. Confidence interval of the difference (95%): from −0.9632 to 2.9632. Effect size d = 0.63 — medium.
dfα 0.10α 0.05α 0.01
16.31412.70663.657
22.9204.3039.925
32.3533.1825.841
42.1322.7764.604
52.0152.5714.032
61.9432.4473.707
71.8952.3653.499
81.8602.3063.355
91.8332.2623.250
101.8122.2283.169
121.7822.1793.055
151.7532.1312.947
201.7252.0862.845
251.7082.0602.787
301.6972.0422.750
401.6842.0212.704
601.6712.0002.660
1201.6581.9802.617
Two-sided values. For a one-sided test use the column with double α. Your df row is highlighted; Welch's fractional df fall between rows.
Step by step — step by step
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
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.
Student's test assumes equal group variances and pools them; Welch's estimates each separately and lowers the degrees of freedom by the Satterthwaite formula. On the same data t is the same, 2.887, but Student gives df = 8 and p = 0.020 while Welch gives df = 5.54 and p = 0.030, because B is more spread out. With equal variances Welch loses almost nothing, so it is the default.
Paired when each value in A is linked to one value in B: the same patient before and after a drug, the same part on two machines. It compares the differences within pairs and removes the spread between subjects, so it is more sensitive. Six patients at 150, 142, 160… before and 141, 138, 150… after give t = −7.88 with the paired test; mixed-up pairs give a wrong answer. Separate groups of people are unpaired.
The number of independent values the spread is estimated from. One sample of n values has df = n − 1, since one goes to the mean. Student's test for two groups has df = n₁ + n₂ − 2, the paired test the number of pairs minus one. They shape the t distribution: at df = 4 the critical t is 2.776, at df = 30 it is 2.042, and as df grow it approaches 1.96.
With more than 30–50 values per group the t-test copes with skewed data too: the mean is distributed almost normally. With small samples, outliers or strong skew, cross-check with the Mann–Whitney test, which works on ranks. The calculator checks samples of up to 50 values with the Shapiro–Wilk test and flags outliers beyond 1.5 interquartile ranges. For instance, a single 24 among values of 15–18 is an outlier.
From a table: the row is the degrees of freedom, the column the significance level. For a two-sided test at α = 0.05 and df = 8 the critical t is 2.306; if |t| is larger, the hypothesis of equal means is rejected. For a one-sided test take the column with double α: at df = 8 that is 1.860. The calculator also finds the critical value for Welch's fractional df, and the table opens below the solution.