T Test Calculator

This t test calculator runs one-sample, two-sample, and paired t-tests and shows you the t-statistic, p-value, degrees of freedom, and critical value as you type. You need a t-test rather than a z-test when you don't know the population standard deviation or your sample has fewer than 30 observations. Both conditions describe most real datasets.

Test Type

Alternative Hypothesis

H₀: μ₁ − μ₂ = 0

H₁: μ₁ − μ₂ ≠ 0

Variance Assumption

Significance Level (α)

Group Parameters

Group 1

Group 2

t-statistic

1.085

p-value

0.2836

Test Statistics

Degrees of Freedom46.90
Standard Error (SE)0.3688
Critical Values±2.0119
Significance Level (α)0.0500

Interval & Effect Size

95% Confidence Interval[-0.3419, 1.1419]
Mean Difference0.4000
Cohen's d0.3068
Effect Size
small

Rejection Region

Reject H₀ if |t| > 2.0119
|1.0847| = 1.0847≤2.0119→ Fail to Reject H₀

Not Statistically Significant

Fail to reject H₀. Insufficient evidence at the 5% significance level (p = 0.2836) to conclude the means differ significantly.

William Davis

Created by William Davis

Last updated: September 10, 2026

Add to Google Preferred
1

What is a T Test?

Most people encounter the t test when they are trying to measure the difference between exactly two means, and that is precisely what it is built for. It is not about counts, it is not about correlations between multiple variables, it is about one numeric data variable and what happens when you compare its average across two groups.

Say you are looking at systolic blood pressure between men and women, or between a control group and a treated group. You collect measurements, take the average of each sample, and then the question becomes whether that difference is real or just noise. That is where the t test earns its place.

The formula at its core involves M1 and M2 as the two sample means and SE as the overall standard error across the two samples. The Student's t-test specifically applies when the population variance is unknown and when data follows a normal distribution. It uses t-statistics and t-distribution values alongside degrees of freedom to arrive at a critical value for your chosen significance level.

For small samples, typically fewer than 30 observations, the t-distribution diverges enough from a normal curve that substituting a Z test would give you misleading results. The t-distribution is one-tailed or two-tailed depending on your hypothesis, and both directions are supported here.

While a two-sample t test compares datasets to determine whether they are statistically different from one another, it is distinct from a one sample test, which checks your sample mean against a single proposed theoretical value. The parametric nature of this test means your data points need to be independent and at least approximately normally distributed. Where that assumption breaks down, the Mann-Whitney U test or sign test steps in as a nonparametric alternative.

2

Assumptions of T Tests

Every version of the t test rests on a set of assumptions, and skipping this step is one of the most common mistakes in statistical analysis. Whether you are running an unpaired test or a paired one, the checklist matters before you ever look at results.

Checklist Before You Run the Test

Exactly two groups. Not three, not four. If you have more, use ANOVA.
Data must be normally distributed. This is not optional for a parametric test.
Observations within each sample must be independent of one another.
Decide whether your samples have equal or unequal variance — this determines which version applies.

Paired vs Unpaired

Paired data comes from the same subjects at two points in time. Unpaired data comes from two completely separate groups. Getting this wrong flips the entire interpretation of your output.

For the standard two-sample t test, the assumption is homogeneity of variance, meaning both populations share the same variance. When that assumption does not hold, Welch's version handles unequal variance without requiring you to force the data into a shape it does not naturally take.

3

Types of T Tests

One-Sample

vs fixed value

Checks whether your sample mean matches a pre-set benchmark. Example: does a factory batch actually weigh what the label claims?

Two-Sample

independent groups

Compares means from two separate, independent groups. High-carb diet vs high-fat diet. University A vs University B math scores.

Paired

same subjects × 2

Same subjects measured before and after. Before vs after a drug, treatment, or course. The groups are linked, not independent.

For paired tests, you compute a difference di for each subject between their xi and yi measurements, then run what is effectively a one-sample t-test on that sample of differences. Degrees of freedom for a paired test equal n minus 1. For two-sample tests, Welch's applies when variances between groups are unequal, removing the homogeneity assumption the standard version requires.

4

Null Hypothesis

The null hypothesis in a t test is a starting position, not a conclusion. Written formally as H₀: μ₁ − μ₂ = 0, it states that the difference between the mean of the first population and the mean of the second is exactly nothing. No difference between average heights. No difference between pre and post treatment means. The treatment has no impact.

Null Hypothesis H₀

μ₁ − μ₂ = Δ

No meaningful difference. Δ is usually 0.

Alternative H₁

μ₁ − μ₂ ≠ Δ / < Δ / > Δ

Two-tailed, left-tailed, or right-tailed.

What is easy to overlook is that failing to reject the null hypothesis is not proof that no difference exists. It means your data, at this sample size and significance level, could not detect one.

5

Equation / Formula

Every version of the t statistic is a difference divided by a standard error. What changes between test types is which difference and which standard error. The pooled two-sample form below builds its denominator from the two sums of squares (SS₁ and SS₂) and the sample sizes (n₁ and n₂):

Two-Sample T Test (Pooled)

t = (M₁ − M₂) / √[((SS₁ + SS₂) / (n₁ + n₂ − 2)) × (1/n₁ + 1/n₂)]

M₁,M₂Sample means
SS₁,SS₂Sum of squares
n₁,n₂Sample sizes
dfn₁ + n₂ − 2

aOne-Sample T Test

t = (x̄ − μ₀) / (s / √n)

Where x̄ is the sample mean, s is the standard deviation, n is the sample size, and μ₀ is the hypothesized mean. Degrees of freedom = n − 1.

bTwo-Sample (Equal Variances)

t = (x̄₁ − x̄₂ − Δ) / (sp · √(1/n₁ + 1/n₂))
sp = √[((n₁−1)s₁² + (n₂−1)s₂²) / (n₁+n₂−2)]

Degrees of freedom = n₁ + n₂ − 2. Homogeneity of variance is assumed here.

cWelch's T Test (Unequal Variances)

t = (x̄₁ − x̄₂ − Δ) / √(s₁²/n₁ + s₂²/n₂)

Degrees of freedom are approximated via the Satterthwaite formula — a weighted harmonic mean of n₁−1 and n₂−1, with weights proportional to the sample standard deviations.

dPaired T Test

t = (x̄ − Δ) / (s / √n)

Where x̄ is the mean of the per-subject differences di = xi − yi, s is their standard deviation, n is the number of pairs, and Δ is the null hypothesis mean difference. Degrees of freedom = n − 1.

6

How to Use the T Test Calculator

1

Choose test type

One-sample, two-sample, or paired. The nature of your data makes this decision for you.

2

Set significance level

Pick α (0.01, 0.05, or 0.10). Defaults to 0.05.

3

Set hypothesis direction

Two-tailed detects any difference. One-tailed tests a specific direction.

4

Enter your inputs

Sample mean, standard deviation, and sample size. For two-sample, provide data for both groups.

When your T-score and degrees of freedom are already known, you can enter them directly and skip the sample inputs entirely. The calculator delivers the p-value or critical region alongside an interpretation without any extra steps.

7

How to Do a T Test

If you want to understand what the calculator is doing internally, the process breaks into three clear stages:

1

Choose your hypothesis direction

Two-tailed detects any deviation from the benchmark. One-tailed tests whether the mean is specifically greater or less than it.

2

Compute the T-score

Plug sample size, mean, and standard deviation into the formula for your chosen test type. The exact formula depends on which version applies.

3

Determine degrees of freedom

In the simplest case, df = sample size minus the number of estimated parameters. df defines which t-Student distribution your T-score follows under H₀.

A bit of history

The t-Student distribution was named after William Sealy Gosset, who published the original paper in 1908 under the pseudonym "Student." Gosset worked at the Guinness Brewery in Dublin, where monitoring beer quality with small sample sizes was a real operational need. What started as a brewing solution became the backbone of statistical hypothesis testing worldwide.

8

p-value from T Test

The p-value answers a specific question: assuming the null hypothesis is true, what is the probability that your test statistic produces values at least as extreme as the T-score you got from your sample?

Visually, p-values correspond to areas under the density function of the t-Student distribution. The direction of your test determines how that area is calculated using the cumulative distribution function cdft,d for d degrees of freedom:

Left-tailedp = cdf(t)
Right-tailedp = 1 − cdf(t)
Two-tailedp = 2 × cdf(−|t|)

Without statistical software or this calculator, finding the exact p-value would require statistical tables. This calculator delivers the result directly from your inputs.

9

T Test Critical Values

Where the p-value approach gives you a probability, the critical values approach gives you a boundary. You set your significance level α before running the test, and from that, critical regions (also called rejection regions) are derived using the quantile function of the t-distribution.

Left-tailedcdf⁻¹(α)(−∞, t_α)
Right-tailedcdf⁻¹(1 − α)(t_{1−α}, +∞)
Two-tailed± cdf⁻¹(1 − α/2)(−∞, −t) ∪ (t, +∞)

If the T-score falls inside the critical region, reject H₀. If it sits outside, you do not have enough evidence to reject. The conclusion always ties back to the significance level α you set at the start and the degrees of freedom that shaped the distribution.

10

Common T Test Confusion

One pattern shows up repeatedly: t tests get confused with techniques that are measuring entirely different things. Sorting them out early saves a lot of backtracking later.

T Test vs Regression

Regression deals with relationships between multiple variables simultaneously. A t test focuses on one factor and compares means between two samples. T-scores appear inside regression when evaluating coefficients, but the two methods are not the same thing.

T Test vs ANOVA

ANOVA compares means across three or more groups. A t test compares exactly two. Applying a t test where ANOVA belongs inflates your Type I error rate and undermines the entire analysis.

T Test vs Chi-Square

Chi-square works on counts across categories. A t test works on means of a continuous variable. These are not interchangeable — using the wrong one changes the nature of the question you are actually answering.

Paired vs Unpaired

The distinction rests entirely on whether the same subjects appear in both groups. Variance equality then determines whether you use pooled standard deviation or Welch's. Getting either wrong flips the interpretation.

11

Interpreting Results

p < α (e.g. 0.05)

Reject H₀. Sufficient evidence that the means differ significantly at this significance level.

p ≥ α (e.g. 0.05)

Fail to reject H₀. No significant difference detected. This does not confirm no difference — you may simply lack enough data.

P values are easy to misinterpret. The p-value is not the probability that the null hypothesis is true. It is the probability of observing results at least as extreme as yours assuming the null hypothesis is correct.

Beyond the p-value, your output includes the mean difference, t statistic, degrees of freedom, standard error, and a confidence interval giving you a range within which the true population difference likely falls at your chosen significance level.

12

Reading and presenting your result

This calculator returns numbers, not charts. The results panel gives you the t statistic, degrees of freedom, p value, critical value, mean difference, standard error, and Cohen's d. Read them together: the p value tells you whether the difference is unlikely to be chance, and the mean difference and Cohen's d tell you whether it is large enough to matter.

If you are writing up the result, report all three: the test and its statistic (for example t(38) = 2.71), the p value, and the effect size, plus the group means and standard deviations. If you want a figure, plot the raw data points with the group means in a tool such as R, Python, or a spreadsheet; a plot of the actual observations shows outliers and spread that the summary statistics alone can hide.

13

T Test vs Z Test

T Test

  • Population variance unknown
  • Small samples (< 30)
  • Uses t-Student distribution
  • Heavier tails than normal

Z Test

  • Population variance known
  • Large samples (≥ 30)
  • Uses normal distribution N(0,1)
  • Converges with t at large df

For large samples (≥ 30), the t-Student distribution converges closely enough toward N(0,1) that swapping a t-test for a Z-test produces nearly identical results. For small samples where population variance is unknown, the t-test is the correct choice — using a Z-test there introduces error that compounds as sample size shrinks.

↗

Related Tests and Calculators

Z Test →

When population variance is known and your sample is large enough, the Z-test applies. Results converge with the t-test as sample size grows.

Chi-Square Test →

The t-test compares means. Chi-square works on counts across categories. Use chi-square when your data is categorical, not continuous.

ANOVA →

When you have three or more groups to compare, ANOVA is the right path. Using multiple t-tests across groups inflates your Type I error rate.

?

Frequently Asked Questions

Q

Do I need raw data to use this calculator?

No. This calculator works from summary statistics, not a list of individual observations. Enter the mean, standard deviation, and sample size for each group (or the mean of differences, its standard deviation, and the number of pairs for a paired test). If you only have raw numbers, calculate the mean and standard deviation first with the sample mean and standard deviation calculators, then bring those values here.

Q

What are the different types of t-tests?

There are three types. The one-sample t-test compares a single group against a fixed hypothesized value. The two-sample t-test compares the means of two independent groups. The paired t-test evaluates change within the same group across two measurement points. Each type addresses a different hypothesis structure, so matching the right test to your data is as important as running the calculation itself.

Q

How to find the t value in a one-sample t-test?

Work through it in three steps:

  1. Subtract the hypothesized mean from your sample mean to get the difference.
  2. Divide that difference by your sample standard deviation.
  3. Multiply the result by the square root of your sample size.