The electronic and optical properties of bulk-, supercell- and nanocluster-C3N4 are studied by the first- principles calculations within the framework of the density functional theory (DFT). The results show that C3N4 is indirect band gap semiconductors, from total densities of states and partial densities of states of carbonitride, it was found that valence band occupied by N 2p states, conduction band occupied by C 2p states. The optical properties of C3N4 show that there are two absorption peaks for light absorption in the ultraviolet region, the light permeability spectrum displays the wide photoconductive response interval and a high peak of C3N4. These results demonstrate that the materials C3N4 with good optical conductivity is prospective in the field of photoelectric equipment.