The effect of strain on the electronic and optical properties of ATaO2N (A = Ca, Sr and Ba) is investigated using the first-principles hybridization functional calculations. The electronic and optical properties under the strains of − 8 to + 8% in (100) and (010) directions are investigated. The results demonstrate that the band energy gap, band edges, absorption, reflectivity, and refractive index are obviously affected by the strains. Moreover, the effects of strains in (100) direction on all the considered properties of ATaO2N are more obvious than those in (010) direction. The enhanced absorption in the visible light region is also found, which implies that ATaO2N can well respond to the visible light. The present findings could provide a helpful reference to design photoelectronic materials with ATaO2N by strain engineering.