We investigate the Benjamin–Feir (or modulational) instability of Stokes waves, i.e. small-amplitude, one-dimensional periodic gravity waves of permanent form and constant velocity, in water of finite and infinite depth. We develop a perturbation method to describe to high-order accuracy the unstable spectral elements associated with this instability, obtained by linearizing Euler's equations about the small-amplitude Stokes waves. These unstable elements form a figure-eight curve centred at the origin of the complex spectral plane, which is parametrized by a Floquet exponent. Our asymptotic expansions of this figure-eight are in excellent agreement with numerical computations as well as recent rigorous results by Berti et al. (Full description of Benjamin–Feir instability of Stokes waves in deep water, 2021, arXiv:2109.11852) and Berti et al. (Benjamin–Feir instability of Stokes waves in finite depth, 2022, arXiv:2204.00809). From our expansions, we derive high-order estimates for the growth rates of the Benjamin–Feir instability and for the parametrization of the Benjamin–Feir figure-eight curve with respect to the Floquet exponent. We are also able to compare the Benjamin–Feir and high-frequency instability spectra analytically for the first time, revealing three different regimes of the Stokes waves, depending on the predominant instability.