Based on first-principles simulations with the generalized gradient approximation (GGA) of the Perdew-Burke-Ernzerhof (PBE) functional, we studied the electronic structures and optical properties of hexagonal silicon nitride (β-Si3N4) doped with IV A elements, C, Ge, Sn and Pb. It was found that the Ge-doped system is characterized by a more stable structure with a lower formation energy of 2.584 eV compared with those of the C-, Sn- and Pb-doped systems of 3.877 eV, 5.249 eV and 7.672 eV, respectively. The band gap (EG) of the Pb-doped system was the lowest at 1.6 eV, displaying semiconducting characteristics. Additionally, there was a transition from a direct band gap to an indirect band gap in the C-doped system. Charge difference density analysis showed that the covalent property of the C-N bonds was enhanced by expansion of the electron-free region and the larger Mulliken population values of 0.71 and 0.86. Furthermore, lower absorption and reflectivity peaks at 11.30 eV were observed for the C-doped system, demonstrating its broader potential for application in photoelectric and microelectronic devices.