Polyaniline-derived carbon (PDC) was obtained via pyrolysis of polyaniline under different temperatures and applied for the purification of water contaminated with dye molecules of different sizes and charge by adsorption. With increasing pyrolysis temperature, it was found that the hydrophobicity, pore size and mesopore volume increased. A mesoporous PDC sample obtained via pyrolysis at 900 °C showed remarkable performance in the adsorption of dye molecules, irrespective of dye charge, especially in the removal of bulky dye molecules, such as acid red 1 (AR1) and Janus green B (JGB). For example, the most competitive PDC material showed a Q 0 value (maximum adsorption capacity) 8.1 times that of commercial, activated carbon for AR1. The remarkable adsorption of AR1 and JGB over KOH-900 could be explained by the combined mechanisms of hydrophobic, π-π, electrostatic and van der Waals interactions. 597