We show a mathematical relation between the mod-two Atiyah–Patodi–Singer (APS) index of a massless Dirac operator and massive domain-wall fermion determinant. The domain-wall fermion is given on a closed manifold, which is extended from the original manifold with boundary, where we instead give a fermion mass term changing its sign at the location of the original boundary. This new setup does not need the APS boundary condition, which is non-local. A mathematical proof of equivalence between the two different formulations is given by two different evaluations of the same index of a Dirac operator on a higher-dimensional manifold. The domain-wall fermion allows us to separate the edge and bulk mode contributions in a natural but not in a gauge invariant way, which offers a straightforward description of the global anomaly inflow.