The stability, structural, elastic, electronic and optical properties of perovskite hydrides BaLiH3 and SrLiH3 were investigated by the density functional theory. The calculated lattice parameters are in well agreement with previous calculation and experimental data. The energy band structure, density of states, born effective charge and Mulliken charge population were obtained. BaLiH3 and SrLiH3 present an indirect band gap of 2.23 eV and 1.86 eV at equilibrium. The top of the valence band reflects the s electronic character for both structures. Furthermore, the absorption spectrum, refractive index, extinction coefficient, reflectivity, energy-loss spectrum and dielectric function were calculated. The origin of the spectral peaks was interpreted based on the electronic structure. The static dielectric constant and static refractive index are proportional to the fundamental indirect band gap.