MECHOWL QUALITY ANALYSIS AI

t-Test Calculator: Two-Sample, Welch, Paired and One-Sample t-Test from Excel Data

Paste the measurements of two groups (two machines, two lots) or of before and after a change to run a t-test of the difference of means. Welch, pooled, paired and one-sample tests give t, the degrees of freedom, the p-value and the confidence interval of the difference, with a chart and the working.

Last updated

Your data is not sent. Everything is computed in your browser

Data

Paste two columns side by side from Excel (column names in the first row; the columns may have different numbers of rows). For paired samples (before and after a change), put the before and after values of the same item on one row. For one sample, paste one column and enter the reference value. The long format (a value column and a group column) is read too.

Read 12 rows and 2 columns.

What each column means

Guessed from the column names. Choose again if a guess is wrong.

For two groups, paste two columns side by side (they may have different numbers of rows). For paired samples, put the before and after values of one item on one row. With a single value column, split it with the group column.

The column that splits a single value column into two groups. It must hold exactly two groups.

Line, part, machine, period … Select it to look at one value at a time.

Settings

Two samples (different items: two machines, two lots), paired samples (the same items before and after), or one sample (compared with a reference value).

Welch (equal variances not assumed) is the default. Choose "equal variances assumed" (pooled) only when the two spreads can be taken as the same. The F-test page compares them.

A value fixed before looking at the data: the drawing value, a target, or the mean of the previous process.

More settings (Unit, Chart title, Period, Stratum)

e.g. MPa.

Empty: "t-test (test)".

e.g. 1–31 Oct 2026. Written on the chart and the report.

Empty: all rows. A value: only the rows with that value.

Judgement rules

Decide the significance level and the alternative hypothesis before looking at the data. If you change them, write it in the report.

Two-sided (different) is the usual choice. Use one-sided only when the direction was fixed before looking at the data (e.g. did the change make it smaller?).

The default is a common guideline (see —).

Usually 0.05 (5 %). The confidence interval is given at 1 − α (95 % for 0.05). Decide it before looking at the data.

The default is a common guideline (see —).

Result

p-value 0.0211: Significant difference (α = 0.05)

Result of the sample data

t-test (two samples)n = 12, 10 Welch t = 2.594 df = 14.10 p = 0.0211 two-sided Unit: MPat-test (two samples)n = 12, 10 Welch t = 2.594 df = 14.10 p = 0.0211 two-sided Unit: MPaBox (quartiles)Mean95 % confidence interval of the difference of the means (Lot A − Lot B)400.0420.0440.0460.0480.0Value (MPa)Lot An = 12 mean 449.1Lot Bn = 10 mean 437.395 % confidence interval of the difference of the means (Lot A − Lot B) (MPa)−10.00.010.020.030.0Estimate 11.775Lower 2.046Upper 21.504Dashed: difference 0

Significant difference (α = 0.05)

A difference is called significant when the p-value (two-sided) is at most the significance level 0.05; here p = 0.0211 (two samples). A test result does not show the size of the difference or its cause.

p-value (two-sided)
0.0211
t statistic t
2.5940
Difference of the means (Lot A − Lot B)
11.775 MPa

About the data

  • The result has been checked to be the same as Excel's T.TEST(array1, array2, 2, 3) (third argument 1: one-tailed, 2: two-tailed; fourth argument 1: paired, 2: equal variances, 3: Welch).

How to read it

What the chart shows

  • At the significance level 0.05, the means of Lot A and Lot B differ (p = 0.0211).
  • Difference of the means (Lot A − Lot B): 11.775 MPa; 95 % confidence interval 2.046 to 21.504 MPa.
  • The ratio of the two variances is 0.355; the F-test gives p = 0.1089 (the F-test page shows the details).

Common misreadings

  • A small p-value does not mean a large difference. With much data, even a small difference is significant. Judge the size of the difference by the confidence interval and decide whether it matters in practice.
  • Testing two at a time among three or more groups makes a chance significant result likely somewhere (multiple comparisons). Compare three or more groups with analysis of variance or a similar method.
  • Welch's t-test (equal variances not assumed) is used, so the degrees of freedom are not a whole number. It works whether the spreads are the same or not.

Next steps

  • Check whether the direction and the size of the difference (the confidence interval) matter in practice, and look for the cause (the 4M differences). If needed, collect confirmation data under matched conditions.
  • The spreads of the two groups can be compared with the F-test.

Numbers

p-value (two-sided)0.0211
t statistic t2.5940
Degrees of freedom ν14.104
Difference of the means (Lot A − Lot B)11.775 MPa
95 % confidence interval of the difference of the means (Lot A − Lot B)2.046 to 21.504 MPa
Mean (Lot A)449.07 MPa
Mean (Lot B)437.30 MPa
Standard deviation (Lot A)7.514 MPa
Standard deviation (Lot B)12.610 MPa
Sample size (Lot A)12
Sample size (Lot B)10
Standard error4.5394 MPa
Critical value of t (two-sided, 95 %)2.1433

Calculation steps
  1. Means and variancesx̄ = Σx / n, s² = Σ(x − x̄)² / (n − 1)Lot A: n = 12, x̄ = 449.0750, s² = 56.463864; Lot B: n = 10, x̄ = 437.3000, s² = 159.006667
  2. t statistic (Welch)t = (x̄₁ − x̄₂) / √(s₁²/n₁ + s₂²/n₂)11.7750 / 4.5394 = 2.5940
  3. Degrees of freedom (Welch–Satterthwaite)ν = (s₁²/n₁ + s₂²/n₂)² / ( (s₁²/n₁)²/(n₁ − 1) + (s₂²/n₂)²/(n₂ − 1) ) (not rounded to an integer)ν = 14.104
  4. p-valuep = 2 × P(T ≥ |t|) (t distribution with ν degrees of freedom)t = 2.5940, ν = 14.104 → p = 0.0211
  5. 95 % confidence intervalestimate ± t(1 − α/2, ν) × standard error11.7750 ± 2.1433 × 4.5394 → 2.0457 to 21.5043
Values by group
GroupnMeanStandard deviationMinMax
Lot A12449.077.514438.7461.5
Lot B10437.3012.610410.3451.8

The results are reference values based on the data you entered and the formulas and criteria shown. They are not a quality guarantee or a pass/fail decision. The final decision rests with you.

Next tool: Compare the two variances with the F-test

References

  • D. C. Montgomery, Introduction to Statistical Quality Control, 8th ed., 2019 · Wiley
  • NIST/SEMATECH e-Handbook of Statistical Methods, 1.3.5.3 Two-Sample t-Test for Equal Means · NIST · Open
  • NIST/SEMATECH e-Handbook of Statistical Methods, 1.3.5.2 Confidence Limits for the Mean · NIST · Open
  • JIS Z 8101-2:2015 Statistics — Vocabulary and symbols — Part 2: Applied statistics (in Japanese) · Japanese Standards Association (JSA)

Standards are shown by number and title only.

t-test explained

A t-test is a hypothesis test that checks, with the t distribution, whether the difference between two means (or between a mean and a reference value) is larger than the spread of the data can explain by chance. It is used to compare two machines or two lots (two-sample t-test, with or without assuming equal variances), the same items before and after a change (paired t-test), and a process mean against a target or drawing value (one-sample t-test).

t-test by hand: the calculation step by step

  1. Before looking at the data, decide the question (different, or greater in one direction) and the significance level α (usually 0.05).
  2. For each group, compute the sample size n, the mean x̄ and the standard deviation s (for paired samples, the mean and standard deviation of the differences d of the pairs).
  3. Compute the t statistic. Two samples: t = (x̄₁ − x̄₂) / √(s₁²/n₁ + s₂²/n₂) (Welch). Paired samples: t = d̄ / (s_d / √n). One sample: t = (x̄ − μ₀) / (s / √n), where μ₀ is the reference value.
  4. Get the p-value from the t distribution with ν degrees of freedom (doubled for a two-sided test). If the p-value is at most α, the difference is statistically significant.
  5. Compute the confidence interval of the difference (estimate ± t × standard error) and judge whether the size of the difference matters in practice.

Worked examples

  1. Example 1: Two samples, equal variances assumed (two machines, three parts each)

    Machine 1	Machine 2
    10	12
    11	13
    12	14

    Settings: Variances of the two samples = Equal variances assumed (pooled)

    Means 11 and 13, both variances 1 → sp = √((2 × 1 + 2 × 1)/4) = 1. t = (11 − 13) / (1 × √(1/3 + 1/3)) = −2 / 0.816497 = −2.449490, ν = 4. Two-sided p = 2 × P(T₄ ≥ 2.449490) = 0.070484 (greater than 0.05: not significant). 95 % confidence interval = −2 ± 2.776445 × 0.816497 = −4.266958 to 0.266958 (it contains 0).

  2. Example 2: Two samples, Welch (two lots with different spreads)

    Lot A	Lot B
    20	30
    22	20
    24	40
    	10

    Lot A: n = 3, mean 22, variance 4. Lot B: n = 4, mean 25, variance 166.6667. s₁²/n₁ = 1.333333, s₂²/n₂ = 41.666667, standard error = √43 = 6.557439. t = −3 / 6.557439 = −0.457496. ν = 43² / (1.333333²/2 + 41.666667²/3) = 1849 / (0.888889 + 578.703704) = 1849 / 579.592593 = 3.190172 (not rounded to an integer). The two-sided p from the t distribution with 3.190172 degrees of freedom is 0.676688 (not significant).

  3. Example 3: Paired samples, before and after a change (five parts)

    Before	After
    12	10
    15	13
    11	10
    14	11
    13	11

    Settings: Test = Paired samples (before and after), Alternative hypothesis = One-sided (the first is greater)

    Differences (before − after) 2, 2, 1, 3, 2 → mean 2, standard deviation √(0.5) = 0.707107. t = 2 / (0.707107 / √5) = 6.324555, ν = 4. One-sided p (before is greater) = P(T₄ ≥ 6.324555) = 0.0015991 (significant).

  4. Example 4: One sample of two values (one degree of freedom)

    Diameter
    10.02
    10.04

    Settings: Test = One sample (against a reference value), Reference value (one sample) = 10

    Mean 10.03, standard deviation √(0.0002) = 0.0141421. t = (10.03 − 10) / (0.0141421 / √2) = 0.03 / 0.01 = 3, ν = 1. Two-sided p = 2 × P(T₁ ≥ 3) = 1 − (2/π) arctan 3 = 0.204833 (the t distribution with one degree of freedom is the Cauchy distribution).

  5. Example 5: One value in a group, equal variances assumed (computed)

    A	B
    10	13
    12	
    14	

    Settings: Variances of the two samples = Equal variances assumed (pooled)

    A: n = 3, mean 12, sum of squares 8. B: n = 1 (sum of squares 0). sp = √(8 / 2) = 2, ν = 3 + 1 − 2 = 2. t = (12 − 13) / (2 × √(1/3 + 1)) = −1 / 2.309401 = −0.433013. A note says that the single value of B adds nothing to the spread.

  6. Example 6: One value in a group, Welch (not computed)

    A	B
    10	13
    12	
    14	

    Welch's test uses the variance of each group, so it cannot be computed with a group of one value (no variance). The page asks to assume equal variances or to add data.

  7. Example 7: All values the same (no spread)

    Before	After
    5	5
    5	5
    5	5

    Settings: Test = Paired samples (before and after)

    All the differences are 0 and so is their standard deviation. t = 0/0 cannot be computed, which the page says (and asks to check whether the measurement resolution is too coarse).

  8. Example 8: Significance level out of range (input error)

    A	B
    1	2
    2	3

    Settings: Significance level α = 5

    A significance level of 5 (500 %) is not possible. The page asks for a value greater than 0 and less than 0.5 (usually 0.05).

Common mistakes

  • Reading "not significant" as "no difference" (with little data, a real difference may not be significant; look at the width of the confidence interval).
  • Reading a smaller p-value as a larger difference (the p-value also falls as the sample size grows; judge the size of the difference by the confidence interval).
  • Running many t-tests between pairs of three or more groups (some comparison becomes significant by chance; use analysis of variance or a multiple comparison method instead).
  • Testing before-and-after data of the same items as two independent samples (the item-to-item variation goes into the spread and hides the difference; use the paired t-test).

FAQ

Should I use Welch's t-test or the pooled (equal variances) t-test?
This page uses Welch's t-test (equal variances not assumed) by default: when the two spreads are the same, its result is almost the same as the pooled test, and when they differ it is much less likely to mislead. If there is a reason to take the variances as equal, you can choose "equal variances assumed". The F-test page compares the two variances.
Does it give the same result as Excel's T.TEST?
Yes. The results have been checked against Excel's T.TEST (values computed in Microsoft Excel 16 agree to 15 digits). In T.TEST(array1, array2, tails, type), tails 1 is one-sided and 2 is two-sided; type 1 is paired, 2 is two samples with equal variances, and 3 is Welch (unequal variances). Excel's one-sided value is the probability on the side the data point to. T.TEST has no one-sample test.
Should I use a one-sided or a two-sided test?
Usually two-sided. Use a one-sided test only when the direction was fixed before looking at the data and a difference in the other direction would mean nothing, as in "did the change make it smaller?". Choosing one-sided after seeing the data makes the real significance level looser than stated.
Can I compute it from the means and standard deviations only?
This page computes from the measurements themselves (raw data). It does not compute from summary values (means, standard deviations and sample sizes) alone. Raw data also let you check the box plots and the confidence interval at the same time.
Is my data sent anywhere?
No. The calculations and the chart are made in your browser only.

Scope

t-tests from raw data: two samples (Welch or equal variances assumed), paired samples and one sample; two-sided or one-sided. The data are assumed to be close to a normal distribution.

Not covered by this tool:

  • Calculation from means, standard deviations and sample sizes alone.
  • Comparison of three or more groups (analysis of variance) and rank-based tests (for non-normal data).

Excel template: t-test

A template with the column names and sample values only (no formulas). Enter your values, then copy the range and paste it into the box above.

Download the template (t-test-template.xlsx)

Related tools

Request a tool (contact page of the official site)

Report

The company name and the other fields are kept on this device only.

Contact

We take enquiries on the contact page of the MechOwl official site. Requests for tools you would like are welcome there too.

To the contact page(opens in a new tab)