The first-principles study of cubic perovskites SmXO3 (X = Al and Co) for elastic, mechanical and optical properties is done in the framework of density functional theory (DFT). Optimized structural parameters are obtained first to find mechanical and optical properties of the materials. These obtained structural parameters are in accordance with the published data. The cubic elastic parameters C11, C12 and C44 are then calculated by using generalized gradient approximation (GGA) as an exchange correlation functional in Kohn–Sham equations. Poisson’s ratio, shear modulus, Young’s modulus and anisotropic factor are deduced from these elastic parameters. These compounds are found to be elastically anisotropic and SmAlO3 is brittle while SmCoO3 is ductile. Their covalent nature is also discussed by using Poisson’s ratio. In addition, optical properties like absorption coefficient, extinction coefficient, energy loss function, dielectric function, refractive index, reflectivity and optical conductivity are studied. This study predicts that SmAlO3 and SmCoO3 are suitable for optoelectronic devices.