Skip to content
AZ Tools

t-Test Calculator (paired, Welch, one-sample)

One-sample, paired and two-sample t-tests from raw data or summary statistics: t, degrees of freedom, p-value, confidence interval and Cohen's d.

p = 0.002833 is below α = 0.05: the data are unlikely under the null hypothesis, which is rejected at this level.

t
Degrees of freedom
p-value
Mean difference
Standard error
Cohen's d
95% confidence interval
SamplenMeanSD
A100.751.78901
B102.332.002249
Differences A − B10-1.581.229995

Computed in the browser; the t distribution is evaluated with the regularized incomplete beta function, which handles the fractional degrees of freedom Welch's test produces. The data are kept in local storage.

How to use

  1. Choose the test: one sample against a hypothesised mean, paired for before-and-after on the same subjects, or two independent samples.
  2. Paste the values for each sample, separated by spaces, commas or new lines — or switch to summary statistics and enter n, the mean and the SD.
  3. Set the hypothesised mean or difference, the alternative hypothesis and the confidence level.
  4. Read t, the degrees of freedom and the p-value, then the confidence interval and Cohen's d for the size of the effect.
  5. Load Student's sleep data and switch between paired and two-sample to see how much the choice of test changes the answer.

About this tool

Show

Run a Student's t-test on two columns of numbers — or on means, standard deviations and sizes when that is all you have — and get t, the degrees of freedom, the p-value for a two-sided or one-sided alternative, a confidence interval at any level, and Cohen's d. The choice of test matters more than any of the arithmetic, and the built-in example shows why. Student's own 1908 data record the extra hours of sleep ten patients got from each of two drugs. Treated correctly as paired — the same patients took both — the difference is clear: t = −4.06 on 9 degrees of freedom, p = 0.0028. Treated as two independent groups, the same numbers give t = −1.86 and p = 0.079, because the large differences between patients swamp the smaller difference between the drugs. The two-sample test defaults to Welch's version, which does not assume the groups have the same variance and gives fractional degrees of freedom — 17.78 for the sleep data; the pooled version is there for comparison and for coursework that asks for it, and with unequal group sizes and spreads the two can disagree substantially. The distribution is evaluated through the regularized incomplete beta function rather than a table, so p-values far into the tail and non-integer degrees of freedom are exact to the precision of a double. A one-sided p-value is not simply half the two-sided one: it is half only when the data lean in the direction you tested, and one minus half when they lean the other way. None of this checks the test's assumptions; with very small samples, strong skew or outliers, look at the data before trusting the p-value, and read the confidence interval and the effect size alongside it.

Frequently asked questions

Should I use Welch's test or the pooled test?

Welch's, unless you have a specific reason not to. The pooled test assumes the two populations have the same variance and becomes unreliable when they do not, especially with unequal group sizes. Welch's test drops that assumption at almost no cost when the variances happen to be equal, which is why R and many textbooks now use it by default. Its degrees of freedom come from the Welch–Satterthwaite formula and are usually not a whole number.

When is a test paired?

When each value in one sample belongs with a specific value in the other: the same person before and after, the left and right eye, two measurements of the same specimen. Pairing removes the variation between subjects from the comparison, which is why it can find a difference the unpaired test misses. Using a two-sample test on paired data is not conservative in a useful way — it simply answers a different question.

What does the p-value mean?

It is the probability of a t at least as extreme as the one observed, if the null hypothesis were true. It is not the probability that the null hypothesis is true, and a p-value above the threshold is not evidence of no difference; the confidence interval shows the range of differences the data are compatible with, which is usually more informative than a yes or no.

Why is my one-sided p-value close to 1?

Because the data point the other way. A one-sided test asks whether the mean is greater (or less) than the hypothesised value; if the sample mean is on the opposite side, the p-value is one minus half the two-sided p-value. Choose the direction before looking at the data — choosing it afterwards to halve the p-value is not a one-sided test.

How is Cohen's d calculated here?

For one sample it is the difference from the hypothesised mean divided by the sample standard deviation; for paired data it is the mean difference over the standard deviation of the differences (sometimes written d_z); for two samples it is the difference in means over the pooled standard deviation. Conventional labels of 0.2 small, 0.5 medium and 0.8 large are rough guides, not rules.

Related tools