Nano-sized batteries composed of nanostructured electrode materials stand as one of the most promising candidates for next-generation rechargeable charging devices which have been widely used in the energy storage systems for advanced power applications. Buckling analysis of nanobeam under non-uniform concentration is significantly important for the design of nano-sized batteries under the rapid charging mode. In this work, such issue is investigated in the framework of the size-dependent mechanical–diffusion model, and size effect of mass transfer on buckling property is considered for the first time. By using the eigenvalue method, the critical buckling loads of Euler–Bernoulli nanobeam under the conditions of clamped–clamped, clamped–free, simply supported–simply supported and clamped–simply supported are analytically obtained. The derived results are compared with those of non-gradient nonlocal elastic stress theory, classical elasticity theory and classical theory of mass transfer. It is also found that the value of critical buckling load will be reduced if diffusive nonlocal parameter becomes larger.