Herein, a recyclable thiourea-modified magnetic coffee residue was prepared, characterized, and investigated for Cd(II) and Pb(II) adsorption and magnetic solid-phase extraction in aqueous solutions. Optimal conditions of the adsorption parameters were found to be initial Cd(II) and Pb(II) concentrations of 4 and 20 mg/L, respectively, sample solution pH of 7, adsorbent amount of 50 mg, agitation rate of 150 rpm, and adsorption period of 30 min. The adsorption isotherm and kinetics aligned well with the Langmuir and the pseudo-second-order models, respectively. The modified magnetic coffee residue demonstrated a high uptake potential (mg/g), 8.9 for Cd(II) and 40 for Pb(II). The results indicate that chemosorption is the rate-limiting and that temperature influences the process. The elution procedure was performed by 5 mL 0.5 M thiourea in 2 % HCl and the developed magnetic solid-phase extraction technique presented excellent linearity (R2 ≥0.998), sensitivity (LOD (µg/L), 0.18 and 0.93 respectively for Cd(II) and Pb(II)), and precision (%RSD, ≤2.7 %). Compared to the reported techniques, the method is highly effective, environmentally friendly, and easily accessible. It also demonstrated good potential (%R, 92.5–99.0 %) when applied to real-world water samples. In conclusion, the developed techniques are recommended for the adsorption and magnetic solid-phase extraction of toxic metals in water systems.