CsMX3(M = Sn, Pb; X = Cl, Br, I) are strong candidates for the fast high energy irradiation detectors, ionic conductors, and optoelectronic devices. There are many experimental and theoretical investigations devoted to the study of perovskites ABX3 (A is a cation with different valence, B is a transition metal and X is oxides, halides or chlorides). But there is no systematic study of CsMX3 using HSE approximation particularly. In this paper, the band structures, density of states and optical properties of CsMX3(M = Sn, Pb; X = Cl, Br, I) have been studied by first-principles calculations using both the hybrid functional (HSE) approximation and the PBE-GGA approximation. The results of both approximations are compared with the experimental values. The results of HSE are closer to the experimental values. The changes of properties have been founded by comparing the band structures, density of states and optical properties of this series of thin film materials respectively. The trend of impact on these properties by replace elements has also been found. Our results provide a basis for the design of specific performance thin film materials.