Skip to main content

Degrees of freedom, explained

Degrees of freedom is the parameter everyone types in and almost nobody can define. It has a concrete meaning, a different formula for each test, and a real effect on the p-value you get.

7 min read · Last reviewed 7 August 2026

What it actually counts

Degrees of freedom is the number of values in a calculation that are free to vary. Every quantity you estimate from the data before computing your statistic uses one up.

The standard example: suppose five numbers have a mean of 10. You can choose the first four freely — say 8, 12, 9 and 14. The fifth is now forced to be 7, because nothing else produces a mean of 10. Four values were free; one was determined. That is why estimating a single mean costs one degree of freedom and leaves you with n − 1.

The formula for every common test

TestDegrees of freedom
One-sample tn − 1
Paired tn − 1, where n is the number of pairs
Two-sample t (pooled)n₁ + n₂ − 2
Two-sample t (Welch)Welch–Satterthwaite, usually fractional
Pearson correlationn − 2
Chi-square, independence(rows − 1) × (columns − 1)
Chi-square, goodness of fitcategories − 1
One-way ANOVAk − 1 and N − k
Linear regressionn − predictors − 1

The pattern holds throughout: start with the number of independent observations, subtract one for each parameter you had to estimate on the way.

Why F has two

An F-statistic is a ratio of two variances, and each carries its own degrees of freedom. In a one-way ANOVA with k groups and N observations, the numerator has k − 1 and the denominator has N − k. Both are needed to identify the distribution, which is why the F converter asks for two numbers where the t converter asks for one.

Why Welch's df is a decimal

Welch's t-test does not assume the two groups share a variance, so it cannot simply add the sample sizes and subtract two. Instead it estimates an effective degrees of freedom from the two observed variances using the Welch–Satterthwaite equation, and the result is almost never a whole number.

With n₁ = 15, s₁ = 4.2, n₂ = 18 and s₂ = 7.9, the pooled formula would give 31. Welch gives 26.751. Seeing a fractional df in R or SPSS output is not a bug — it is the signature of a Welch test, and it is the default here for the reasons the t-test calculator sets out.

What df does to your p-value

Small degrees of freedom mean heavier tails, because the variance was estimated from little data and could easily be wrong. Heavier tails mean the same statistic buys you a larger p-value. The identical t = 2.31 gives:

dfTwo-tailed p
50.06891
100.04351
270.02877
600.02434
2000.02191

The same evidence is significant at df = 10 and not at df = 5. This is not a quirk — it is the test correctly being more sceptical when you have less information about the spread.

As df grows the t-distribution converges on the normal. The two-tailed 5% critical value falls from 12.7062 at df = 1, to 2.2281 at df = 10, to 2.0423 at df = 30, to 1.9840 at df = 100, approaching the normal's 1.96 and never quite reaching it. By df = 100 the difference is too small to matter for most purposes, which is the origin of the rule of thumb that large samples can use z.

Two common mistakes

Entering n instead of df. With n = 30 a correlation has 28 degrees of freedom, not 30. Entering the sample size makes your p-value slightly too small. The converters here ask for whichever quantity is less ambiguous and say which one they want.

Counting pairs twice. A paired t-test on 20 people measured before and after has 19 degrees of freedom, not 39. There are 20 differences, not 40 independent observations — the pairing is the whole point of the design.

Keep reading

Ready to run the numbers?

Our calculator shows the shaded distribution, the exact p-value, and a plain-English reading of what it supports.

Open the P-Value Calculator

Frequently asked questions

What are degrees of freedom in simple terms?

The number of values in your calculation that are free to vary. If five numbers must average 10, four of them can be anything and the fifth is then fixed, so there are four degrees of freedom. Each parameter you estimate from the data — typically the mean — costs one, which is why so many formulas come out as n minus 1.

Why is it n - 1 and not n?

Because the sample mean was estimated from the same data. Once the mean is fixed, only n − 1 of the deviations from it can vary freely; the last one is determined because the deviations must sum to zero. Dividing by n − 1 rather than n also makes the sample variance an unbiased estimate of the population variance.

Why does my t-test show a decimal degrees of freedom?

You ran Welch's t-test. It estimates an effective degrees of freedom from the two sample variances through the Welch–Satterthwaite equation rather than adding sample sizes, and that estimate is rarely a whole number. A value like 26.751 where the pooled formula would give 31 is normal and correct.

What are the degrees of freedom for a chi-square test?

For a test of independence on a contingency table it is (rows − 1) x (columns − 1), so a 2 x 2 table has 1 degree of freedom regardless of how many observations it holds. For a goodness-of-fit test it is the number of categories minus 1. Note that df depends on the shape of the table, not on the sample size.

Does higher df mean a smaller p-value?

For a fixed test statistic, yes. More degrees of freedom mean lighter tails, so the same t-value sits further into the tail and yields a smaller p-value: t = 2.31 gives p = 0.0689 at df = 5 but p = 0.0219 at df = 200. That reflects greater confidence in the estimated variability, not a change in the underlying effect.

Do I enter n or degrees of freedom in a calculator?

Read the label, because different tools ask for different things. The correlation calculator here takes n and derives df = n − 2 internally, since sample size is what people have to hand for a correlation. The t converter takes df directly, because that is what appears in software output. Entering the wrong one shifts your p-value in the optimistic direction.