Through a simple chemical method, we have successfully synthesized g-C3N4 material doped with Co3+ ions at a ratio of 7-12%, and the 10% Co-doped g-C3N4 sample with varying synthesis times from 6 to 20 hours. The material's structure was investigated using X-ray Diffraction (XRD) and Raman spectroscopy. The optical properties of the material system were examined through fluorescence spectra and X-ray Photoelectron Spectroscopy (XPS). The photocatalytic capability of both pure g-C3N4 and 10% Co-doped g-C3N4 samples was assessed by monitoring the degradation of Rhodamine B (RhB) solution under natural sunlight and Xenon lamp irradiation. The research results indicate that the optimal photocatalytic performance is achieved with 10% Co3+doped g-C3N4 synthesized for 15 hours. The enhanced photocatalytic ability of the doped material system is attributed to Co3+ acting as a center to capture electrons, prolonging electron-hole recombination time and thereby increasing the photocatalytic efficiency.