We showed the effect of commensurate confinement in the pores of nanoporous carbons in the conversion of visible light into a chemical reaction. By using a series of nanoporous carbons with a controlled distribution of pore sizes obtained from a gradual activation under moderate conditions, we have demonstrated the superior conversion of light in the constrained pore space of the carbons compared to values in solution. Besides a more efficient conversion of light, nanopore confinement resulted in a 100-200 nm redshift in the wavelength onset of the photochemical reaction. The visible light activity was boosted in pores which sizes match the dimensions of the confined compound. We attribute this to the enhanced splitting and charge separation of the photogenerated species in the nanopores, due to the proximity of the charge carriers and the adsorbed molecules.