acalculator

What are my degrees of freedom?

Pick your test and type the sample sizes. The degrees of freedom calculator gives the df with the formula written out, including Welch’s unequal-variance value and both ANOVA degrees of freedom.

Your numbers

Degrees of freedom
9

A one-sample t test with n = 10 has 9 degrees of freedom.

Formula
n − 1 = 10 − 1 = 9
In words
A one-sample t test with n = 10 has 9 degrees of freedom.

Degrees of freedom: 9. A one-sample t test with n = 10 has 9 degrees of freedom.

How to calculate

Finds the degrees of freedom for a one-sample, paired, pooled or Welch t test, a chi-square goodness-of-fit or independence test, or a one-way ANOVA.

Example with the default inputs (Test One-sample t test, Sample size (n) 10): A one-sample t test with n = 10 has 9 degrees of freedom.

Method: t: n − 1; pooled: n₁ + n₂ − 2; Welch: (s₁²/n₁ + s₂²/n₂)² ÷ [(s₁²/n₁)²/(n₁ − 1) + (s₂²/n₂)²/(n₂ − 1)]; goodness of fit: k − (parameters + 1); table: (r − 1)(c − 1); ANOVA: k − 1 and N − k.

  • Welch’s degrees of freedom are not rounded; tables and some software round them down.
  • For goodness of fit, k counts the non-empty categories, and the parameters are those estimated from the data.
  • For a paired t test, n is the number of pairs.

Machine-readable copies: Markdown, JSON.

Worked examples

Each example is checked against the calculator on every build.

  1. Test One-sample t test, Sample size (n) 10 gives Degrees of freedom 9.Source: NIST/SEMATECH e-Handbook of Statistical Methods, §1.3.5.2 Confidence Limits for the Mean (t with N − 1 degrees of freedom), https://www.itl.nist.gov/div898/handbook/eda/section3/eda352.htm (retrieved 2026-10-02)
  2. Test Two-sample t test, equal variances, Sample 1 size (n₁) 249, Sample 2 size (n₂) 79 gives Degrees of freedom 326.Source: NIST/SEMATECH e-Handbook of Statistical Methods, §1.3.5.3 Two-Sample t-Test for Equal Means (ν = N₁ + N₂ − 2 for equal variances; the Welch–Satterthwaite ν otherwise; N₁ = 249, N₂ = 79 gives ν = 326), https://www.itl.nist.gov/div898/handbook/eda/section3/eda353.htm (retrieved 2026-10-02)
  3. Test Welch’s t test, unequal variances, Sample 1 size (n₁) 249, Sample 2 size (n₂) 79, Sample 1 standard deviation 6.4147, Sample 2 standard deviation 6.10771 gives Degrees of freedom 136.87499, Pooled df (equal variances) 326.Source: NIST/SEMATECH e-Handbook of Statistical Methods, §1.3.5.3 Two-Sample t-Test for Equal Means (ν = N₁ + N₂ − 2 for equal variances; the Welch–Satterthwaite ν otherwise; N₁ = 249, N₂ = 79 gives ν = 326), https://www.itl.nist.gov/div898/handbook/eda/section3/eda353.htm (retrieved 2026-10-02)
  4. Test Chi-square goodness of fit, Categories (k) 6, Estimated parameters 2 gives Degrees of freedom 3.Source: NIST/SEMATECH e-Handbook of Statistical Methods, §1.3.5.15 Chi-Square Goodness-of-Fit Test (k − c degrees of freedom, k non-empty cells, c = estimated parameters + 1), https://www.itl.nist.gov/div898/handbook/eda/section3/eda35f.htm (retrieved 2026-10-02)
  5. Test Chi-square test of independence, Rows (r) 3, Columns (c) 4 gives Degrees of freedom 6.Source: NIST/SEMATECH e-Handbook of Statistical Methods, §7.4.5 How can we compare the results of classifying according to several categories? ((r − 1)(c − 1) for r rows and c columns), https://www.itl.nist.gov/div898/handbook/prc/section4/prc45.htm (retrieved 2026-10-02)
  6. Test One-way ANOVA, Groups (k) 3, Total values (N) 15 gives Degrees of freedom 2, df within groups 12, df total 14.Source: NIST/SEMATECH e-Handbook of Statistical Methods, §7.4.3.4 One-way ANOVA calculations (k − 1 for treatments, N − k for error), https://www.itl.nist.gov/div898/handbook/prc/section4/prc434.htm (retrieved 2026-10-02)

How it works

TestInputsDegrees of freedom
One-sample tsample size nn − 1
Paired tnumber of pairs nn − 1
Two-sample t, equal variancesn₁, n₂n₁ + n₂ − 2
Welch’s t, unequal variancesn₁, n₂, s₁, s₂(s₁²/n₁ + s₂²/n₂)² ÷ [(s₁²/n₁)²/(n₁ − 1) + (s₂²/n₂)²/(n₂ − 1)]
Chi-square goodness of fitcategories k, estimated parameters pk − (p + 1)
Chi-square independencerows r, columns c(r − 1)(c − 1)
One-way ANOVAgroups k, total values Nk − 1 between, N − k within (N − 1 total)

For Welch’s formula, s₁ and s₂ are first divided by the larger of the two, which leaves ν unchanged and keeps the squares in range. Welch’s ν is not rounded; the page also shows the pooled n₁ + n₂ − 2.

Rules

  • Sample sizes, categories and groups are whole numbers from 2 to 1,000,000,000, and rows and columns from 2 to 1,000,000 (so (r − 1)(c − 1) stays exact); the total N is at least 3, and the number of estimated parameters is 0 or more.
  • Standard deviations are greater than 0 and at most 10³⁰⁰.
  • Goodness of fit needs k − (p + 1) ≥ 1, and ANOVA needs N > k; otherwise there is no answer.

Output format. Whole-number degrees of freedom with thousands separators. Welch’s ν to 10 significant digits, and to 6 in the formula and the sentence, which also gives ν rounded down.

Worked examples by hand

One-sample t, n = 10: 10 − 1 = 9.

NIST’s car data, pooled: 249 + 79 − 2 = 326.

The same data with Welch’s formula (s₁ = 6.4147, s₂ = 6.10771): s₁²/n₁ = 41.148 ÷ 249 = 0.165255 and s₂²/n₂ = 37.304 ÷ 79 = 0.472204. ν = (0.637459)² ÷ (0.165255² ÷ 248 + 0.472204² ÷ 78) = 0.406353 ÷ 0.002968793 = 136.87.

Goodness of fit, 6 categories, 2 estimated parameters: 6 − (2 + 1) = 3.

A 3 × 4 table: (3 − 1)(4 − 1) = 6.

ANOVA, 3 groups, 15 values: 2 and 12 (14 in total).

Other questions people ask

What are degrees of freedom?

The number of values that are free to vary once the estimates a statistic uses are fixed. A sample of n values has n − 1 degrees of freedom around its mean, because the deviations from the mean must add to 0.

How do I find the degrees of freedom for a t test?

One-sample or paired: n − 1 (n pairs for a paired test). Two samples with equal variances: n₁ + n₂ − 2. Two samples with unequal variances: Welch’s formula, which usually gives a decimal between the smaller n − 1 and n₁ + n₂ − 2.

What is the Welch–Satterthwaite formula?

ν = (s₁²/n₁ + s₂²/n₂)² ÷ [(s₁²/n₁)²/(n₁ − 1) + (s₂²/n₂)²/(n₂ − 1)]. NIST gives it for the two-sample t test when the variances are not assumed equal. For NIST’s car data (249 and 79 cars, s = 6.4147 and 6.10771) it is 136.87, against 326 when pooled.

How many degrees of freedom does a chi-square test have?

Goodness of fit: k − c, where k is the number of non-empty categories and c is the number of estimated parameters plus 1, so k − 1 when nothing is estimated. Independence in an r × c table: (r − 1)(c − 1).

What are the degrees of freedom in a one-way ANOVA?

Two numbers: k − 1 between the groups and N − k within them, for k groups and N values. The F statistic uses both, written F(k − 1, N − k). With 3 groups of 5, that is F(2, 12).

Should I round Welch’s degrees of freedom?

Software uses the decimal value with the t distribution directly. Printed t tables list whole degrees of freedom, so with a table round down, which gives a slightly larger, more cautious critical value.