t-Test Calculator

t-Test Calculator

Perform parametric tests comparing means. Conduct one-sample t-tests against a hypothesized population mean, or two-sample tests (Welch's) comparing independent group means.

Last updated: March 2026

Calculator

Mean of your sample data

Null hypothesis value (H₀)

Sample standard deviation

Number of observations

t-Statistic
1.6442
df = 19

Std Error (SE)

1.5205

p-value (two-tailed)

1.1076

✗ Not significant (α = 0.05)

What is a t-Test?

A t-test is a parametric hypothesis test comparing one or more sample means to a hypothesized value or to each other. Unlike the z-test, t-tests use the t-distribution, which has heavier tails and accounts for uncertainty in estimating the population standard deviation from sample data.

t = (x̄ − μ₀) / (s / √n)
or
t = (x̄₁ − x̄₂) / SE

The test produces a t-statistic and degrees of freedom (df), from which you compute a p-value. If p < α (typically 0.05), you reject the null hypothesis, indicating the means differ significantly.

One-Sample: Tests whether a sample mean differs from a hypothesized population mean. Example: testing if a drug changes blood pressure.

Two-Sample (Welch's): Tests whether two independent sample means differ. Welch's version does not assume equal population variances, making it more robust.

How to Conduct a t-Test

1.

Choose the Test Type

Select One-Sample if testing a single sample against a hypothesized mean. Select Two-Sample if comparing two independent groups.

2.

Enter Your Data

For one-sample: enter x̄ (sample mean), μ₀ (hypothesized mean), s (sample SD), and n. For two-sample: enter both groups' means, SDs, and sizes.

3.

Interpret the t-Statistic

A larger |t| indicates stronger evidence against the null hypothesis. The sign indicates direction: positive if x̄ {'>'} μ₀, negative if x̄ {'<'} μ₀.

4.

Check Degrees of Freedom

One-sample: df = n − 1. Two-sample (Welch's): df is computed using the Welch-Satterthwaite equation to adjust for unequal variances.

5.

Review the p-value

Compare p-value to your significance level α (commonly 0.05). If p-value {'<'} α, reject H₀; the means differ significantly.

Real-World Example

Scenario: A pharmacist tests a new low-sodium medication to verify it meets FDA standards. The label claims μ₀ = 100 mg sodium per dose. A random sample of 20 doses shows x̄ = 102.5 mg with s = 6.8 mg.

One-Sample t-Test:
H₀: μ = 100 mg (meets label claim)
H₁: μ ≠ 100 mg (does not meet claim)

t = (102.5 − 100) / (6.8 / √20) = 1.6408

df = 20 − 1 = 19

p-value (two-tailed) ≈ 0.1177

Interpretation: Since p-value (0.1177) > 0.05, we fail to reject H₀. There is insufficient evidence that the medication differs from the label claim at the 5% significance level.

Two-Group Example: Compare blood pressure reduction in two treatment groups: Group 1 (x̄₁ = 88.3 mmHg, s₁ = 5.2, n₁ = 18) vs. Group 2 (x̄₂ = 84.9 mmHg, s₂ = 4.7, n₂ = 22). Welch's test would compute t ≈ 2.24 with df ≈ 37, yielding p-value ≈ 0.0314, indicating the groups differ significantly.

Frequently Asked Questions

When should I use a t-test vs. a z-test?
Use a t-test when the population SD is unknown and estimated from sample data (typical). Use a z-test only when σ is known (rare in practice). For large samples (n {'>'} 30), t and z distributions are similar.
What does the p-value represent?
The p-value is the probability of observing a test statistic as extreme or more extreme than your computed value, assuming H₀ is true. Smaller p-values provide stronger evidence against H₀.
Why use Welch's t-test over standard Two-Sample t-test?
Welch's t-test does not assume equal population variances and adjusts df accordingly. It is more robust to variance heterogeneity and is generally recommended over the classical two-sample t-test.
What are the assumptions for a t-test?
Independence: observations are independent. Normality: data approximately normally distributed (less critical for large n due to CLT). Optional for Welch's: unequal variances are tolerated.
How do degrees of freedom affect the t-distribution?
Lower df increases type II error (false negatives). As df → ∞, the t-distribution approaches the z-distribution. df = n − 1 for one-sample; Welch-Satterthwaite formula for two-sample.
Can I use a t-test for non-normal data?
Yes, the t-test is robust to moderate non-normality due to the Central Limit Theorem, especially for n ≥ 30. For highly skewed data or small samples, consider transformation or non-parametric tests (e.g., Mann-Whitney U).

Related Tools