This paper presents an analytical formulation of nonlocal elasticity theory for the buckling analysis of simply supported carbon nanotubes with rotational springs at both ends. The lateral displacement function is represented by a Fourier sine series expansion. Stoke's transformation is applied to construct the coefficient matrix of the corresponding systems of linear equations. This matrix gives more flexibility in boundary conditions. The accuracy of proposed method is validated for three well-known boundary conditions available in the literature. A very good agreement has been obtained. The present method permits to have more efficient stability matrix for calculating the buckling loads of carbon nanotubes with any desired boundary conditions.