Vibration analysis of nonlocal nanobeams based on Euler–Bernoulli and Timoshenko beam theories is considered. Nonlocal nanobeams are important in the bending, buckling and vibration analyses of beam-like elements in microelectromechanical or nanoelectromechanical devices. Expressions for free vibration of Euler–Bernoulli and Timoshenko nanobeams are established within the framework of Eringen’s nonlocal elasticity theory. The problem has been solved previously using finite element method, Chebyshev polynomials in Rayleigh–Ritz method and using other numerical methods. In this study, numerical results for free vibration of nanobeams have been presented using simple polynomials and orthonormal polynomials in the Rayleigh–Ritz method. The advantage of the method is that one can easily handle the specified boundary conditions at the edges. To validate the present analysis, a comparison study is carried out with the results of the existing literature. The proposed method is also validated by convergence studies. Frequency parameters are found for different scaling effect parameters and boundary conditions. The study highlights that small scale effects considerably influence the free vibration of nanobeams. Nonlocal frequency parameters of nanobeams are smaller when compared to the corresponding local ones. Deflection shapes of nonlocal clamped Euler–Bernoulli nanobeams are also incorporated for different scaling effect parameters, which are affected by the small scale effect. Obtained numerical solutions provide a better representation of the vibration behavior of short and stubby micro/nanobeams where the effects of small scale, transverse shear deformation and rotary inertia are significant.Recently nanomaterials have encouraged the interest of the scientific researchers in physics, chemistry and engineering. These nanomaterials have special properties (mechanical, chemical, electrical, optical and electronic) resulting from their nanoscale dimensions. Because of the desirable properties (Dai et al. 1996; Bachtold et al. 2001), the nanomaterials are perceived to be the components for various nanoelectromechanical systems and nanocomposites. Some of the common examples of these nanomaterials are nanoparticles, nanowires and nanotubes (viz., carbon nanotubes, ZnO nanotubes), etc. Small scale effects and the atomic forces must be incorporated in the realistic design of the nanostructures [viz., nanoresonantors (peng et al. 2006), nanoactuators (Dubey et al. 2004), nanomachines (pennadam et al. 2004) and nano-optomechanical systems] to achieve solutions with acceptable accuracy. Both experimental and atomistic simulation results show that when the dimensions of the structures become small then the ‘size effect’ has significant role in the mechanical properties (Ruud et al. 1994). Ignoring the small scale effects in sensitive nanodesigning fields may cause completely incorrect solutions and hence improper designs. Though atomistic methods (Chowdhury et al. 2010a, b) are able to capture the small scale effects and atomic forces, these approaches are computationally prohibitive for nanostructures with large number of atoms. Thus, initially analyses have been generally carried out using classical mechanics. Extensive research over the past decade has shown that the analyses of nanostructures using classical mechanics are inadequate since these theories could not capture the small scale effect in the mechanical properties. For example, Wang and Hu (2005) showed that the decrease in phase velocities of wave propagation could not be predicted by classical beam theories when the wave number is so large that microstructure of carbon nanotubes has a significant influence on the flexural wave dispersion. Therefore, recently various efforts have been carried out to bring the scale effects within the formulation by amending the traditional classical continuum mechanics. Nonlocal elasticity theory for the first time was introduced by Eringen (1972). Recent literature shows that the nonlocal elasticity theory which includes small scale effect arising at nanoscale level is being increasingly used for reliable and quick analysis of nanostructures (Wang et al. 2008; Wang 2005; Zhang et al. 2005; Shen 2011; Lu et al. 2006; Challamel and Wang 2008) like nanobeams, nanoplates, nanorings, carbon nanotubes, graphenes, nanoswitches and microtubules. Aydogdu (2009) proposed a general nonlocal beam theory to study bending, buckling and free vibration of nanobeams. Integral equation approach has been employed by Xu (2006) to investigate the free transverse vibrations of nano-to-micron scale beams and the author found that the nonlocal effect on the natural frequencies and vibrating modes is negligible for microbeams while it plays a crucial role in nanobeams. Peddieson et al. (2003) formulated nonlocal version of Euler–Bernoulli beam theory. Authors have tried to find out numerical and analytical solutions for various types of nanobeams based on nonlocal continuum mechanics. Free vibration of Euler–Bernoulli and Timoshenko nanobeams based on nonlocal continuum mechanics has been solved analytically by Wang et al. (2007). Authors have given the frequency parameters for different scaling effect parameters and boundary conditions as Simply Supported–Simply Supported (SS), Clamped–Simply Supported (CS), Clamped–Clamped (CC) and Cantilever (CF). They have given first five mode shapes of clamped nanobeams based on nonlocal Timoshenko beam theory for various values of the scaling effect parameter. Naguleswaran (2002) presented results for transverse vibration of an Euler–Bernoulli uniform beam when it carries several particles. Civalek and Akgoz (2010) analysed free vibration of microtubules based on Euler–Bernoulli beam theory using Differential Quadrature (DQ) method. Nonlocal elasticity model has also been used to study free transverse vibration of cracked Euler–Bernoulli nanobeams by Loya et al. (2009). Investigations have also been carried out in the vibration of multiwalled carbon nanotubes. Ansari and Ramezannezhad (2011) studied nonlocal Timoshenko beam model for investigating the large amplitude vibrations of embedded multiwalled carbon nanotubes including thermal effects. Murmu and Adhikari (2010) developed an analytical method to investigate transverse vibration of double-nanobeam systems using nonlocal elasticity theory.Earlier investigations mainly focused on the use of classical mechanics in the vibration of nanobeams, which lack the accountability of the effects arising from the small scale. Thus, analysis of nanostructures has been investigated using nonlocal elasticity theory. As such, the problems have been solved by few authors using finite element method (Eltaher et al. 2012), Chebyshev polynomials in Rayleigh–Ritz method (Mohammadi and Ghannadpour 2011), meshless method (Roque et al. 2011), etc. Earlier methods may not be straightforward to problems with complicating effects. Handling of all sets of boundary conditions is another problem to analyse. Therefore, various efforts have been carried out for finding the solution of nanobeams based on nonlocal theory. This paper mainly focuses on solving the governing differential equations of Euler–Bernoulli and Timoshenko nanobeams by an efficient way. As such Rayleigh–Ritz method with simple polynomials and orthonormal polynomials has been used in this investigation. Use of boundary characteristic orthogonal polynomials in the Rayleigh–Ritz method makes the procedure easier to handle. This is because of the fact that most of the elements of mass and stiffness matrices of the generalized Eigen value problem become either zero or one due to orthonormality of the assumed shape functions. As a result, the computations become easier and efficient. Though this method has been used in vibration of classical beams and plates (Bhat 1985; Singh and Chakraverty 1994a, b, c; Chakraverty et al. 1999; Stiharu and Bhat 1997; Chakraverty 2009), it has not yet been reported for vibration of nanobeams. It may be noted that the kinetic and potential energy expressions used in the Rayleigh–Ritz method are as such not simple as compared to classical beams and plates. This is due to the fact that governing differential equations of nanobeams should be handled considering the nonlocal theory as mentioned above.In this paper, investigation is carried out to understand the small scale effects in the free vibration of nonlocal nanobeams based on Euler–Bernoulli and Timoshenko beam theories. The solution procedure includes the transformation of the governing equations from physical domain to computational domain using simple polynomials and boundary characteristic orthogonal polynomials in the Rayleigh–Ritz method. Results from our study in special cases are compared and are found to be in good agreement. Investigations with some new boundary conditions are also incorporated. As the mode shapes are useful for engineers to design the structures (they represent the shape that the structures will vibrate in free motion), so deflection graphs for nonlocal CC Euler–Bernoulli nanobeams with various scaling effect parameters are given.Using simple polynomials and orthonormal polynomials as basis functions in the Rayleigh–Ritz method, the frequency parameters for nanobeams have been computed. In this method, displacement and rotation due to bending functions are represented by a series of admissible functions.\( X = \frac{x}{L},W = \frac{w}{L},\alpha = \frac{{e_{ \, 0} \, a}}{L} \) = scaling effect parameter, \( \xi = \frac{L\sqrt A }{\sqrt I } \) = slenderness ratio, \( \tau = \frac{1}{{\xi^{2} }} \), \( \lambda^{ \, 2} \, = \, \frac{{\rho \, A \, \omega^{ \, 2} \, L^{ \, 4} }}{E \, I} \) = frequency parameter and \( \Upomega \, = \, \frac{E \, I}{{k_{s} \, G \, A \, L^{ \, 2} }} \) = shear deformation parameter.In Eq. (23), p and q take the values 0, 1 or 2 according to Free, simply supported or clamped boundary conditions, respectively. It may be noted that one may easily handle the boundary conditions of the problem by assigning various values of p and q as mentioned.