What this calculator does
A t test asks whether a difference between a sample mean and a reference value, or between two sample means, is bigger than random sampling variation alone would typically produce. The t-statistic itself is only the halfway point; it still has to be converted into a p-value and compared against a threshold before there is an actual answer to that question.
This t-test calculator carries that whole process through in one place: it computes the t-statistic and degrees of freedom for a one-sample or two-sample test, converts the t-statistic into a p-value for the tail direction chosen, and states plainly whether the result is significant at the common 0.05 and 0.01 levels.
The formula
The t-statistic itself follows the usual formulas: one-sample, t = (sample mean − reference mean) / (s/√n); two-sample pooled, t = (mean₁ − mean₂) / (pooled SD × √(1/n₁ + 1/n₂)). That t-statistic is then converted to a p-value using the t-distribution’s cumulative probability at the chosen degrees of freedom, doubled for a two-tailed test or left as a single tail for a directional one, and compared against 0.05 and 0.01.
| Term | Meaning |
|---|---|
| t-statistic | How many standard errors the observed difference sits from zero, under the null hypothesis of no real difference. |
| Degrees of freedom | A sample-size-based parameter shaping the t-distribution; larger samples give a distribution closer to the standard normal. |
| p-value | The probability of a t-statistic at least this extreme occurring by chance alone, if there were truly no difference. |
The inputs explained
| Field | What to enter |
|---|---|
| Test type | Choose a one-sample test against a fixed reference mean, or a two-sample test comparing two independent groups. |
| Tail | Two-tailed tests for any difference in either direction; one-tailed tests for a difference specifically greater than, or specifically less than, the comparison value. |
| Sample 1 mean | The mean of sample 1. |
| Sample 1 standard deviation | The standard deviation of sample 1. |
| Sample 1 size | The number of observations in sample 1. |
| Reference mean (μ), one-sample only | The fixed reference mean being tested against, for a one-sample test only. |
| Sample 2 mean, two-sample only | The mean of sample 2, for a two-sample test only. |
| Sample 2 standard deviation, two-sample only | The standard deviation of sample 2, for a two-sample test only. |
| Sample 2 size, two-sample only | The number of observations in sample 2, for a two-sample test only. |
When to use it
Checking whether a sample differs from a known standard
A batch of manufactured parts, a class’s test scores, or a set of lab readings is compared against a known target or historical average using a one-sample t test, to see whether the difference is too large to put down to chance.
Comparing two independent groups
A trial comparing two groups, such as a treatment group against a control group, or two suppliers’ measured output, uses the two-sample test to check whether their mean difference is statistically significant.
Deciding on significance without a separate t-table lookup
Rather than computing a t-statistic and then separately looking up a critical value in a t-table for the right degrees of freedom, this calculator returns the actual p-value and states the significance verdict directly.
Worked examples
Every figure in the tables below is produced by this page’s own calculator at build time, so the numbers and the tool always agree. Select any row to load that scenario.
How does the p-value change as the two sample means move apart?
Sample 1 fixed at a mean of 52 with a standard deviation of 8 across 25 observations, against a sample 2 with standard deviation 9 and 22 observations, as its mean moves further from sample 1’s.
How does sample size affect significance at a fixed difference?
A one-sample test with a fixed 2-point difference between the sample mean and the reference mean, and a fixed standard deviation of 8, across a range of sample sizes.
Questions
What is a t test used for?
A t test checks whether a difference between a sample mean and a reference value, or between two sample means, is larger than would be expected from random sampling variation alone, using the t-distribution rather than the normal distribution to account for a limited sample size.
What counts as a significant t-test result?
By the common conventions used here, a p-value below 0.05 is usually called statistically significant, and a p-value below 0.01 is a stronger result. Neither threshold is a law of nature; they are widely used conventions, and the actual p-value is more informative than a bare yes or no.
What is the difference between a t-statistic calculator and a full t-test calculator?
A bare t-statistic calculator stops at the t-statistic and degrees of freedom, leaving the comparison against a critical value to be done separately, usually from a printed t-table. This t-test calculator carries that comparison through automatically, reporting the p-value and the significance verdict at 0.05 and 0.01.
Should I use a one-tailed or two-tailed test?
A two-tailed test checks for a difference in either direction and is the standard, more conservative choice. A one-tailed test only makes sense when the direction of any real difference was decided before looking at the data, such as specifically testing whether a new process is faster, not just different.
For just the t-statistic and degrees of freedom without a p-value, see the t-statistic calculator. To convert any z, t, chi-square or F test statistic into a p-value directly, see the p-value from a test statistic calculator.