Using ab initio density functional calculations, we have investigated the stability and electronic structure of pure and oxygen doped semiconducting Cu3N. The oxygen can be accommodated in the system without structural instability as the formation energy either decreases when oxygen substitutes nitrogen, or remains nearly same when oxygen occupies the interstitial position. The interstitial oxygen (OI) prefers to stabilize in the unusual charge neutral state and acts as an acceptor to make the system a p-type degenerate semiconductor. In this case the hole pockets are formed by the partially occupiedOI-p states. Onthe other hand, oxygen substituting nitrogen (OS) stabilizes in its usual2 charge state and acts as a donor to make the system an n-type degenerate semiconductor. The electron pockets are formed by the conducting Cu-p states. In the case of mixed doping, holes are gradually compensated by the donor electrons and an intrinsic gap is obtained for Cu3N1-2xO xO x S 2 I stoichiometry.Our calculations predict the nature of doping aswell as optical band gap (Eg ) opt variation in experimentally synthesized copper oxynitride. While interstitial doping contracts the lattice and increases the Eg , opt substitutional doping increases both lattice size and E . g opt Mixed doping reduces Eg . opt Additionally we show that a rare intra-atomic d-p optical absorption can be realized in the pristine Cu3Nas the Fermi level lies in the gap between the Cu-d dominated antibonding valence state and Cu-p conducting state. © 2016 IOP Publishing Ltd.