Explore Jobs

Find Specific Jobs

Explore Careers

Explore Professions

Best Companies

Explore Companies

How To Calculate Confidence Interval (With Examples)

By Chris Kolmar
May. 25, 2021
Last Modified and Fact Checked on: Feb. 12, 2026

Find a Job You Really Want In

How to Calculate Confidence Interval (With Examples)

Imagine you’re searching for an apartment in a new city and come across a local survey that randomly sampled a hundred apartment listings. This survey found, with 95% confidence, that the price range for one-bedroom apartments in the area is between $845 and $1155.

In this scenario, the confidence level is represented as a percentage, specifically 95%. This indicates that if you were to repeat this survey and randomly sample apartment listings under the same conditions, your findings should fall within this range 95% of the time.

It’s important to clarify that the confidence interval is distinct from the confidence level. Here, the confidence interval is defined by the values $845 and $1155.

What Is a Confidence Interval?

In statistics, confidence intervals are closely associated with confidence levels and margins of error. Essentially, the confidence interval reflects the degree of certainty you can have that the results from a poll or survey would fall within the same range if the entire population were surveyed.

Pretty interesting, right? While statistical data is crucial, it can be misleading depending on how it’s presented, particularly when comparing costs over time, especially considering inflation.

Confidence levels and intervals are essential because it’s impossible to be 100% certain that results from a sample will be representative of the entire population. There will always be variations and margins of error.

However, through statistical analysis, we can make reasonably accurate estimations about where the majority of the population would fall if we were to extend the experiment to include everyone. That determined range, where we feel statistically confident, is our confidence interval.

How to Calculate the Confidence Interval Using T-Distribution

Let’s say you’re still on the hunt for apartments and want to create your own 95% confidence interval. You randomly sample twenty apartment listings and find that the average monthly rent is $1,000, with a standard deviation of $250. Here’s a step-by-step method to calculate the confidence intervals with 95% certainty.

Since this sample size is less than thirty, we will use the T-distribution method.

  1. First, calculate the degrees of freedom by subtracting one from your sample size. Here, with a sample size of 20, the degrees of freedom will be 19.

  2. Next, calculate the total alpha value. This value represents the small section of the graph above and below our 95% confidence range. Convert the confidence level to a decimal and subtract from one. For example, 95% becomes 0.95, leaving us with an alpha of 0.05.

  3. Divide the alpha value by two to separate the uncertainty on the lower end from that on the upper end. In this case, 0.05 divided by two equals 0.025.

  4. Using the T-distribution table, find the value for 19 degrees of freedom and an alpha value of 0.025. In this instance, that T-value is 2.093.

  5. Now, calculate the standard error. Divide the standard deviation by the square root of the sample size: $250 divided by the square root of 20 gives approximately 55.90.

  6. Multiply the standard error by the T-value from Step four (55.90 x 2.093 = 117.00).

  7. Take the mean ($1,000) and subtract the result from Step six to find the lower confidence interval. Since we’re dealing with monetary values, we’ll round to two decimal points.

  8. Now add the value from Step six to the mean to find the upper confidence interval.

  9. In this example, the confidence interval is $883.00 to $1,117.00.

How to Calculate the Confidence Interval Using T-Distribution With Raw Data

The formula we’ll use is x̄ ± t* σ / (√n). Here, x̄ represents the mean, t the t-score, σ the sample standard deviation, and n the sample size.

For this example, we’ll calculate a 98% confidence interval for the following data: 40, 42, 49, 57, 61, 47, 66, 78, 90, 86, 81, 80.

  1. To find the mean (x̄), sum all the numbers and divide by 12, the total count in this sample. The mean is 64.75.

  2. Next, calculate the standard deviation (σ). Add all the numbers, then square them (777 x 777 = 603,729). Divide this by the total number (n = 12) to get 50,310.75.

  3. Hold onto that result from Step two, as you’ll need it shortly. Now, take the original set of numbers, square each, and sum them. (40 x 40) + (42 x 42) + (49 x 49) + (57 x 57) + (61 x 61) + (47 x 47) + (66 x 66) + (78 x 78) + (90 x 90) + (86 x 86) + (81 x 81) + (80 x 80) = 53,841.

  4. Subtract the results from Steps two and three (53,841 – 50,310.75 = 3,530.25).

  5. Subtract 1 from n (12 – 1 = 11). Divide your answer from Step four by this integer to find the variance (3,530.25 / 11 = 320.93).

  6. Take the square root of the variance to find the final standard deviation (√320.93 = 17.91).

  7. Now, we have our x̄, n, and s values. To find the t-score, start by calculating the degrees of freedom by subtracting 1 from n (12 – 1 = 11).

  8. Convert the confidence level to a decimal and divide by 2: (1 – 0.98 = 0.02 / 2 = 0.01). In the t-distribution chart, look up the value for 0.01 and 11 degrees of freedom (2.718).

  9. Now we can plug our values into the formula: 64.75 ± 2.718 * 17.91 / (√12).

  10. Our 98% confidence interval for this raw data is approximately 50.69 to 78.81.

How to Calculate the Confidence Interval Using Z-Distribution

This method, also known as the normal distribution method, is applicable when you know the standard deviation but not the population mean. The formula is x̄ ± z (σ / (√n)). Here, x̄ is the mean, z is the z-score, σ is the sample standard deviation, and n is the sample size.

For this example, we aim to construct a 95% confidence interval. Five samples from an experiment yielded a mean temperature of 102.3°F in July with a population standard deviation of 1.3.

  1. Calculate the alpha value by subtracting the confidence level in decimal form from 1, then dividing by 2 (1 – 0.95 = 0.05 / 2 = 0.025).

  2. Subtract this number from 1 (1 – 0.025 = 0.975).

  3. Find 0.975 on the z-table to determine the z-value. In this example, the z-score is 1.96.

  4. Multiply the z-score by the standard deviation divided by the square root of the sample size. In this case, divide 1.3 by the square root of 5 and multiply by the z-score (1.3 / √5 x 1.96 ≈ 1.138).

  5. Subtract your result from the mean to find the lower confidence interval (102.3 – 1.138 = 101.16).

  6. Add your result from Step four to the mean to find the upper confidence interval (102.3 + 1.138 = 103.44).

  7. Round to one decimal point for consistency. Our 95% confidence interval for July is 101.2°F – 103.4°F.

How to Calculate the Confidence Interval for a Proportion

Consider a scenario where 530 people applied for a job at a large company, and out of those applicants, 113 were women. We’ll find the 95% confidence interval for the true proportion of women who applied for this position.

The formula we’ll use is: p̂ ± z (√(p̂ (1 – p̂)) / n).

  1. First, calculate p̂ by dividing the number of events by the number of trials: 113 divided by 530 gives us approximately 0.21.

  2. To find the z-score, convert 95% to 0.95 and divide by 2, which gives us 0.475. Referring to the z-table, this corresponds to a z-score of 1.96.

  3. Now our formula looks like: 0.21 ± 1.96 (√(0.21 (1 – 0.21)) / 530).

  4. Calculating this gives us 0.21 ± 0.0347.

  5. This results in a confidence interval of 0.1753 to 0.24467, which rounds to approximately 18% to 24% of women applying for the job.

How to Calculate the Confidence Interval for a Proportion with Two Populations

If you appreciate formulas, this section will be engaging. If formulas intimidate you, don’t worry—it’s simpler than it appears. We’ll use the following formula:

(p̂1 – p̂2) – zα/2 (√(p̂1q̂1 / n1) + (p̂2q̂2 / n2)) < p̂1 – p̂2 < (p̂1 – p̂2) + zα/2 (√(p̂1q̂1 / n1) + (p̂2q̂2 / n2))

To illustrate, a study found that 65% of men support a new workplace policy, while only 33% of women do. We’ll calculate the 90% confidence interval for the true difference in proportions, based on responses from 100 men and 75 women.

  1. First, identify the variables:

    p̂1 = Population 1 (men) positive response = 65% or 0.65
    q̂1 = Population 1 (men) negative response = 35% or 0.35
    n1 = Population 1 (men) total surveyed = 100
    p̂2 = Population 2 (women) positive response = 33% or 0.33
    q̂2 = Population 2 (women) negative response = 67% or 0.67
    n2 = Population 2 (women) total surveyed = 75

  2. Next, find zα/2. Subtract the confidence level from 1 and divide by 2 (1 – 0.90 / 2 = 0.0500). The closest z-value on the z-table is 1.645. Now we have all the variables needed to plug into the formula.

  3. Multiply p̂1 x q̂1 (0.65 x 0.35 = 0.2275), then divide by n1 (0.2275 / 100 = 0.002275). We’ll need this later.

  4. Multiply p̂2 x q̂2 (0.33 x 0.67 = 0.2211), then divide by n2 (0.2211 / 75 = 0.002948).

  5. Add the results from Steps three and four (0.002275 + 0.002948 = 0.005223).

  6. Take the square root of your answer from Step five (√0.005223 = 0.072270).

  7. Multiply your answer from Step six by the zα/2 value found in Step two (0.072270 x 1.645 = 0.1193). We’ll need this later.

  8. Subtract p̂2 from p̂1 (0.65 – 0.33 = 0.32).

  9. For the lower limit, subtract your answer in Step eight from Step seven (0.32 – 0.1193 = 0.2007, which rounds to 20.1%).

  10. For the upper limit, add your answer in Step eight with your answer in Step seven (0.32 + 0.1193 = 0.4393, which rounds to 43.9%).

  11. Take a deep breath; you’ve successfully calculated the confidence interval!

Never miss an opportunity that’s right for you.

Author

Chris Kolmar

Chris Kolmar is a co-founder of Zippia and the editor-in-chief of the Zippia career advice blog. He has hired over 50 people in his career, been hired five times, and wants to help you land your next job. His research has been featured on the New York Times, Thrillist, VOX, The Atlantic, and a host of local news. More recently, he's been quoted on USA Today, BusinessInsider, and CNBC.

Related posts