Abstract A novel photoresponsive molecularly imprinted polymer (MIP) was developed for the selective extraction of guanine from complex samples. The photoresponsive MIP was fabricated using guanine as the template, water-soluble 5-[(4-(methacryloyloxy)phenyl)diazenyl]isophthalic acid as the functional monomer, and water-soluble triethanolamine trimethacrylate as the cross-linker. The MIP displayed good selectivity toward guanine with a dissociation constant of (2.70±0.16)×10−5molL−1 in aqueous media. The density of the guanine-specific receptor sites in the MIP material was (4.49±0.22)μmolg−1. Quantitatively release and uptake of guanine by the MIP occured with irradiation at 365 and 440nm, respectively. The MIP could efficiently extract guanine from beer and then release it into aqueous media under photocontrol. This method could be used for selective separation and subsequent determination of a specific analytes from complex samples.