# Confidence interval calculator > How precise is your sample's estimate? The confidence interval for a mean or a proportion from a sample, with the margin of error and the method used. Find the confidence interval for a mean (t or z) or a proportion (Wilson or Wald) from your sample, with the margin of error and standard error. - Page: https://how.box/confidence-interval/ - Runs entirely in the browser. - License: HowToolbox's own text and data (titles, explanations, FAQs, tool descriptions and schemas, this file) are CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/); AI training and answers are welcome. Attribute "HowToolbox (how.box)" with a link to the page used. Third-party data keeps its own terms; the name and logo are not licensed. Publisher: HowToolbox, contact@how.box. Terms: https://how.box/about/terms/ ## Inputs Answer link: https://how.box/confidence-interval/?k={k}&c={c}&n={n}&mu={mu}&sd={sd}&d={d}&x={x}&w={w} - `k` (mean or proportion): mean or proportion. Example: `mean`. - `c` (number 50 to 99.99): Confidence level in percent. Example: `95`. - `n` (whole number 1 to 1e9): Sample size. Example: `30`. - `mu` (number -1e12 to 1e12): Sample mean (k=mean). Example: `50`. - `sd` (number 0 to 1e12): Standard deviation (k=mean). Example: `10`. - `d` (t or z): t (sample SD) or z (known σ), k=mean. Example: `t`. - `x` (whole number 0 to 1e9): Successes (k=proportion). Example: `12`. - `w` (wilson or wald): wilson or wald (k=proportion). Example: `wilson`. Example answer: https://how.box/confidence-interval/?k=mean&c=95&n=30&mu=50&sd=10&d=t&x=12&w=wilson A complete link carries the primary answer in the page HTML; a missing or invalid value shows the default page. ## Agent tools - `confidence_interval_calculate`: Two-sided confidence interval at confidence_percent. - MCP, one POST to https://how.box/mcp: `{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"confidence_interval_calculate","arguments":{"kind":"mean","confidence_percent":95,"n":30,"mean":50,"sd":10,"distribution":"t","successes":12,"method":"wilson"}}}` - GET: https://how.box/mcp/run/confidence_interval_calculate?kind=mean&confidence_percent=95&n=30&mean=50&sd=10&distribution=t&successes=12&method=wilson ## How it works A sample gives an estimate, and a confidence interval says how far off that estimate could plausibly be. A 95 % interval comes from a method that catches the true value in 95 % of samples; it does not mean the true value is in this particular range with 95 % probability, but it is a good guide to the precision. For a mean the interval is x̄ ± t × s ÷ √n, where x̄ is the sample mean, s the standard deviation, n the sample size and t the critical value of Student's t distribution with n − 1 degrees of freedom (use z when the population's σ is known). For a mean of 50 with s = 10 from 30 people, t = 2.045 and the 95 % interval is 50 ± 3.73, so 46.27 to 53.73. For a proportion the Wilson score interval is the default because it stays sensible with small samples and shares near 0 % or 100 %; the plain Wald interval p̂ ± z × √(p̂(1 − p̂) ÷ n) is offered for comparison. Sources: the NIST/SEMATECH e-Handbook and Newcombe (1998). The interval covers only random sampling error. It cannot correct a biased sample, and the t interval assumes the data are roughly normal or the sample is large. ## FAQ **What does a 95 % confidence interval mean?** If you repeated the survey or experiment many times, about 95 % of the intervals calculated this way would contain the true value. **When should I use t instead of z?** Use t when the standard deviation was measured from the same sample, which is almost always. Use z only when the population's standard deviation is known beforehand. **Why is the proportion interval not centred on my sample share?** The Wilson interval is pulled slightly towards 50 %, which makes it more accurate for small samples and for shares near 0 % or 100 %. **How do I make the interval narrower?** Collect a larger sample: the width shrinks with the square root of the sample size, so four times as many observations halve it. A lower confidence level also narrows it. **Does the interval contain 95% of individual observations?** No. A confidence interval for a mean estimates the population mean. It is not a range for individual observations or a prediction interval. More: [HowToolbox index](https://how.box/llms.txt) · [Agent Skill](https://how.box/skill.md) · [agent terms](https://how.box/about/agents/)