The ever-increasing occurrence and persistence of pharmaceutically active compounds (PhACs) in soils, sediments, drinking water supplies and wastewater effluents are a matter of serious environmental concern for governments and researchers worldwide. Nanofiltration as tertiary treatment method can be a viable and practical tool to remove these pollutants from aquatic environments. However, organic matter present in water sources can foul the membrane surface during operation, thus being potentially able to affect the membrane performance. Therefore, fouling mechanisms could heavily influence on the removal efficiencies. The purpose of this study was to investigate the implementation of three nanofiltration membranes (TFC-SR2, NF-270 and MPS-34) and to study both the rejection of trace PhACs and the fouling mechanisms for each membrane as a function of feed solution pH. Fouling mechanisms were predicted by Hermia's model adapted to cross-flow configurations. Results demonstrated that higher removals were obtained at slightly alkaline pH, especially for anionic trace PhACs. At the same conditions, more severe fouling was observed, which resulted in strong flux declines and an increase in hydrophobicity. This indicates that the attached organic matter on the membrane surface acts as a secondary selective barrier for separation.