Gapped domain walls, as topological line defects between 2+1D topologically ordered states, are examined. We provide simple criteria to determine the existence of gapped domain walls, which apply to both Abelian and non-Abelian topological orders. Our criteria also determine which 2+1D topological orders must have gapless edge modes, namely which 1+1D global gravitational anomalies ensure gaplessness. Furthermore, we introduce a new mathematical object, the tunneling matrix $W$, whose entries are the fusion-space dimensions $W_{ia}$, to label different types of gapped domain walls. Mathematically, we propose a classification of bimodule categories between modular tensor categories. By studying many examples, we find evidence that the tunneling matrices are powerful quantities to classify different types of gapped domain walls. Since a gapped boundary is a gapped domain wall between a bulk topological order and the vacuum, regarded as the trivial topological order, our theory of gapped domain walls inclusively contains the theory of gapped boundaries. In addition, we derive a topological ground state degeneracy formula, applied to arbitrary orientable spatial 2-manifolds with gapped domain walls, including closed 2-manifolds and open 2-manifolds with gapped boundaries.