Performing first-principles calculations, the structural, electronic, and optical properties of C3B and C3B0.5N0.5 monolayers are investigated systematically. The calculations of cohesive energies, molecular dynamics, and phonon spectra show the energetic, thermal, and dynamical stabilities of C3B and C3B0.5N0.5 monolayers. The C3B0.5N0.5 (C3B) is predicted to be semiconductors with moderate direct (indirect) gap of 2.376 (1.948) eV at G(0)W(0) level. The observed systems both have good absorptions for the visible light. Compared with that of the C3B, first absorption peak of the C3B0.5N0.5 is remarkably red-shifted, suggesting an enhanced absorption for the near-infrared light. The corresponding bright excitons have large binding energies, being 0.913 eV for the C3B and 0.704 eV for the C3B0.5N0.5, respectively. The relatively small binding energy of exciton in the C3B0.5N0.5 is very beneficial for the separation of the photogenerated electron-hole pair. More importantly, the C3B0.5N0.5 monolayer can achieve a large light absorption coefficient beyond 105 cm(-1) for the sunlight irradiation. These findings enrich the deep understanding of C3B and C3B0.5N0.5 monolayers, and indicate their potential applications in optoelectronics.