TapCub is live — analytics, insights and live chat, free on one platform
Glossary

What is a t-test? Types, formula and a worked example

A t-test checks whether the difference between two averages is larger than you would expect from random noise. The three types, the formula, a worked example and when to use something else.

Emma Collins Reviewed by Chen Yu Also called Student's t-test Last updated Nov 4, 2026 Glossary

Quick answer

A t-test is a statistical test that compares a mean, or the difference between two means, with the spread of the data to judge whether the difference is likely to be more than random noise.

Formula: Welch: t = (mean₁ − mean₂) / √(s₁²/n₁ + s₂²/n₂)

What is a t-test?

A t-test compares averages. It asks whether the difference between two means, or between one mean and a target, is large compared with how much the data varies. The result is a t statistic and a p-value.

It is called "t" because the test statistic follows Student's t distribution, published by William Gosset under the pen name "Student" in 1908.

The three types

TypeComparesExample
One-sampleOne mean with a fixed valueIs average session duration different from 120 seconds?
Two-sample (independent)Means of two separate groupsAverage order value in variant A vs variant B
PairedBefore and after for the same subjectsPages per session for the same users before and after a redesign

For two independent groups, use Welch's t-test by default. It does not assume the two groups have equal variance.

The formula

For Welch's t-test:

t = (mean₁ − mean₂) / √(s₁²/n₁ + s₂²/n₂)

where s is each group's standard deviation and n its size. The denominator is the standard error of the difference. Compare t with the t distribution at the right degrees of freedom to get the p-value.

A worked example

Average order value in two variants of a checkout page (sample numbers):

Variant AVariant B
Orders400400
Mean order value$52.0$48.0
Standard deviation$20$22
  1. Difference: 52.0 − 48.0 = 4.0
  2. Standard error: √(20²/400 + 22²/400) = √(1.00 + 1.21) = 1.487
  3. t = 4.0 / 1.487 = 2.69, with about 790 degrees of freedom
  4. Two-sided p ≈ 0.007

At a 0.05 threshold the difference is statistically significant. The 95% confidence interval is about 4.0 ± 2.9, so $1.1 to $6.9.

Assumptions and when to use something else

  • Independent observations. One row per order or user, not repeated events from the same person counted as separate samples.
  • Roughly normal means. With a few hundred values per group the mean is close to normal even if the data is skewed. Very heavy tails (a few huge orders) still distort it; consider trimming or winsorizing, or a Mann-Whitney test.
  • Yes/no outcomes. For conversion rates use a two-proportion test.
  • Many comparisons. Running a t-test on every segment inflates false positives; adjust with a Bonferroni correction.

Getting the inputs from TapCub

TapCub does not run A/B tests or calculate t-tests for you. What it gives you are the inputs: build a segment for each group, then use a distribution analysis on a numeric property (such as order amount) to see each group's mean, median and spread, and the sample size. For the full calculation, export the raw rows and compute the standard deviation in a spreadsheet or notebook.

Was this explanation clear?

We use your answers to fix and expand this page.

Emma Collins

Product Analyst

Focuses on event analysis, conversion funnels, and retention, using clear metric definitions and structured analysis to explain product performance.

FAQ

Questions people ask

Short answers to the follow-up questions that come up most.

Still have a question?

Chat with the team behind TapCub — we usually reply within a few hours on business days.

What does a t-test tell you?

Whether the gap between two averages is big relative to the variation in the data. A large t value means the gap is unlikely if there were no real difference.

When should I use a paired t-test?

When each value in one group has a matching value in the other, such as the same users measured before and after a change.

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

Student's assumes both groups have the same variance. Welch's does not, so it is the safer default for two independent groups.

Can I use a t-test for conversion rates?

For yes/no outcomes a two-proportion z-test or chi-square test is the usual choice. With large samples they give very similar answers.

See this number on your own site

Add one script tag for web and apps, and the first reports fill in within minutes.

See your data clearly. Find your growth.

Every click, backed by data. Install one line of code and see your first numbers in a minute.

No credit card · Free plans for analytics and chat · Cookieless analytics