Doped Sr2M2O7 (M = Nb and Ta) crystals with various chalcogen X (X = S, Se, and Te) concentrations have been studied by using first-principles calculations combined with hybrid functional (HSE06). Our results indicate that the more stable doping site of X generally induces the less distortion of the lattice. The calculated formation energies reveal that the doping becomes more difficult in the order S < Se < Te. Some localized X np states are located above the VBM of pure semiconductors, which results in the narrowing of band gaps. For Sr2Nb2O7, an increase of the X concentration has negative effect on the narrowing of band gap since the X np states moves towards the VBM of pristine semiconductor. As to Sr2Ta2O7, the higher doping level of X elements leads to the further narrowing of energy gap compared with the lower doping level. The formation of Sr2M2X7 (X = S and Se) by replacing all the O atoms in crystal structures by chalcogens extends the absorption edges to near-infrared region and loses the abilities to oxidize water. Our findings demonstrate that S-doped Sr2Nb2O7, Se-doped Sr2Nb2O7 and Se-doped Sr2Ta2O7 at a higher doping level, and Te-doped Sr2Ta2O7 at a lower doping level can catalyze overall splitting water reaction under visible light irradiation. Furthermore, they possess stronger capabilities of photo-oxidation and photo-reduction than pristine semiconductors. Therefore, these systems mentioned above are potential visible-light-driven photocatalytic materials, which are worthy of further experimental investigations.