Chemocatalytic synthesis of lactic acid (LA) from biomass sugars involves heat-absorbing multistep cascade reactions mediated by different active sites, often encountering unsatisfactory selectivity. Here, a hole-localized carbon nitride-based photocatalyst (C-CNN) is constructed by covalent binding of heptazine and triazole skeleton via C─N bonds and further conjugated interaction with activated carbon, achieving the complete conversion of various biomass sugars to LA (up to 98.6% selectivity) at room temperature for 2 h. The introduced triazole electron donor in C-CNN can not only enhance the adsorption of sugar for the enhanced aldose-to-ketose isomerization over the localized hole (Lewis acid) on the triazole skeleton, but also modulate the valence band oxidation to circumvent the formation of •OH but only •O