The electronic and optical properties of armchair $$\hbox {MoS}_{{2}}$$ nanoribbons with Stone–Wales (SW) defect have been investigated using first-principles calculations. The structure of OH-passivated armchair $$\hbox {MoS}_{{2}}$$ nanoribbons with SW-2 at the edge is unstable, and can be relaxed to perfect nanoribbon. SW decreases the band gaps. The gaps of armchair $$\hbox {MoS}_{{2}}$$ nanoribbons with SW-1 at the center is greater than that of SW-1 at the edge, it is inverse for SW-2. The band gaps of armchair $$\hbox {MoS}_{{2}}$$ nanoribbons with OH-passivated are greater than that of armchair $$\hbox {MoS}_{{2}}$$ nanoribbons with H-passivated. The partial charge densities indicate that the defect levels are originating from the SW. The optical response, such as the dielectric function, the absorption, the reflectance, and the electron energy loss spectra, are also presented. The optical results show that $$\varepsilon _{1}^{\perp }$$ (0) and $$\varepsilon _{1}^{\Vert }$$ (0) of armchair $$\hbox {MoS}_{{2}}$$ nanoribbons with SW are greater than that of perfect nanoribbons. Besides, armchair $$\hbox {MoS}_{{2}}$$ nanoribbon with SW is a promising donor material for solar cells due to high power conversion efficiency.