How to Use the T-Test Calculator

  1. 1. Choose the test type: One-sample for a single mean against a fixed value. Two-sample (Student) for two independent groups where equal variances are reasonable. Two-sample (Welch) when variances or sample sizes differ. Paired when the same subjects are measured twice or the data are naturally matched.
  2. 2. Choose raw data or summary statistics: Raw data mode accepts comma-, space-, or newline-separated values and computes the descriptives for you. Summary mode takes n, mean, and SD per group — or, for paired tests, the number of pairs, the mean difference, and the SD of the differences.
  3. 3. Enter the data and the null value: For a one-sample test, enter the observations and the hypothesized mean μ₀. For a two-sample test, enter both groups and the hypothesized difference Δ₀ (usually 0). For a paired test, enter both columns — pairs are matched by position — and Δ₀. Both paired columns must have the same length.
  4. 4. Set the tail and significance level: Choose two-tailed, left-tailed, or right-tailed based on the alternative hypothesis. Pick α from 10%, 5%, 1%, or a custom value. Changing either updates the critical t value and the p-value consistently.
  5. 5. Read the result: The hero line shows t, df, and p. The stats panel lists the test type, standard error, point estimate, critical t, confidence interval, and effect size (Cohen's d, or dz for paired). The decision line states whether H₀ is rejected at the chosen α.
  6. 6. Review the steps and the density chart: The calculation steps show how the t statistic was built from the data. The t-density chart plots the distribution with the observed |t| and critical |t| marked, so you can see how far into the tail the result falls. The descriptive line reports the sample n, mean, and SD for the group or groups entered.

What Is a T-Test?

A t-test is a hypothesis test for a mean or a difference between two means when the population standard deviation is unknown. It compares an observed sample estimate to the value specified by the null hypothesis, scaled by the estimate's standard error. The result is a t statistic, which is evaluated against the Student's t-distribution with the appropriate degrees of freedom to produce a p-value or a critical-value comparison.

The Four T-Tests

  • One-sample — compares the mean of a single sample to a hypothesized value μ₀.
  • Two-sample (Student) — compares the means of two independent groups assuming equal population variances. Uses a pooled estimate of the standard deviation.
  • Two-sample (Welch) — compares two independent group means without assuming equal variances. Uses a separate variance estimate for each group and Welch–Satterthwaite degrees of freedom, which can be fractional.
  • Paired — compares two measurements from the same subjects or matched observations. Reduces to a one-sample test on the within-pair differences.

T-Test Formulas

Every t-test shares the same structure: the observed difference divided by its standard error.

One-sample: t = (x̄ − μ₀) / (s / √n), with df = n − 1.

Two-sample pooled: t = [(x̄₁ − x̄₂) − Δ₀] / [sp√(1/n₁ + 1/n₂)], where sp² = [(n₁−1)s₁² + (n₂−1)s₂²] / (n₁ + n₂ − 2), with df = n₁ + n₂ − 2.

Welch: t = [(x̄₁ − x̄₂) − Δ₀] / √(s₁²/n₁ + s₂²/n₂), with Welch–Satterthwaite degrees of freedom.

Paired: reduce the data to differences di = X1i − X2i, then t = (d̄ − μd0) / (sd / √n), with df = n − 1.

How to Calculate a T-Test

The steps are the same regardless of which t-test you use. What changes is the formula for the standard error and the degrees of freedom.

  1. Calculate the sample mean, or the difference between the two sample means, or the mean of the paired differences.
  2. Calculate the appropriate standard error for the chosen test.
  3. Subtract the hypothesized value from the estimate and divide by the standard error to get the t statistic.
  4. Determine the degrees of freedom for the test.
  5. Look up or compute the p-value from the t-distribution, or compare the statistic against the critical t value.
  6. Compare the p-value (or the statistic) against the chosen significance level α.
  7. Read the confidence interval and effect size alongside the decision — statistical significance and practical importance are separate questions.

T Statistic vs T-Test

The t statistic is a number — the observed difference divided by its standard error. A t-test is the complete procedure: compute the t statistic, pick the correct degrees of freedom, then compare the statistic either to a critical t value or to the t-distribution to get a p-value. The t statistic on its own is not a conclusion; it is one input into the test.

Degrees of Freedom and Critical Values

Degrees of freedom determine which t-distribution the statistic is evaluated against. For one-sample and paired tests, df = n − 1. For the pooled two-sample test, df = n₁ + n₂ − 2. Welch uses an approximation, so df can be fractional. As df grows, the t-distribution approaches the standard normal.

A critical t value is the boundary that marks the rejection region for the chosen α and tail. For a two-tailed test, α is split evenly between both tails, so the critical value is the upper quantile at 1 − α/2, symmetric ±t_crit. For one-tailed tests, the entire α sits in one tail. The sign of the t statistic only indicates direction — the magnitude relative to t_crit determines the decision.

P-Value and Decision

The p-value is the probability, under H₀, of a t statistic at least as extreme as the one observed, in the direction of the selected tail. If p < α, the result is statistically significant and H₀ is rejected. If p ≥ α, there is insufficient evidence to reject H₀. A significant result does not by itself establish the practical size or causal nature of the effect — that is what the effect size (Cohen's d, or dz for paired) and the confidence interval are for.

One-Tailed vs Two-Tailed

A two-tailed test asks whether the parameter differs from the null value in either direction. A right-tailed test asks only whether it is greater; a left-tailed test asks only whether it is less. Choose the alternative before seeing the data. Switching to a one-tailed test after the fact to gain significance is a form of p-hacking.

When to Use Each Test

  • Comparing one sample mean to a fixed value — one-sample.
  • Comparing two independent groups and equal variances are reasonable — Student's pooled test.
  • Comparing two independent groups without assuming equal population variances — Welch's test.
  • Measurements taken twice on the same subjects, matched pairs, or pre/post designs — paired test.

Assumptions

Independence of observations is required for all four tests. For small samples, the underlying population (or the paired differences) should be approximately normal — the t-test is robust to mild departures but sensitive to extreme outliers. The pooled two-sample test additionally assumes equal population variances; Welch's test does not. Paired data should be analyzed as paired observations when the measurements are naturally matched. Treating paired observations as independent ignores their within-pair dependence and can produce incorrect standard errors and p-values.

How to Report a T-Test

APA format: t(df) = value, p = value, d = value, 95% CI [low, high]. For example: t(8) = −4.70, p = .002, d = −2.97, 95% CI [−9.25, −3.15]. Report the test type (one-sample, pooled, Welch, or paired), the sample sizes, and the descriptive statistics alongside the test result.

Common Mistakes

  • Running a two-sample test on paired data.
  • Using Student's pooled test when variances clearly differ — Welch is the appropriate alternative.
  • Reporting a one-tailed p-value after initially testing two-tailed.
  • Treating a non-significant result as proof that there is no effect.
  • Reading a small p-value as evidence of a large or important effect — that is what Cohen's d and the CI are for.
  • Removing outliers without investigating them.

Frequently Asked Questions

Q: What is a t-test calculator?

A t-test calculator runs a Student's t-test on your data and returns the t statistic, degrees of freedom, p-value, critical t value, confidence interval, and effect size. It supports one-sample, two-sample Student's, Welch's, and paired designs from either raw data or summary statistics.

Q: How do I calculate a t statistic?

Divide the difference between the observed estimate and the null value by the estimate's standard error. The exact formula depends on the test: for one-sample, t = (x̄ − μ₀) / (s / √n); for two-sample pooled and Welch tests, the numerator is the mean difference and the denominator is the appropriate standard error; for a paired test, the calculation runs on the within-pair differences.

Q: What is the difference between a t statistic and a t-test?

The t statistic is a single number computed from your data. The t-test is the complete procedure: it uses the statistic, the correct degrees of freedom, and the t-distribution to produce a p-value or a critical-value decision. The statistic is one step inside the test, not the test itself.

Q: What is the difference between Student's t-test and Welch's t-test?

Student's pooled two-sample t-test assumes equal population variances and combines both sample variances into a pooled estimate. Welch's test does not assume equal variances — it uses each group's variance separately and adjusts the degrees of freedom via the Welch–Satterthwaite approximation. Welch is generally the appropriate choice when group sizes or variances differ.

Q: What is the difference between a paired t-test and a two-sample t-test?

A paired t-test analyzes matched observations — the same subjects measured twice, or naturally paired data. It reduces to a one-sample test on the within-pair differences. A two-sample t-test compares two independent groups. Running a two-sample test on paired data treats correlated observations as independent and inflates the false-positive rate.

Q: How are degrees of freedom calculated?

One-sample and paired: df = n − 1. Two-sample pooled: df = n₁ + n₂ − 2. Welch: df uses the Welch–Satterthwaite approximation, so it can be a fractional number rather than an integer.

Q: What is a critical t value?

A critical t value is the boundary that separates the non-rejection region from the rejection region at a chosen α and tail. For a two-tailed test, it is the upper quantile at 1 − α/2, symmetric as ±t_crit. For a one-tailed test, the entire α sits in the specified tail. Compare the observed t statistic against the critical value to reach the same decision as the p-value.

Q: What does a negative t statistic mean?

The sign indicates direction, not magnitude. A negative t means the observed estimate is below the null value — or, in a two-sample test, that the first group's mean is below the second group's. The magnitude relative to the critical value and the p-value together determine the decision.

Q: What does the p-value mean in a t-test?

The p-value is the probability, under the null hypothesis, of observing a t statistic at least as extreme as the one calculated, in the direction of the selected tail. A small p-value is evidence against H₀. It is not the probability that H₀ is true, and it is not a measure of effect size.

Q: What does a statistically significant result mean?

It means the p-value is below the chosen α, so there is sufficient statistical evidence to reject the null hypothesis in the direction specified by the alternative. It does not prove causation or practical importance — those depend on the study design, the effect size, and the confidence interval.

Q: How do I interpret the confidence interval?

The confidence interval gives the range of plausible values for the parameter of interest — the mean for a one-sample test, or the mean difference for a two-sample or paired test — at the chosen confidence level. If the interval excludes the null value, the test is significant at the corresponding α. The interval's width is a measure of precision.

Q: What is Cohen's d?

Cohen's d is the standardized effect size — the difference in means divided by the pooled standard deviation (or by the SD of the differences for a paired test, where it is written dz). It expresses the size of the effect in standard-deviation units, independent of sample size. Commonly cited rules of thumb describe values around 0.2, 0.5, and 0.8 as small, medium, and large effects, respectively, but the practical importance of an effect depends on the field and research context.

Q: Can I run a t-test from summary statistics?

Yes. Switch the input type to Summary statistics and enter n, mean, and SD for each group or the paired difference summary. The t statistic, df, p-value, critical t, confidence interval, and effect size all work the same way as with raw data. Descriptives that require individual observations are not available in summary mode.

Q: What is the difference between a t-test and a z-test?

A t-test uses the Student's t-distribution and estimates the population SD from the sample. A z-test uses the standard normal distribution and is typically applied when the population SD is known or when the sample is large enough that the difference between t and z is negligible.

Q: What assumptions does a t-test make?

Independent observations are required. For small samples, the underlying population (or the paired differences) should be approximately normal — the test is robust to mild departures but sensitive to extreme outliers. The pooled two-sample test additionally assumes equal variances; Welch's test does not. Paired data must be genuinely matched.

Loaded shared calculation