Recent studies suggest that electrides—ionic crystals in which electrons serve as anions—are not exceptional materials but rather a generalized form, particularly under high pressure1, 2, 3. The topology of the cavities confining anionic electrons determines their physical properties4. At present, reported confining sites consist only of zero-dimensional cavities or weakly linked channels4. Here we report a layered-structure electride of dicalcium nitride, Ca2N, which possesses two-dimensionally confined anionic electrons whose concentration agrees well with that for the chemical formula of [Ca2N]+·e−. Two-dimensional transport characteristics are demonstrated by a high electron mobility (520 cm2 V−1 s−1) and long mean scattering time (0.6 picoseconds) with a mean free path of 0.12 micrometres. The quadratic temperature dependence of the resistivity up to 120 Kelvin indicates the presence of an electron–electron interaction. A striking anisotropic magnetoresistance behaviour with respect to the direction of magnetic field (negative for the field perpendicular to the conducting plane and positive for the field parallel to it) is observed, confirming diffusive two-dimensional transport in dense electron layers. Additionally, band calculations support confinement of anionic electrons within the interlayer space, and photoemission measurements confirm anisotropic low work functions of 3.5 and 2.6 electronvolts, revealing the loosely bound nature of the anionic electrons. We conclude that Ca2N is a two-dimensional electride in terms of [Ca2N]+·e−.