completion
Let $(X,d)$ be a metric space. Let $\overline{X}$ be the set of all Cauchy sequences^{} ${\{{x}_{n}\}}_{n\in \mathbb{N}}$ in $X$. Define an equivalence relation^{} $\sim $ on $\overline{X}$ by setting $\{{x}_{n}\}\sim \{{y}_{n}\}$ if the interleave sequence of the sequences^{} $\{{x}_{n}\}$ and $\{{y}_{n}\}$ is also a Cauchy sequence. The completion of $X$ is defined to be the set $\widehat{X}$ of equivalence classes^{} of $\overline{X}$ modulo $\sim $.
The metric $d$ on $X$ extends to a metric on $\widehat{X}$ in the following manner:
$$d(\{{x}_{n}\},\{{y}_{n}\}):=\underset{n\to \mathrm{\infty}}{lim}d({x}_{n},{y}_{n}),$$ 
where $\{{x}_{n}\}$ and $\{{y}_{n}\}$ are representative Cauchy sequences of elements in $\widehat{X}$. The definition of $\sim $ is tailored so that the limit in the above definition is well defined, and the fact that these sequences are Cauchy, together with the fact that $\mathbb{R}$ is complete^{}, ensures that the limit exists. The space $\widehat{X}$ with this metric is of course a complete metric space.
The original metric space $X$ is isometric to the subset of $\widehat{X}$ consisting of equivalence classes of constant sequences.
Note the similarity between the construction of $\widehat{X}$ and the construction of $\mathbb{R}$ from $\mathbb{Q}$. The process used here is the same as that used to construct the real numbers $\mathbb{R}$, except for the minor detail that one can not use the terminology of metric spaces in the construction of $\mathbb{R}$ itself because it is necessary to construct $\mathbb{R}$ in the first place before one can define metric spaces.
1 Metric spaces with richer structure
If the metric space $X$ has an algebraic structure^{}, then in many cases this algebraic structure carries through unchanged to $\widehat{X}$ simply by applying it one element at a time to sequences in $X$. We will not attempt to state this principle precisely, but we will mention the following important instances:

1.
If $(X,\cdot )$ is a topological group, then $\widehat{X}$ is also a topological group with multiplication^{} defined by
$$\{{x}_{n}\}\cdot \{{y}_{n}\}=\{{x}_{n}\cdot {y}_{n}\}.$$ 
2.
If $X$ is a topological ring, then addition and multiplication extend to $\widehat{X}$ and make the completion into a topological ring.

3.
If $F$ is a field with a valuation^{} $v$, then the completion of $F$ with respect to the metric imposed by $v$ is a topological field, denoted ${F}_{v}$ and called the completion of $F$ at $v$.
2 Universal property of completions
The completion $\widehat{X}$ of $X$ satisfies the following universal property^{}: for every uniformly continuous map $f:X\u27f6Y$ of $X$ into a complete metric space $Y$, there exists a unique lifting of $f$ to a continuous map^{} $\widehat{f}:\widehat{X}\u27f6Y$ making the diagram