The large intrinsic bandgap of NiO hinders its potential application as a photocatalyst under visible-light irradiation. In this study, we have performed first-principles screened exchange hybrid density functional theory with the HSE06 functional calculations of N- and C-doped NiO to investigate the effect of doping on the electronic structure of NiO. C-doping at an oxygen site induces gap states due to the dopant, the positions of which suggest that the top of the valence band is made up primarily of C 2p-derived states with some Ni 3d contributions, and the lowest-energy empty state is in the middle of the gap. This leads to an effective bandgap of 1.7 eV, which is of potential interest for photocatalytic applications. N-doping induces comparatively little dopant-Ni 3d interactions, but results in similar positions of dopant-induced states, i.e., the top of the valence band is made up of dopant 2p states and the lowest unoccupied state is the empty gap state derived from the dopant, leading to bandgap narrowing. With the hybrid density functional theory (DFT) results available, we discuss issues with the DFT corrected for on-site Coulomb description of these systems. (C) 2011 American Institute of Physics. [doi: 10.1063/1.3596949]