© 2021 Informa UK Limited, trading as Taylor & Francis Group.Size-dependent stability analysis of nanobeams under axial loading is investigated by strain gradient elasticity. An effective general model is proposed for different deformable boundary conditions by combining Fourier sine series and Stokes’ transformation. The theoretical model presented here bridges the gap between clamped and pinned-pinned supporting conditions, which is of great significance for the application of the strain gradient small scale effects to nanobeam. Analytical solutions are obtained and comparisons with results obtained by the researchers for rigid boundary conditions are carried out. The outcomes can be useful for the optimization and design of nano-sized beams and provide new benchmarks for nanomechanical analyses.