Paired t-test calculator
Test whether the average difference between two linked measurements is zero. Paste the two columns, or enter the mean and SD of the differences, and get t, exact p, the confidence interval of the mean difference and Cohen's dz.
- Two columns, or a summary of the differences
- Cohen's d_z and d_av, both named
- Correlation between the columns shown
Sources checked on November 21, 2026. Results computed by the site's engine and tested against R and SciPy.
Paired t-test Drug 1 minus Drug 2
At the 5% level, there is evidence of a difference between Drug 1 and Drug 2 (the mean difference).
| Group | n | Mean | SD |
|---|---|---|---|
| Drug 1 | 10 | 0.7500 | 1.7890 |
| Drug 2 | 10 | 2.3300 | 2.0022 |
| Differences | 10 | −1.5800 | 1.2300 |
Cohen's dav −0.8335 (mean difference over the average of the two SDs); correlation between the columns r = 0.7952. Critical t: 2.2622.
Assumptions check
- Differences: skewness −1.47 (strong skew; with small samples consider a rank test); 2 values beyond 1.5 IQR from the quartiles (0, −4.6), not removed.
APA t(9) = −4.06, p = .003, dz = −1.28, 95% CI [−2.46, −0.70]
Reproduce this result in R or Python
R
x <- c(0.7, -1.6, -0.2, -1.2, -0.1, 3.4, 3.7, 0.8, 0, 2)
y <- c(1.9, 0.8, 1.1, 0.1, -0.1, 4.4, 5.5, 1.6, 4.6, 3.4)
t.test(x, y, paired = TRUE, alternative = "two.sided", conf.level = 0.95)Python (SciPy)
from scipy.stats import ttest_rel
x = [0.7, -1.6, -0.2, -1.2, -0.1, 3.4, 3.7, 0.8, 0, 2]
y = [1.9, 0.8, 1.1, 0.1, -0.1, 4.4, 5.5, 1.6, 4.6, 3.4]
res = ttest_rel(x, y, alternative="two-sided")
print(res, res.df, res.confidence_interval(0.95))When the paired test is right
Use the paired test when every value in one column has a partner in the other: the same patient before and after treatment, the same plot measured in two seasons, twins, or two methods applied to the same samples. The test works on the differences within each pair, so stable differences between individuals drop out. That usually makes it far more sensitive than an independent test on the same numbers.
The pairs must be lined up. Row three of the first column has to belong with row three of the second. If the columns have different lengths, the calculator stops and tells you, because a missing partner cannot be guessed.
Worked example: Student's sleep data
The calculator opens with the data William Gosset analyzed in 1908 under the pen name Student: extra hours of sleep for 10 patients given each of two drugs (Cushny and Peebles, 1905). Each patient took both drugs, so the data are paired. This is also the paired example in R's reference output.
The mean difference (drug 1 minus drug 2) is −1.58 hours with an SD of 1.2300. That gives t = −4.0621 on 9 df and a two-sided p of 0.0028. The 95% confidence interval for the mean difference is −2.4599 to −0.7001 hours. Cohen's dz is −1.28. In APA style: t(9) = −4.06, p = .003.
The same data treated as independent
Run the same twenty numbers through the independent samples test and the picture changes: Welch's test gives t = −1.86 and p = 0.0794, which is not significant at the 5% level. The means are identical in both analyses. What changes is the standard error. Patients who sleep more on one drug tend to sleep more on the other (the correlation between the columns is 0.80), and the paired test removes that shared patient-to-patient variation. Analyzing paired data as independent throws that information away.
Formulas
di = xi − yi, t = d̄ / (sd / √n), df = n − 1, CI = d̄ ± t1−α/2, n−1 × sd/√n
This is the one-sample t-test applied to the differences, which is exactly how R implements paired = TRUE. If you only have the two means, the two SDs and the correlation r, the SD of the differences is √(s1² + s2² − 2r s1s2) (Lakens 2013, equation 8). For the sleep data that gives 1.2300, the same SD of differences as before.
Which effect size: d_z or d_av
Paired designs have more than one Cohen's d, and they can differ a lot. Cohen's dz divides the mean difference by the SD of the differences; it equals t divided by √n and describes how consistent the change is. Cohen's dav divides by the average of the two SDs and is closer to what an independent-groups d would show. For the sleep data dz = −1.28 but dav = −0.83. Neither is wrong; say which one you report. Both are defined in Lakens (2013).
One-sided paired tests
If you stated before collecting data that drug 1 would give less extra sleep than drug 2, the one-sided p is 0.0014, half the two-sided value, because t fell in the predicted direction. Had you predicted the opposite, the one-sided p would be 0.9986, not half of anything. One-tailed vs two-tailed tests explains why.
If the differences are far from normal
The paired test assumes the differences, not the raw columns, are roughly normal. With few pairs and a skewed or outlier-heavy set of differences, the Wilcoxon signed rank test is the usual alternative. The assumptions panel in the result shows the skewness of the differences and flags any far from the quartiles.
Sources
- R reference example output, stats-Ex.Rout.save checked November 21, 2026
- R source code, stats package, t.test.R checked November 21, 2026
- Lakens D. (2013) Calculating and reporting effect sizes to facilitate cumulative science. Frontiers in Psychology 4:863 checked November 21, 2026