Degrees of freedom (df) appear in almost every test — the t-test, chi-square, ANOVA — and they decide the exact shape of the distribution used to get your p-value. Yet they're rarely explained clearly. Here's the intuition.

The core idea

Degrees of freedom = the number of values in a calculation that are free to vary once you've fixed the summaries you're using.

Suppose I tell you five numbers have a mean of 10. You can choose the first four freely — but the fifth is then locked in, because it must make the total add up to 50. So although there are 5 numbers, only 4 are free to vary. That's why the sample variance and standard deviation divide by n − 1: one degree of freedom was "used up" estimating the mean.

The one-line intuition: every quantity you estimate from the data (like the mean) costs you one degree of freedom.

Why n − 1 for the sample standard deviation

To compute the spread, you first estimate the mean from the same data. That estimate "ties up" one piece of information, leaving only n − 1 independent deviations from the mean. Dividing by n − 1 (rather than n) corrects for this and gives an unbiased estimate of the population variance — this is Bessel's correction. It's also why, with tiny samples, the correction matters a lot and shrinks toward negligible as n grows.

Degrees of freedom by test

TestDegrees of freedom
One-sample / paired t-testdf = n − 1
Two-sample t-test (equal var)df = n₁ + n₂ − 2
Chi-square (independence)df = (rows − 1)(columns − 1)
Chi-square (goodness of fit)df = categories − 1
One-way ANOVABetween: k − 1 · Within: N − k

Why it matters for your p-value

The t-distribution and chi-square distribution aren't single curves — they're families, one per degrees-of-freedom value. With few degrees of freedom (small samples) the t-distribution has fatter tails, so you need a larger t-statistic to reach significance. As df grows, the t-distribution approaches the normal curve. In other words, df is what makes small-sample tests appropriately cautious. You can see the exact cutoffs in the t-table.

Worked example. An independent t-test with 15 people per group has df = 15 + 15 − 2 = 28. You'd compare your t-statistic against the t-distribution with 28 degrees of freedom (critical value ≈ 2.05 for a two-tailed test at α = 0.05).

Run a test that reports df

T-Test Calculator →Reports the t-statistic, degrees of freedom, and p-value with interpretation.

Related reading: Interpreting p-values · T-test vs z-test · SD vs standard error