In plain English
Take five numbers with a mean of 10. Four of them can be anything at all; once they are chosen the fifth is forced, because the mean has to come out at 10. Four values are free to vary and one is not, so there are four degrees of freedom. That is the whole concept, and every formula below is a version of it: start with how many observations you have, subtract one for each quantity you estimated from those same observations along the way.
It matters because it selects the curve your test statistic is compared against. The t-distribution is a family, not a single shape, and degrees of freedom picks the member — few degrees of freedom give heavy tails and a demanding critical value, many give something indistinguishable from the normal curve. A t statistic of 2.3 is significant at 30 df and not at 4 df, and nothing about the data changed between those two readings except how much of it there was.
The subtraction is not bookkeeping pedantry; it is what stops a variance estimate from being biased. Dividing the sum of squared deviations by n rather than n − 1 systematically underestimates the spread, because the deviations are measured from the sample's own mean, which sits closer to the data than the true mean does. Dividing by the degrees of freedom instead of the count corrects that, which is why variance is defined with n − 1 in the denominator and why the correction matters most when n is small.
Different designs count differently and the arithmetic is worth knowing. A one-sample t-test has n − 1. A pooled two-sample t-test has n₁ + n₂ − 2, one subtracted for each mean estimated. A chi-square test on an r × c table has (r − 1)(c − 1), because once the row and column totals are fixed most of the cells are determined — a 2 × 2 table has just one free cell, which is why it has one degree of freedom. A one-way ANOVA splits its degrees of freedom into k − 1 between groups and N − k within them, and the F ratio is built from both.
The odd case is Welch's t-test, which returns a fraction — 8,040.3 rather than a whole number. That is not a rounding error. Welch's does not assume the two groups share a variance, so its effective degrees of freedom are computed from how the two variances and sample sizes combine, and the result has no reason to be an integer. Seeing a fractional df in output is confirmation that the correct default test was used rather than the pooled one.
The formula
One rule, applied to each design: the number of independent observations, minus one for every parameter estimated from those same observations.
- One-sample t-test
df = n − 1One mean was estimated from the data, so one value is no longer free.
- Chi-square on a contingency table
df = ( rows − 1 ) · ( columns − 1 )A 2 × 2 table gives 1; a 2 × 3 gives 2. Fixing the margins determines the rest — see the chi-square calculator.
- One-way ANOVA
df_between = k − 1, df_within = N − kk groups, N observations in total. The F statistic is a ratio of two variances carrying these two counts.
- Welch–Satterthwaite
df ≈ ( s₁²/n₁ + s₂²/n₂ )² / ( (s₁²/n₁)²/(n₁−1) + (s₂²/n₂)²/(n₂−1) )Fractional by design. A non-integer df in your output means Welch's test ran, which is the correct default.
Worked example
The same t statistic of 2.30 is produced by three studies of different sizes: a pilot with 5 users per arm, a mid-sized test with 16 per arm, and a full experiment with 500 per arm. All three used the pooled two-sample test. The question is which of them can call the result significant at the conventional 5% level.
- Test statistic (all three)
- t = 2.30
- Pilot
- n = 5 + 5, df = 8, critical value 2.306
- Mid-sized
- n = 16 + 16, df = 30, critical value 2.042
- Full experiment
- n = 500 + 500, df = 998, critical value 1.962
- Normal-curve critical value
- 1.960
The pilot misses at p = 0.0503. The mid-sized test clears at p = 0.0286. The full experiment clears at p = 0.0217.
Identical evidence, three different verdicts, and the only thing that varied was how much was estimated along the way. The pilot's near-miss is the instructive one: at 8 degrees of freedom the bar is 2.306 and the statistic is 2.30, so it fails by four thousandths — which is a good illustration of why treating 0.05 as a boundary between proof and failure is indefensible. Note also how fast the penalty disappears. Between 30 df and 998 df the critical value moves from 2.042 to 1.962, a difference of 4%, and beyond a few hundred observations degrees of freedom stop being something anyone needs to think about. They earn their attention in small studies, which is exactly where people are most tempted to reach for 1.96.
Common misconceptions
- דDegrees of freedom are just the sample size.”
- They are the sample size minus the number of quantities estimated from that same sample. The gap is negligible at n = 1,000 and decisive at n = 6, which is where the concept earns its keep. Treating the two as interchangeable means using a critical value that is too lenient, on exactly the small studies least able to afford it.
- דA fractional degrees-of-freedom value in the output means something is broken.”
- It means Welch's t-test ran rather than the pooled Student's version, which is the correct default for online experiments. Welch's computes an effective degrees of freedom from how the two variances and sample sizes combine, and that quantity has no reason to be a whole number. A fraction is reassurance, not an error.
- דMore degrees of freedom make it easier to find a significant result.”
- They lower the critical value, so in that narrow sense yes — but only because the extra data genuinely justifies a less cautious threshold. Degrees of freedom are a consequence of how much information you collected, not a lever. The effect also flattens quickly: nearly all of the benefit is captured by about 30, and past a few hundred there is essentially none left to gain.