Confidence Interval and t-Test Calculator for a Mean: Margin of Error, t Value and p-Value

Estimate a population mean with a confidence interval and test it against a claimed value.

Calculated from standard textbook formulas, with every step shown. The formulas are fixed, so the working does not need checking: what matters is the numbers you type in. Use these calculators only if you are competent to choose the inputs (loads, material strength, dimensions, supports) and check your units and assumptions. For learning and checking your own working: design and sign-off are for a qualified engineer. Drafting Central does not store the numbers you type.

How this calculator works

Enter the sample mean, the sample standard deviation and the sample size.

Choose the confidence level, usually 95 percent, and the value of the mean to test against.

The calculator gives the standard error, the t value, the margin of error, the interval, the test statistic and the two-tailed p-value.

Formulas used

  • SE = \frac{s}{\sqrt{n}}
  • \bar{x}\pm t^*\,SE
  • t = \frac{\bar{x} - \mu_0}{SE},\quad df = n - 1

Worked example

With the default numbers in the calculator above:

  1. Standard error of the mean: 1.58
  2. Degrees of freedom: 9
  3. Critical t value for the confidence level (two-sided): 2.26
  4. Margin of error: 3.58
  5. Confidence interval for the mean: 46.42 to 53.58 (95.00 percent confident)
  6. For comparison, the z value for the same level (used if the population standard deviation is known, or n is large): 1.96, giving a margin of 3.10
  7. Test statistic for the null hypothesis that the mean is 47: 1.90
  8. Two-tailed p-value: 0.0903

Change the numbers in the calculator to see the full working, every step, for your own case.

Common questions

When do I use t instead of z?

Use t when the population standard deviation is not known and is estimated from the sample, which is nearly always.

What does a 95 percent confidence interval mean?

If you repeated the sampling many times, about 95 percent of the intervals would contain the true mean.

What is a p-value?

The chance of a result at least as far from the claim as yours if the claim were true. A small p-value is evidence against the claim.

How big a sample do I need?

A bigger sample gives a smaller margin of error: it shrinks with the square root of the sample size.

Related calculators

Got a question about this? Ask an engineering question and get a plain-language answer with references.

Further reading: Any first-year statistics text (inference for a mean, Student's t distribution).

Need a calculator we do not have?

Tell us what you would like to calculate. We read every request and build the most asked-for ones.

We store your request (and your email if you give it) to decide what to build. We do not store the numbers you type into calculators.

Embed this calculator on your own page

Copy this code into your page. The calculator runs inside the frame and links back to Drafting Central.

Need this drawn, designed or checked?

Drafting Central is a mechanical engineering and drafting business working with customers across Australia and around the world. A calculator gives you the numbers; we can turn them into drawings and designs.

Need help with a real project?

Talk to Drafting Central →

← All engineering calculators