A confidence interval
is a range plus a confidence level. For the population mean there is a clean recipe. Centre it on
the sample mean, then reach out by a multiple of the
standard error:
\bar{x} \pm z\cdot \mathrm{SE}, \qquad \mathrm{SE} = \frac{\sigma}{\sqrt{n}}.
The half-width z\cdot\mathrm{SE} is the margin of error.
The multiplier z comes from the standard normal — courtesy of the
central limit theorem,
which makes \bar{x} approximately normal — read off as a
z-score.
For 95\% confidence, z \approx 1.96; for
99\%, z \approx 2.58.