Smart nanochannels can regulate ion transport behavior by external stimulus and display precise ion selectivity in biological membrane systems, but constructing artificial membranes with responsive and tunable channel remains a severe challenge. Herein, smart covalent organic framework (COF) membranes decorated with photo-responsive azobenzene derivatives (COF-Azo) were fabricated by a biomimetic nanochannel modulation (BNM) strategy, endowing membranes with charged and switchable sub-nanochannels. Under different wavelength of light, the smart COF-Azo membranes simultaneously exhibited outstanding mono/monovalent and mono/divalent ion selectivity (K+/Li+ ideal selectivity of 17.9 and Li+/Mg2+ ideal selectivity of 24.9) via closing and opening channels. The conversion of effective pore size at angstrom level is realized by photoisomerization of azobenzene. After several photoswitch cycles, the smart membranes still maintained K+/Li+ selectivity of 6.1 and Li+/Mg2+ selectivity of 20.7 in mixed salt solution, exhibiting great potentials in lithium extraction. This work may blaze a trail in constructing photo-responsive nanochannel membranes for energy-efficient ion separation.