A dopamine-pectin hydrogel (Dop-Pec hydrogel) and a Dop-Pec hydrogel modified with tannic acid (Dop-Pec/Tan hydrogel) were synthesized and their capability for the removal of the cationic dye methylene blue (MB) from aqueous solutions was investigated. The Dop-Pec hydrogel was prepared through conjugation of dopamine with pectin using a heterogeneous chemical reaction followed by exposing to electron beam irradiation, and the surface of the Dop-Pec hydrogel was modified with tannic acid through a secondary heterogeneous chemical reaction. The chemical structure and morphology of hydrogels were characterized by Fourier transform infrared (FTIR) spectroscopy, scanning electron microscopy (SEM), energy dispersive X-ray (EDX) spectroscopy, thermogravimetric analysis (TGA), differential scanning calorimetry (DSC), X-ray diffraction-(XRD), point of zero charge (PZC) analysis, and mechanical properties studies. The effects of pH, the initial concentration of dye, contact time, dose of the electron beam and stirring rate on the sorption of MB were investigated. Sorption kinetics were best described by the pseudo-second-order model, and the sorption behaviors were in agreement with the Langmuir isotherm model for both sorbents. Thermodynamic analysis revealed that the sorption of MB on the hydrogels was spontaneous, exothermic and so is favorable at low temperature. It was also found that the sorption capacity of Dop-Pec/Tan hydrogel (186.7 mg g(-1)) was higher than Dop-Pec hydrogel (111.1 mg g(-1)).