© 2020, Saudi Society for Geosciences.In this work, the buckling analysis of the nanobeams placed in electromagnetic field is presented via a nonlocal finite element method based on Eringen’s nonlocal elasticity theory. The governing differential equation is derived by implementing minimum total potential energy principle. A finite element method is proposed for solution of nonlocal buckling of nanobeam placed in electromagnetic field. The contribution of this article is the use of interpolation functions and the nonlocal elasticity theory to form the stiffness matrices and geometric stiffness matrices of the electromagnetic nanobeam for buckling analysis. A detailed study is performed to indicate the influences of some parameters such as Hartmann parameter (Ha), mode number (n), nonlocal parameter (e0a), length of nanobeam (L), and boundary conditions on the buckling loads of Euler-Bernoulli nanobeams. The values of buckling load of electromagnetic nanobeams are obtained via a finite element solution, examined through several numerical examples, and demonstrated by tables and graphs.