StatGardenREF. DESK
Calculators/Statistics/Degrees of freedom
Statistics

Degrees of freedom calculator

Works out degrees of freedom for a one-sample, two-sample or chi-square test.

Published 9 August 2026 · Updated 25 September 2026

What this calculator does

Degrees of freedom are the number of values free to vary once the constraints of a calculation are imposed. A one-sample test on 15 observations has 14, because fixing the mean determines the last value.

The Welch case is the one worth attention. With samples of 15 and 12 and standard deviations of 2.1 and 3.4, the equal-variance formula gives 25 but Welch gives 17.46. That reduction is the penalty for not assuming equal variances, and it makes the test more conservative rather than less accurate.

The formula

Formula1-sample: df=n−1. 2-sample (equal var): df=n₁+n₂−2. Welch: df=(s₁²/n₁+s₂²/n₂)²÷[(s₁²/n₁)²/(n₁−1)+(s₂²/n₂)²/(n₂−1)]. Chi-square: df=(rows−1)(cols−1)

The one-sample case is n−1. The equal-variance two-sample case is n₁+n₂−2. The Welch-Satterthwaite approximation combines the variances and sizes into an effective degrees of freedom that is usually fractional and always between the smaller sample minus one and the pooled figure. The chi-square case for a contingency table is (rows−1)(columns−1).

TermMeaning
Degrees of freedomThe number of independent values remaining after constraints.
Welch-SatterthwaiteAn approximation giving effective degrees of freedom when variances differ.
Pooled dfn₁+n₂−2, valid only under the equal-variance assumption.
Contingency table df(rows−1)(columns−1), since row and column totals are fixed.

The inputs explained

FieldWhat to enter
Sample size n₁First sample size.
Sample size n₂ (0 if one-sample)Second sample size. Set to 0 for a one-sample test.
Std deviation s₁ (for Welch)First standard deviation, used only for the Welch calculation.
Std deviation s₂ (for Welch)Second standard deviation, used only for the Welch calculation.
Rows (for chi-square, 0 to skip)Rows in a contingency table, for the chi-square figure. Set to 0 to skip.
Columns (for chi-square, 0 to skip)Columns in a contingency table. Set to 0 to skip.

When to use it

Looking up a critical value

Every t and chi-square table is indexed by degrees of freedom, so it is needed before any lookup.

Choosing between pooled and Welch

Seeing how far Welch falls below the pooled figure shows how much the unequal variances cost.

Analysing a contingency table

A chi-square test of independence needs the row and column counts rather than the sample size.

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 Welch compare with the pooled figure?

Increasingly unequal standard deviations.

n₁ = 15, n₂ = 12, s₂ = 3.4
Sample 1 standard deviationWelch-Satterthwaite dfTwo-sample df, equal variance (n₁+n₂−2)One-sample df (n₁ − 1)
s₁ = 112.532514
s₁ = 2.117.462514
s₁ = 3.423.712514
s₁ = 819.752514
The equal-variance figure stays at 25 throughout, since it depends only on the sample sizes. Welch moves with the variance ratio, falling to 12.53 when the standard deviations are furthest apart. Note that even the equal-SD row gives 23.71 rather than 25, because the sample sizes themselves are unequal.

Questions

What are degrees of freedom?

The number of values in a calculation that are free to vary. With a sample of 15 and the mean fixed, 14 values can be anything and the fifteenth is then determined. Each constraint imposed costs one degree of freedom.

Why does the Welch test have fractional degrees of freedom?

Because the Welch-Satterthwaite formula is an approximation that matches moments rather than counting constraints. It produces whatever value best approximates the true sampling distribution, which is rarely a whole number. Software interpolates in the t-distribution accordingly.

Why is chi-square df (rows−1)(cols−1)?

Because the row and column totals are treated as fixed. Once all but the last cell in each row and column is known, the remainder are determined by the totals, leaving (rows−1)(columns−1) cells genuinely free to vary.

Do more degrees of freedom make a test more powerful?

Generally yes. As degrees of freedom rise the t-distribution approaches the normal, critical values shrink and it becomes easier to detect a real effect. That is one reason Welch conservatism, which lowers df, slightly reduces power when variances happen to be equal.

For the statistic itself, see the t-statistic calculator. For looking up a threshold, see the critical value calculator.