{"success":true,"version":"v1","request":{"tool":"get_calculator_schema","calculator_id":"confidence-interval"},"result":{"entity_type":"calculator","id":"confidence-interval","calculator_id":"confidence-interval","canonical_url":"https://tttkmbb.com/statistics/confidence-interval","name":"Confidence Interval Calculator","title":"Confidence Interval Calculator for a Mean – z-Based Interval from Mean, SD and Sample Size","category":"statistics","category_name":"Statistics & Probability","tool_name":"calculate_confidence_interval","featured_mcp_tool":false,"description":"Computes a confidence interval for a population mean from the sample mean, standard deviation and sample size using the normal (z) critical value: mean ± z · s / √n.","use_when":"You have a sample mean, its standard deviation and the sample size and want the interval that likely contains the population mean at a given confidence level.","do_not_use_when":"The statistic is a proportion or survey percentage (use margin-of-error), or the sample is small (n < 30) with an unknown population SD, where a t-based interval is the correct choice and this z interval is slightly too narrow.","inputs":[{"name":"sample_mean","label":"Sample mean (x̄)","type":"number","required":true,"description":"Mean of the sample.","example":100},{"name":"std_dev","label":"Standard deviation","type":"number","required":true,"exclusive_min":0,"description":"Population standard deviation σ if known, otherwise the sample standard deviation s.","example":15},{"name":"sample_size","label":"Sample size (n)","type":"integer","required":true,"min":2,"description":"Number of observations in the sample.","example":36},{"name":"confidence_level_percent","label":"Confidence level","type":"number","unit":"%","required":false,"default":95,"exclusive_min":0,"exclusive_max":100,"description":"Confidence level in percent (commonly 90, 95 or 99). Determines the critical z value.","example":95}],"outputs":[{"name":"z_value","label":"Critical z","type":"number","decimals":4,"description":"Two-sided standard normal critical value for the confidence level (1.6449 for 90 %, 1.96 for 95 %, 2.5758 for 99 %)."},{"name":"standard_error","label":"Standard error","type":"number","decimals":4,"description":"std_dev / √sample_size."},{"name":"margin_of_error","label":"Margin of error","type":"number","decimals":4,"description":"z_value × standard_error (half-width of the interval)."},{"name":"lower_bound","label":"Lower bound","type":"number","decimals":4,"description":"sample_mean − margin_of_error."},{"name":"upper_bound","label":"Upper bound","type":"number","decimals":4,"description":"sample_mean + margin_of_error."}],"input_schema":{"type":"object","properties":{"sample_mean":{"description":"Mean of the sample.","type":"number","examples":[100]},"std_dev":{"description":"Population standard deviation σ if known, otherwise the sample standard deviation s.","type":"number","exclusiveMinimum":0,"examples":[15]},"sample_size":{"description":"Number of observations in the sample.","type":"integer","minimum":2,"examples":[36]},"confidence_level_percent":{"description":"Confidence level in percent (commonly 90, 95 or 99). Determines the critical z value. Unit: %.","type":"number","exclusiveMinimum":0,"exclusiveMaximum":100,"default":95,"examples":[95],"x-unit":"%"}},"additionalProperties":false,"required":["sample_mean","std_dev","sample_size"]},"output_schema":{"type":"object","properties":{"z_value":{"description":"Two-sided standard normal critical value for the confidence level (1.6449 for 90 %, 1.96 for 95 %, 2.5758 for 99 %).","type":"number"},"standard_error":{"description":"std_dev / √sample_size.","type":"number"},"margin_of_error":{"description":"z_value × standard_error (half-width of the interval).","type":"number"},"lower_bound":{"description":"sample_mean − margin_of_error.","type":"number"},"upper_bound":{"description":"sample_mean + margin_of_error.","type":"number"}}},"formula":"z = Φ⁻¹(1 − (1 − confidence_level_percent/100) / 2); standard_error = std_dev / √sample_size; margin_of_error = z × standard_error; interval = sample_mean ± margin_of_error","method":"Uses the normal critical value, which is exact when the population σ is known and a good approximation when s is estimated from n ≥ 30 observations. For smaller samples with an estimated s, the Student t critical value with n − 1 degrees of freedom should replace z (e.g. 2.045 instead of 1.96 for n = 30 at 95 %).","sources":[{"name":"NIST/SEMATECH e-Handbook of Statistical Methods, 1.3.5.2 Confidence Limits for the Mean","url":"https://www.itl.nist.gov/div898/handbook/eda/section3/eda352.htm","type":"government","retrieved_at":"2026-09-23"},{"name":"Wikipedia – Confidence interval","url":"https://en.wikipedia.org/wiki/Confidence_interval","type":"reference","retrieved_at":"2026-09-23"}],"freshness":{"type":"static","max_age_seconds":null,"note":"Deterministic formula with fixed constants; results never go stale. Inputs supplied by the caller determine the output."},"examples":[{"name":"Mean 100, SD 15, n = 36, 95 %","inputs":{"sample_mean":100,"std_dev":15,"sample_size":36,"confidence_level_percent":95},"expected":{"z_value":1.96,"standard_error":2.5,"margin_of_error":4.9,"lower_bound":95.1,"upper_bound":104.9},"url":"https://tttkmbb.com/api/v1/calculate/confidence-interval?sample_mean=100&std_dev=15&sample_size=36&confidence_level_percent=95"},{"name":"Mean 50, SD 8, n = 100, 99 %","inputs":{"sample_mean":50,"std_dev":8,"sample_size":100,"confidence_level_percent":99},"expected":{"z_value":2.5758,"standard_error":0.8,"margin_of_error":2.0607,"lower_bound":47.9393,"upper_bound":52.0607},"url":"https://tttkmbb.com/api/v1/calculate/confidence-interval?sample_mean=50&std_dev=8&sample_size=100&confidence_level_percent=99"}],"faq":[{"q":"What does a 95 % confidence interval mean?","a":"If the sampling were repeated many times and an interval computed each time, about 95 % of those intervals would contain the true population mean. It does not mean there is a 95 % probability that this particular interval contains it."},{"q":"When should I use t instead of z?","a":"When the population standard deviation is unknown and estimated from the sample, the t distribution with n − 1 degrees of freedom is the exact choice; for n ≥ 30 the difference from z is small (about 4 % wider at n = 30, under 1 % at n = 200)."}],"tags":["confidence interval","confidence interval for the mean","margin of error","95% confidence","standard error"],"related":[{"calculator_id":"margin-of-error","reason":"Confidence interval for a proportion or survey percentage."},{"calculator_id":"sample-size","reason":"How many observations are needed for a target margin of error."},{"calculator_id":"descriptive-statistics","reason":"Get the sample mean and standard deviation from raw data."}],"links":{"html":"https://tttkmbb.com/statistics/confidence-interval","markdown":"https://tttkmbb.com/statistics/confidence-interval.md","json":"https://tttkmbb.com/statistics/confidence-interval.json","api":"https://tttkmbb.com/api/v1/calculate/confidence-interval","schema":"https://tttkmbb.com/api/v1/calculators/confidence-interval","openapi":"https://tttkmbb.com/openapi.json","mcp":"https://tttkmbb.com/mcp"},"version":"v1","updated_at":"2026-09-23"},"timestamp":"2026-09-23T23:23:51Z"}