A novel pH-responsive nanofiltration membrane was fabricated by means of layer-by-layer (LbL) technique based on porphyrin supramolecular self-assembly. The multilayer membrane was prepared on a hydrolyzed poly(acrylonitrile) (PAN) support membrane, and was composed of poly(allylamine hydrochloride) (PAH) as a polycation and poly(styrene sulfonate) (PSS) as a polyanion and 5,10,15,20-tetrakis-(4-sulfonatophenyl)-porphyrin (TPPS) as the pH-responsive functional supramolecular. Aggregation of TPPS and the shielding effect of salt in solution affected the adsorption of TPPS onto the membrane, while the higher ionization degree of the oppositely charged membrane with PAH favored the adsorption of TPPS. A coil structure of polyelectrolytes caused by the lower ionization degree of PAH or by the shielding effect of salt led to higher adsorption of polyelectrolytes on the membrane. The LbL assembly membrane showed higher and pH-responsive water flux and salt rejection compared with that without TPPS. At pH 1.0, TPPS assembled into J-aggregates on the membrane surface, and the membrane showed relatively lower water flux and higher rejection. When the pH value was increased above 2.0, TPPS transformed into H-aggregates and monomers, and the membrane showed relatively higher water flux and lower salt rejection.