New fouling resistance and stimulus-responsive nanofiltration membranes were fabricated by adding photochromic spiropyran (SPO) and spironaphthoxazine (SNO) nanofillers to the polyethersulfone (PES) matrix via the phase inversion method. The effect of SPO and SNO, as novel photoresponsive molecule nanofillers, were evaluated in terms of membrane morphology, porosity, wettability, pure water flux (PWF), antifouling resistance, and stimulus-responsive properties. All the modified membranes indicated better performance compared to the bare PES. The membrane PWF was notably enhanced from 7.7 kg/m(2)h for the bare PES up to 18.68 and 20.58 kg/m(2)h for the 0.1 wt.% SPO and SNO blended membranes, respectively. Also, the 0.1 wt.% of SNO-based PES membrane indicated the best flux recovery ratio compared to the other membranes. The photo stimulus-responsive assessment showed a color change for both SPO and SNO photochromic in membranes. In the case of variable effect investigation, the response surface methodology at three levels (pressure: 4, 5, 6 bar and flow rate: 50, 100, and 150 L/h) was applied. A suitable flux (23.39 kg/m(2) h) and high removal efficiency (more than 90%) was achieved at optimum conditions. Also, the modified membranes by photochromic materials were sensitive to environmental variables such as acidic and alkaline conditions by changing their color.