The present research investigates lateral stability of a functionally graded nanobeam using Eringen's differential nonlocal elasticity model under rigid (clamped, pinned, free) and deformable (lateral, rotational restraints) boundary conditions. Sigmoid and power law have been employed as grading laws to study the influence of the material distribution on the snap‐buckling analysis of a nanobeam with arbitrary boundary conditions. Moreover, Fourier sine series with Stokes’ transformation are employed to investigate the effects of boundary conditions on the stability response of nanobeams embedded in a Pasternak foundation. A parametric study has been performed to investigate the effect of deformable boundaries, Pasternak foundation and small‐scale parameters on the stability response of the nanobeam and the results have been presented in a series of tables and figures. It has been observed that consideration of the small‐scale parameter, Pasternak foundation, deformable boundaries and functionally grading index (of sigmoid and power‐law) are essential while analyzing the static stability response. The obtained analytical results may be used as benchmarks in future researches of functionally graded nanobeams embedded in an elastic medium.