Skip to content
CalculatorAtlas

Degrees of Freedom Calculator

Tested

Degrees of freedom for one- and two-sample t-tests.

Tested, not yet published. The formula for this calculator is implemented and passes its automated checks. This page stays non-indexable until it is reviewed and published.

Results

Enter your values and press Calculate. Results appear here.

  • • Result

Quick answer

Degrees of freedom depend on the test: n − 1 for a one-sample test, n₁ + n₂ − 2 for pooled and the Welch–Satterthwaite formula for unequal variances. A one-sample test with n = 25 has 24 degrees of freedom.

Choose the test and enter the sample sizes (and standard deviations for Welch). The calculator returns the degrees of freedom.

Related tools: P-Value Calculator: P-value from a z, t, chi-square or F statistic. T Statistic Calculator: t statistic from summary statistics. Critical Value Calculator: Critical values for z, t, chi-square and F distributions.

How to use the Degrees of Freedom Calculator

  1. Choose test: One sample (n − 1), Two samples, pooled (n₁ + n₂ − 2) and Two samples, Welch.
  2. Enter n₁ (a whole number, 2 or more).
  3. Optionally, enter n₂ (two-sample) (a whole number, 2 or more).
  4. Optionally, enter s₁ (Welch) (above 0).
  5. Optionally, enter s₂ (Welch) (above 0).
  6. Press Calculate to see the result, and use Reset to start again.
Inputs of the Degrees of Freedom Calculator
InputWhat to enterAllowed values
TestChoose one: One sample (n − 1); Two samples, pooled (n₁ + n₂ − 2); Two samples, WelchStarts at One sample (n − 1)
n₁A whole number≥ 2
n₂ (two-sample) (optional)A whole number≥ 2
s₁ (Welch) (optional)A number> 0
s₂ (Welch) (optional)A number> 0

Formula and method

Formula

one-sample: n − 1; pooled: n₁ + n₂ − 2; Welch–Satterthwaite: (s₁²/n₁ + s₂²/n₂)² ÷ [(s₁²/n₁)²/(n₁−1) + (s₂²/n₂)²/(n₂−1)]

IEEE-754 double precision; shown to at most 6 decimal places.

Welch's df is generally fractional.

Worked examples

These examples are verified: each one is an automated test case that the live calculator must reproduce exactly.

Example 1

Inputs: Test = One sample (n − 1); n₁ = 25.

Results of example 1
ResultValue
Degrees of freedom24

Example 2

Inputs: Test = Two samples, pooled (n₁ + n₂ − 2); n₁ = 10; n₂ (two-sample) = 12.

Results of example 2
ResultValue
Degrees of freedom20

Example 3

Inputs: Test = Two samples, Welch; n₁ = 10; n₂ (two-sample) = 12; s₁ (Welch) = 2; s₂ (Welch) = 3.

Results of example 3
ResultValue
Degrees of freedom19.190546

The first line is the headline result (degrees of freedom). IEEE-754 double precision; shown to at most 6 decimal places.

Why n − 1

Once the sample mean is fixed, only n − 1 values can vary freely; the last is determined. That is why the sample variance divides by n − 1.

Welch

With unequal variances the Welch formula (s₁²/n₁ + s₂²/n₂)² ÷ [(s₁²/n₁)²/(n₁ − 1) + (s₂²/n₂)²/(n₂ − 1)] gives a non-integer df. n₂ is required for two samples, and s₁ and s₂ for Welch.

How the result changes with n₁

Holding every other input at the first worked example, this table changes only n₁. It shows how sensitive the answer is to that one value; each row was produced by running this calculator.

How the result changes with n₁
n₁Degrees of freedom
1312
2524
5049
10099

What happens with invalid input

These messages are produced by the calculator itself, so you know what to fix.

  • n₂ (two-sample): left empty shows "Enter n₂." beside that field and no result.
  • s₂ (Welch): left empty shows "Enter s₂." beside that field and no result.

Choosing between the Degrees of Freedom Calculator and similar calculators

Each row shows what a related calculator on this site asks for and what it returns, so you can pick the one that matches your question.

Choosing between the Degrees of Freedom Calculator and similar calculators
CalculatorYou enterIt returns
[P-Value Calculator](/statistics/p-value/)test statistic, statistic value and test typep-value
[T Statistic Calculator](/statistics/t-statistic/)sample mean, hypothesised mean and sample standard deviationt statistic
[Critical Value Calculator](/statistics/critical-value/)distribution, significance level and tailsCritical value
[One-Sample T-Test Calculator](/statistics/t-test-calculator/)sample mean, hypothesised mean and sample standard deviationt statistic
[One-Sample Z-Test Calculator](/statistics/z-test/)sample mean, hypothesised mean and population σz statistic

Background: hypothesis testing and inference

A hypothesis test compares a test statistic with what the null hypothesis predicts. The decision rule is to reject the null hypothesis when the p-value is at or below the significance level α, which you should choose before seeing the data (0.05 is conventional, not special). For a two-tailed z test the p-value is 2 × (1 − Φ(|z|)); for a one-sample t test the statistic is (x̄ − μ₀) ÷ (s ÷ √n) with n − 1 degrees of freedom.

Failing to reject the null hypothesis does not prove it true, and a statistically significant result can still be too small to matter in practice.

Assumptions and limitations

  • n₂ required for two samples
  • s₁ and s₂ required for Welch

If a required value is empty, not a number, or outside its allowed range, the form marks that field with a message and shows no result instead of a misleading number. The automated checks deliberately try invalid entries for n₂ (two-sample) and s₂ (Welch) to confirm this.

Frequently asked questions

What is the pooled df for 10 and 12?

A pooled test with samples of 10 and 12 has 10 + 12 − 2 = 20 degrees of freedom.

Why can df be fractional?

The Welch formula returns real numbers.

How do df affect the t distribution?

Fewer df give heavier tails.

What does the Degrees of Freedom Calculator calculate?

Degrees of freedom for one- and two-sample t-tests. It returns Degrees of freedom.

What formula does the Degrees of Freedom Calculator use?

one-sample: n − 1; pooled: n₁ + n₂ − 2; Welch–Satterthwaite: (s₁²/n₁ + s₂²/n₂)² ÷ [(s₁²/n₁)²/(n₁−1) + (s₂²/n₂)²/(n₂−1)]. Welch's df is generally fractional.

What do I need to enter in the degrees of Freedom Calculator?

You enter Test and n₁. Optional: n₂ (two-sample), s₁ (Welch) and s₂ (Welch).

How is the result rounded or limited?

IEEE-754 double precision; shown to at most 6 decimal places. n₂ required for two samples.

What are the limits of this calculator?

n₂ required for two samples. s₁ and s₂ required for Welch.

What does the “Test” option change?

It sets how the degrees of Freedom is worked out. The choices are One sample (n − 1), Two samples, pooled (n₁ + n₂ − 2) and Two samples, Welch.

What is an example of a degrees of Freedom result?

With test One sample (n − 1) and n₁ 25, the degrees of freedom is 24.

Sources

  • NIST/SEMATECH e-Handbook of Statistical Methods (itl.nist.gov/div898/handbook)
  • Standard textbook definitions (e.g. Moore, McCabe & Craig, Introduction to the Practice of Statistics)

Content last reviewed 2026-11-04. Formulas and worked examples are checked by automated tests against independently computed values.