{"success":true,"version":"v1","request":{"tool":"get_calculator_schema","calculator_id":"margin-of-error"},"result":{"entity_type":"calculator","id":"margin-of-error","calculator_id":"margin-of-error","canonical_url":"https://tttkmbb.com/statistics/margin-of-error","name":"Margin of Error Calculator","title":"Margin of Error Calculator – Confidence Interval for a Survey Proportion","category":"statistics","category_name":"Statistics & Probability","tool_name":"calculate_margin_of_error","featured_mcp_tool":false,"description":"Computes the margin of error (half-width of the confidence interval) of a sample proportion from the sample size, confidence level and observed percentage, with an optional finite population correction.","use_when":"You have poll or survey results (n respondents, x % answering a certain way) and need the ± margin at a confidence level.","do_not_use_when":"You are still planning the survey and need the required sample size (use sample-size), or the statistic is a mean rather than a percentage (use confidence-interval).","inputs":[{"name":"sample_size","label":"Sample size (n)","type":"integer","required":true,"min":1,"description":"Number of respondents or observations.","example":1000},{"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},{"name":"proportion_percent","label":"Observed proportion","type":"number","unit":"%","required":false,"default":50,"min":0,"max":100,"description":"Percentage of the sample with the attribute. 50 % gives the largest (most conservative) margin.","example":50},{"name":"population_size","label":"Population size","type":"integer","required":false,"min":2,"description":"Optional total population size N. When given, the finite population correction is applied; omit for large or unknown populations.","example":1000}],"outputs":[{"name":"z_value","label":"Critical z","type":"number","decimals":4,"description":"Two-sided normal critical value for the confidence level."},{"name":"standard_error_percent","label":"Standard error","type":"number","unit":"%","decimals":4,"description":"100 × √(p (1 − p) / n), after the finite population correction if applied."},{"name":"margin_of_error_percent","label":"Margin of error","type":"number","unit":"%","decimals":2,"description":"z_value × standard error, in percentage points."},{"name":"lower_bound_percent","label":"Lower bound","type":"number","unit":"%","decimals":2,"description":"proportion − margin (not truncated at 0)."},{"name":"upper_bound_percent","label":"Upper bound","type":"number","unit":"%","decimals":2,"description":"proportion + margin (not truncated at 100)."}],"input_schema":{"type":"object","properties":{"sample_size":{"description":"Number of respondents or observations.","type":"integer","minimum":1,"examples":[1000]},"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":"%"},"proportion_percent":{"description":"Percentage of the sample with the attribute. 50 % gives the largest (most conservative) margin. Unit: %.","type":"number","minimum":0,"maximum":100,"default":50,"examples":[50],"x-unit":"%"},"population_size":{"description":"Optional total population size N. When given, the finite population correction is applied; omit for large or unknown populations.","type":"integer","minimum":2,"examples":[1000]}},"additionalProperties":false,"required":["sample_size"]},"output_schema":{"type":"object","properties":{"z_value":{"description":"Two-sided normal critical value for the confidence level.","type":"number"},"standard_error_percent":{"description":"100 × √(p (1 − p) / n), after the finite population correction if applied. Unit: %.","type":"number","x-unit":"%"},"margin_of_error_percent":{"description":"z_value × standard error, in percentage points. Unit: %.","type":"number","x-unit":"%"},"lower_bound_percent":{"description":"proportion − margin (not truncated at 0). Unit: %.","type":"number","x-unit":"%"},"upper_bound_percent":{"description":"proportion + margin (not truncated at 100). Unit: %.","type":"number","x-unit":"%"}}},"formula":"margin = z · √(p (1 − p) / sample_size) × 100, with p = proportion_percent/100; with population_size N the margin is multiplied by √((N − sample_size) / (N − 1))","method":"Normal (Wald) approximation to the binomial, standard in survey reporting; it is inaccurate when n·p or n·(1 − p) is below about 10 (very small samples or extreme percentages), where a Wilson interval should be used.","sources":[{"name":"NIST/SEMATECH e-Handbook of Statistical Methods, 7.2.4.1 Confidence intervals for a proportion","url":"https://www.itl.nist.gov/div898/handbook/prc/section2/prc241.htm","type":"government","retrieved_at":"2026-09-23"},{"name":"Wikipedia – Margin of error","url":"https://en.wikipedia.org/wiki/Margin_of_error","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":"n = 1,000, 95 %, 50 %","inputs":{"sample_size":1000,"confidence_level_percent":95,"proportion_percent":50},"expected":{"z_value":1.96,"standard_error_percent":1.5811,"margin_of_error_percent":3.1,"lower_bound_percent":46.9,"upper_bound_percent":53.1},"url":"https://tttkmbb.com/api/v1/calculate/margin-of-error?sample_size=1000&confidence_level_percent=95&proportion_percent=50"},{"name":"n = 400, 99 %, 30 %","inputs":{"sample_size":400,"confidence_level_percent":99,"proportion_percent":30},"expected":{"z_value":2.5758,"standard_error_percent":2.2913,"margin_of_error_percent":5.9,"lower_bound_percent":24.1,"upper_bound_percent":35.9},"url":"https://tttkmbb.com/api/v1/calculate/margin-of-error?sample_size=400&confidence_level_percent=99&proportion_percent=30"}],"faq":[{"q":"Why do polls report ±3 %?","a":"A sample of about 1,000 at 95 % confidence and p = 50 % gives 1.96 × √(0.25 / 1000) = 3.1 percentage points; the same sample gives a smaller margin for percentages far from 50 %."},{"q":"Is the margin in percent or percentage points?","a":"Percentage points: a result of 40 % with a ±3 % margin means 37 % to 43 %."}],"tags":["margin of error","poll margin of error","survey error","confidence interval proportion","sampling error"],"related":[{"calculator_id":"sample-size","reason":"Plan the sample size for a target margin."},{"calculator_id":"confidence-interval","reason":"Interval for a sample mean instead of a proportion."}],"links":{"html":"https://tttkmbb.com/statistics/margin-of-error","markdown":"https://tttkmbb.com/statistics/margin-of-error.md","json":"https://tttkmbb.com/statistics/margin-of-error.json","api":"https://tttkmbb.com/api/v1/calculate/margin-of-error","schema":"https://tttkmbb.com/api/v1/calculators/margin-of-error","openapi":"https://tttkmbb.com/openapi.json","mcp":"https://tttkmbb.com/mcp"},"version":"v1","updated_at":"2026-09-23"},"timestamp":"2026-09-23T23:31:58Z","next_actions":[{"tool":"run_calculator","calculator_id":"margin-of-error","reason":"Run Margin of Error Calculator with the inputs above."}],"links":{"markdown":"https://tttkmbb.com/statistics/margin-of-error.md"}}