Using the first principles calculations, the electronic and optical properties of C, Mo and Mo-C-doped anatase TiO2 are studied. For the Mo mono-doped TiO2, the band gap reduces little, and the largest perturbation occurs at the CBM of TiO2. C mono-doping suppresses the effective band gap, but the partially occupied subbands in the gap probably also serve as the recombination centers for electrons and holes. Therefore, the Mo-C co-doping is investigated for the charge compensation consideration. We discuss six doped configurations and find that the total energy of the system is increased with increasing distance of C and Mo. It is found that co-doped configurations with C nearest to Mo possess the lowest total energy. Then, we focus on discussing three possible Mo-C adjacent co-doped configurations. The subbands mainly induced by C-2p states in the band gap become fully occupied because the Mo atom contributes sufficient electrons to C anion for compensation. At the same time, the effective band gap is narrowed about 0.9 eV and the perturbation at the CBM occurred in Mo mono-doped TiO2 disappears, which means the band edges of doped system still straddle the redox potentials of water. Furthermore, the optical properties of the compensated Mo-C adjacent co-doped TiO2 and pure TiO2 are calculated. The optical absorption edges of the Mo-C co-doped TiO2 shift towards the visible light region.