Heteroatom doping is a promising strategy for improving adsorption performance of cost-effective carbon materials for heavy-metal ions from wastewater. However, the lack of theoretical research restricts its development. Herein, theoretical simulations successfully predict that the short distance between the N and S sites is a key factor for the N,S-codoped carbon with a higher adsorption capacity than that of the single doping carbon. Inspired by this interesting finding, a low-energy and ultrafast approach is proposed to prepare N,S-codoped carbon within only 10 s from ternary deep eutectic solvents. Benefiting from the unique dual-doped architecture, the adsorption capacity of the N,S-codoped carbon for Cr(VI) is significantly enhanced to 564.7 mg/g in comparison with single doped carbon (396.2 mg/g) and pristine carbon (186.4 mg/g). The further calculations of energy and electronic structure reveal that adjacent -NH3+ and -SO2- groups can generate frustrated Lewis pairs (FLPs). Such FLP-type sites can promote the adsorption and reduction of Cr(VI) ions due to enhanced electron transfer between functional groups and Cr(VI) ions. This work provides an in-depth comprehension and guidance for synthesis of heteroatom-codoped carbon-based materials with excellent separation performance for heavy metal ions.