The presence of dye effluents released from dye-using industries has emerged as a great environmental concern in recent years. Adsorption is considered as an efficient method for capturing contaminants from wastewater. However, due to limited adsorption efficiency, selectivity, and regeneration capability of adsorbents, it is difficult to solve the prevailing dye effluent issue. In this work, we prepared a highly efficient and selective lignin-derived sulfonated porous carbon (LSPC) adsorbent from cornstalk by a facile etching-sulfonation process by using Fe3O4 as a templating agent. Profiting from high density of negatively charged groups (including − SO3H, −COOH, and phenolic − OH), the prepared LSPC showed outstanding selectivity for rapid removal of cationic dyes due to electrostatic affinity. LSPC exhibited great pH responsiveness towards methylene blue adsorption capacity, which increased drastically from 234.19 mg/g to 621.52 mg/g when pH value increased from 2 to 11. Moreover, the LSPC demonstrated excellent regenerated property. On account of its excellent selectivity, strong adsorption capacity, facile regeneration, and great reusability, the lignin-derived sulfonated porous carbon holds great potential towards selective adsorption and recycle of cationic dyes in water treatment field.