How this instrument works
Degrees of freedom (df) is a count of how many values in a calculation are free to vary once certain constraints — like a computed mean — have been fixed. For a single sample of n observations used to estimate the sample standard deviation, df = n − 1. The intuition: once you know the mean of n numbers, only n − 1 of them can be chosen freely — the last one is forced, because it has to make the numbers add up to that mean. You lose one degree of freedom for every quantity estimated from the data rather than known in advance.
This matters practically because degrees of freedom controls the shape of the distribution you compare your test statistic against. A t-distribution with few degrees of freedom has heavier tails than the standard normal distribution — it takes a more extreme result to count as statistically significant with a small sample than with a large one. As df grows, the t-distribution converges toward the normal distribution, which is why t-tables and t-tests matter most for small samples; with very large n, t and z give nearly identical answers.
This calculator handles the one-sample case — a single sample's mean or variance, the most common situation in an introductory statistics course. Other designs have their own df formulas: a two-sample t-test typically uses (n₁ − 1) + (n₂ − 1), and a chi-square test of independence uses (rows − 1) × (columns − 1). Those follow the same underlying logic — count the constraints, subtract them from the total — but are separate calculations from the one this page performs.
- Enter your sample size into Sample size (n) — the number of observations or measurements you collected.
- Read Degrees of freedom — it's simply your sample size minus one.
- Use this figure to look up the correct row in a t-distribution or chi-square table when computing a confidence interval or p-value from a single sample.
- The sample size must be at least 2 — degrees of freedom is undefined for a single observation, since there's nothing left to vary once one number is fixed as 'the mean.'
Worked example — a sample of 30
A researcher collects a sample of n = 30 measurements and wants to build a 95% confidence interval around the sample mean using the t-distribution, since the population standard deviation isn't known. Enter 30 into Sample size (n).
The instrument returns df = 30 − 1 = 29. That 29 is the row to look up in a t-table (or the argument to pass to a t-distribution function in software) to find the correct critical value for the confidence interval or hypothesis test.
Questions
Why is it n − 1 and not just n?
Because computing the sample mean uses up one piece of information from the data. Once the mean of n numbers is fixed, only n − 1 of those numbers can still vary freely — the last one is mathematically forced to whatever value makes the mean come out right. That lost degree of freedom is exactly why the sample standard deviation formula also divides by n − 1 rather than n.
Does this formula work for a two-sample t-test?
No — this page computes the one-sample case only. A two-sample t-test (comparing two independent groups) generally uses (n₁ − 1) + (n₂ − 1) degrees of freedom for the pooled-variance version, or a more complex Welch-Satterthwaite approximation when the two groups' variances are assumed unequal. Those are different calculations from the single-sample n − 1 formula here.
What's the smallest sample size this accepts?
Two. With n = 1 there's no spread to measure at all — the single value is both the maximum and minimum, and standard deviation is undefined — so degrees of freedom of zero wouldn't correspond to anything computable. With n = 2, df = 1, the smallest meaningful case.
How does degrees of freedom affect a t-table lookup?
Each row of a t-distribution table corresponds to a specific df value, and the critical value in that row gets larger (more extreme) as df shrinks — a t-distribution with few degrees of freedom has fatter tails than the normal distribution, so you need a more extreme test statistic to reach the same significance level. As df grows past roughly 30, the t-distribution's critical values converge closely to the standard normal (z) values.
Is degrees of freedom the same thing as sample size?
No, though they're closely related — degrees of freedom is sample size minus the number of parameters estimated from the data before the statistic in question is computed. For the one-sample case here, exactly one parameter (the mean) is estimated first, so df = n − 1. In more complex models with multiple estimated parameters, df is reduced by more than one.