  Knot contact homology is an ambient isotopy invariant of knots and links in
$\mathbb R^3$. The purpose of this paper is to extend this definition to an
ambient isotopy invariant of tangles and prove that gluing of tangles gives a
gluing formula for knot contact homology. As a consequence of the gluing
formula we obtain that the tangle contact homology detects triviality of
tangles.
