Domains and domain walls are among the key factors that determine the performance of ferroelectric materials. In recent years, a unique type of domain walls, i.e., the sawtooth-shaped domain walls, has been observed in BiFeO$_{3}$ and PbTiO$_{3}$. Here, we build a minimal model to reveal the origin of these sawtooth-shaped domain walls. Incorporating this model into Monte-Carlo simulations shows that (i) the competition between the long-range Coulomb interaction (due to bound charges) and short-range interaction (due to opposite dipoles) is responsible for the formation of these peculiar domain walls and (ii) their relative strength is critical in determining the periodicity of these sawtooth-shaped domain walls. Necessary conditions to form such domain walls are also discussed.