In the present study, adsorption of lead and cadmium in wastewater was investigated by ethylenediamine-surface-modified single-walled carbon nanotubes (EDA-SWCNTs) to determine important parameters influencing the performance of carbon nanotubes for the adsorption process and to specify optimum values of the parameters in this process. The adsorbents were characterized by Fourier transform infrared spectroscopy, field emission scanning electron microscopy, and energy-dispersive X-ray spectroscopy. At 1 atm, the adsorption capacity of carbon nanotubes was increased (52% for Pb and 72% for Cd) after modification with EDA. The effect of concentration of lead and cadmium ions, the dosage of carbon nanotubes, pH, temperature, time, and interfering ions on the removal of Pb2+ and Cd2+ was studied, and adsorption efficiency was evaluated by atomic absorption spectrophotometer. Central composite design modeling was utilized to ascertain the interaction of operating parameters and determining optimum conditions. Optimization results showed that the most important factors in this adsorption process were initial concentration of lead and cadmium, CNT dosage, time, and pH, respectively. The optimum adsorption capacity was found to be 96.91% and 93.47% for lead and cadmium ions, respectively. These values were obtained at 4 mg/L of the initial concentration of metallic ions, by 200 mg of EDA-SWCNTs, adsorption time of 50 min, and pH level of 5. Results of validation tests showed an acceptable agreement between experimental and predicted data (error 1.25% for Pb and 1.95% for Cd). The equilibrium isotherm study indicated a good conformity with the Langmuir model suggesting a monolayer homogenous adsorption of lead and cadmium onto carbon nanotubes (R-2 = 0.999 for Pb and R-2 = 0.997 for Cd).