Carbon nitride, an emerging polymeric semiconductor, has attracted attention in research ranging from photocatalysis to photodetection due to its favorable visible light response and high physicochemical stability. For its practical device application, the fabrication of high-quality carbon nitride films on substrates is essential. However, conventional methodologies to achieve high polymerization of carbon nitride are often accompanied by its decomposition, significantly compromising the film quality. Herein, we report an ultrafast fabrication of carbon nitride film by laser direct writing (LDW). The instantaneous high temperature and pressure during LDW can efficiently boost the polymerization of carbon nitride and suppress its decomposition, resulting in high-quality carbon nitride film with excellent mechanical stability with the substrate. Due to the efficient photon-to-electron conversion, it exhibits an outstanding photoelectrochemical water splitting and optoelectronic detection capability, even under strong acid/alkaline conditions. This study thus offers a facile and efficient LDW strategy for the rapid fabrication of carbon nitride film photoelectrodes, demonstrating its great feasibility in multifunctional photoelectrical applications, including but not limited to photoelectrochemical water splitting and optoelectronic detection.