The paper proposes a Ritz-type solution for free vibration and buckling analysis thinwalled composite and functionally graded sandwich I-beams. The variation of material through the thickness of functionally graded beams follows the power-law distribution.The displacement field is based on the first-order shear deformation theory, which can reduce to non-shear deformable one. The governing equations of motion are derived from Lagrange's equations. Ritz method is used to obtain the natural frequencies and critical buckling loads of thin-walled beams for both non-shear deformable and shear deformable theory. Numerical results are compared to those from previous works and investigate the effects of fiber angle, material distribution, span-to-height's ratio, and shear deformation on the critical buckling loads and natural frequencies of thin-walled I-beams for various boundary conditions.