One of the popular, low‐cost, efficient, and environmentally friendly methods for separating pollutants and water purification are membrane‐based processes. In this study, nanofiltration membranes were modified using the photo‐responsive graphene oxide‐spiropyran (GO‐SP) nanosheets as novel additive. Graphene oxide was employed to improve permeability, antifouling, and mechanical properties of the membranes. Spiropyran was added due to the increase in the self‐cleaning properties of the PES membranes. First, spiropyran (SP) as a photochromic compound was chemically immobilized onto the graphene oxide (GO) surface. Different examinations such as ultraviolet–visible (UV–Vis) spectroscopy, energy‐dispersive X‐ray spectroscopy (EDS), field emission scanning electron microscopy (FE‐SEM), and atomic force microscopy (AFM) were used to check the effective grafting of spiropyran. Then, nanofiltration membranes containing polyethersulfone (PES) and GO‐SP additive with different weight percentages (0.15, 0.25, 0.5, and 0.75 wt.%) were prepared. Membranes comprising 0.5 wt.% GO‐SP exhibited the best surface properties, and at concentrations above 0.5 wt.%, aggregation of GO‐SP additive occurred on the surface of the membrane. The Young modulus increased from 45.11 MPa for pure PES membrane to 82.63 MPa for PES/GO‐SP‐0.75. The flux of pure water, rejection of bovine serum albumin (BSA) protein, and separation of anionic dyes including Congo Red (CR) and Coomassie Brilliant Blue (CBB) were measured to show the filtration performance of the fabricated membranes. It was observed that the addition of 0.5 wt.% GO‐SP increased the flux of pure water of the PES‐based membrane from 2.97 to 14.6 L/m2 h. All prepared membranes rejected more than 94% of CBB and CR dyes. The addition of GO‐SP also developed the performance of the membranes against fouling. In addition, the effects of UV light on membrane fouling, dye rejection, and contact angle were investigated. According to the results, irradiation of GO‐SP with UV light decreased the contact angle and increased the flux of pure water. In the presence of UV light, the membrane containing 0.5 wt.% GO‐SP exhibited 58.74% reversible fouling, 8.30% irreversible fouling, and 93% flux recovery ratio, indicating its better performance than the pure membrane.