Purpose The study aims to thoroughly analyze thermal vibrations in functionally graded nanobeams, considering temperature-dependent material properties that vary continuously through the thickness based on a power law model. Methods To achieve this, a finite element method is developed using a nonlocal strain gradient theory. The analysis investigates three types of thermal loading: linear temperature rise, nonlinear temperature rise, and a newly proposed trigonometric shear deformation beam nonlocal strain gradient theory. The study focuses on understanding the combined impacts of nonlocal stress, strain gradient, and thermal effects on functionally graded nanocomposite beams. Governing equations are derived and solved using a specialized 3-node beam element. Results An extensive parametric investigation is conducted, examining the effects of structural parameters such as thickness ratio, beam length, nonlocal scale parameter, strain gradient parameter, material distribution profile, and thermal effects on the free vibration of functionally graded nanobeams. Conclusions The findings demonstrate that factors such as thickness ratio, beam length, nonlocal scale parameter, strain gradient parameter, material distribution profile, and thermal effects significantly impact the vibration behavior of nanobeams in a thermal environment. These results highlight the crucial importance of incorporating these variables into the design and analysis processes for functionally graded nanobeams to ensure optimal performance under thermal conditions.