The retention of sulfamethoxazole (SMZ) by nanofiltration (NF) membranes is strongly influenced by the pH value of the solution. The retention of SMZ reaches its peak value when the solution pH rises above its pKa2 value as the compound transforms into a negatively charged species. Charge repulsion is the main mechanism involved in SMZ removal by NF membranes. In this study, the removal of SMZ by NF membranes, as a function of solution chemistry, was examined at pH 8.9 to investigate the effect of solution conditions on charge repulsion. The results show that the retention of negatively charged SMZ is relatively independent of SMZ concentration, and an increase in the ionic strength of the solution causes a relatively small reduction in retention. A small effect of humic acid (HA) on SMZ retention was noticed at pH 8.9, which can be explained by a small but insignificant improvement in the zeta potential of the membrane caused by HA at high pH values. However, it was found that SMZ concentration in the feed decreased significantly in solutions containing tannic acid (TA). The Adams-Bohart model was applied to our experimental data and was found to be suitable for describing the initial part of the breakthrough curves. The adsorptive parameters of the membrane were determined.