InfyCalculator
📊

Paired t-Test Calculator (Before and After, with Steps)

Paste before-and-after (paired) data or summary statistics and get the paired t-test: mean difference, t statistic, degrees of freedom, one- or two-tailed p-value, confidence interval, effect size, a Shapiro–Wilk normality check and every step worked out.

Enter the data as
Before / condition A
After / condition B
Pairs (A and B on each line)
Mean of the differences (d̄)
Standard deviation of the differences (s_d)
Number of pairs (n)
Alternative hypothesis
Significance level (α)
Difference
Hypothesized mean difference (μ₀)
Decimal separator
Loading calculator…

How it works

dᵢ = Aᵢ − Bᵢ · d̄ = Σd ÷ n · s_d = √(Σ(d − d̄)² ÷ (n − 1)) · SE = s_d ÷ √n · t = (d̄ − μ₀) ÷ SE · df = n − 1 · CI = d̄ ± t* × SE · d_z = (d̄ − μ₀) ÷ s_d

A paired t-test looks at the same subjects measured twice — before and after a treatment, or under two conditions — and tests whether the average within-pair change differs from zero (or from another value μ₀ you set). Working on the differences removes the person-to-person variation that would swamp an independent two-sample test, so it is far more powerful when the measurements are naturally linked. Paste the two lists, paste two spreadsheet columns, or type the mean and SD of the differences. Choose a two-tailed test for any change, or a one-tailed test when only one direction matters, and the significance level α. The calculator reports t, degrees of freedom and the exact p-value from the Student t distribution, the critical value, a confidence interval for the mean difference at the matching level, Cohen’s d_z effect size, the correlation between the two columns, and a Shapiro–Wilk test of whether the differences look normal — the key assumption with small samples. A pairs table, descriptive statistics, charts and the full worked steps are included.

Worked example

Six patients’ systolic blood pressure before and after a month of walking: 120, 118, 125, 130, 122, 128 and 115, 116, 119, 124, 118, 121. The differences are 5, 2, 6, 6, 4 and 7, so d̄ = 30 ÷ 6 = 5. The squared deviations sum to 16, giving s_d = √(16 ÷ 5) = 1.7889 and SE = 1.7889 ÷ √6 = 0.7303. Then t = 5 ÷ 0.7303 = 6.8465 on 5 degrees of freedom, and the two-tailed p-value is 0.001015 (SciPy’s ttest_rel gives the same). The 95% confidence interval for the mean drop is 5 ± 2.5706 × 0.7303 = 3.1227 to 6.8773, and the effect size d_z = 5 ÷ 1.7889 = 2.795 is large.

Sources: Student’s t-test — Wikipedia · NIST/SEMATECH e-Handbook — two-sample t-test for paired data · Royston (1995), Algorithm AS R94: Shapiro–Wilk W test for n up to 5000

Frequently asked questions

How is this different from a two-sample t-test?

A two-sample test treats the groups as independent. A paired test uses the fact that each pair belongs to one subject, so it analyses the differences directly and cancels out stable individual traits — giving more power for the same sample size.

What if my two columns are different lengths?

In the two-list format they cannot be: every value in the "before" box needs a matching value in the "after" box for the same subject, in the same order. In the two-column format, a line with only one number (a missing value) is skipped, so that subject drops out of the analysis.

Should I use a one-tailed or a two-tailed test?

Use two-tailed unless you decided before seeing the data that only one direction matters (for example, a drug can only lower blood pressure). A one-tailed p-value is half the two-tailed one when the effect goes the predicted way, so choosing it after looking at the data inflates false positives.

What does the Shapiro–Wilk result mean?

The paired t-test assumes the differences are roughly normal. A Shapiro–Wilk p-value below 0.05 suggests they are not; with large samples the t-test is still robust, but with a small number of pairs consider the Wilcoxon signed-rank test as a check.

Is a significant result proof the treatment caused the change?

No. The test only shows the mean change is unlikely to be zero by chance. Causation requires a proper design (control group, randomisation); a before/after change alone can reflect time, practice or regression to the mean.

How do I report a paired t-test?

Give the means, the mean difference with its confidence interval, t, the degrees of freedom and the p-value, plus an effect size — for the example: t(5) = 6.85, p = .001, mean difference 5.0 (95% CI 3.12 to 6.88), d_z = 2.80.

Related calculators

Two-Sample t-Test Calculator (Pooled)
Compare the means of two independent groups with the pooled (equal-variance) Student t-test — get the t statistic, degrees of freedom, two-tailed p-value and a verdict.
t-Test Calculator
Run a one-sample, two-sample (Welch or pooled Student) or paired t-test from pasted data or summary statistics — t, degrees of freedom, one- or two-tailed p-value, confidence interval, effect size, variance and normality checks, and every step.
One-Sample T-Test Calculator
Test a sample mean against a hypothesised value using the sample standard deviation, with the t statistic, degrees of freedom and a decision.
Wilcoxon Signed-Rank Test Calculator
Paired non-parametric test — W statistic, z with tie correction and two-sided p-value for before/after or matched data.
Sign Test Calculator
The simplest paired test — count improvements versus declines and get the exact binomial one- and two-sided p-values, with the normal approximation.
Cohen's d Calculator
Measure effect size between two groups with Cohen’s d from their means, standard deviations and sizes — with the pooled SD and a magnitude label.
P-Value Calculator
Convert a z-score into a p-value from the normal distribution for a left, right or two-tailed test, with a significance verdict at 0.05.
Standard Deviation Calculator
Paste a list of numbers and get the sample or population standard deviation, variance, mean, standard error, confidence interval, quartiles, z-scores, a frequency table and a histogram, with every step worked out.
Confidence Interval Calculator
Build a confidence interval for a mean from your sample mean, standard deviation and size — with the margin of error and the interval bounds.

For education — confirm the test assumptions (independence, sample size, roughly normal data) before drawing conclusions from a p-value.