The exfoliation energy, the energy required to peel off an atomic layer from the surface of a bulk material, is of fundamental importance in the science and engineering of two-dimensional materials. Traditionally, the exfoliation energy of a material has been obtained from first principles by calculating the difference in the ground-state energy between (i) a slab of $N$ atomic layers ($N gg 1$) and (ii) a slab of $N-1$ atomic layers plus an atomic layer separated from the slab. In this paper, we prove that the exfoliation energy can be obtained exactly as the difference in the ground-state energy between a bulk material (per atomic layer) and a single isolated layer. The proposed method is (i) tremendously lower in computational cost than the traditional approach since it does not require calculations on thick slabs, (ii) still valid even if there is a surface reconstruction of any kind, (iii) capable of taking into account the relaxation of the single exfoliated layer (both in-plane lattice parameters and atomic positions), and (iv) easily combined with all kinds of many-body computational methods. As a proof of principles, we calculated exfoliation energies of graphene, hexagonal boron nitride, MoS$_2$ and phosphorene using density-functional theory. In addition, we found that the in-plane relaxation of an exfoliated layer accounts for 5% of one-layer exfoliation energy of phosphorene while it is negligible (< 0.4%) in the other cases.