A new photochromic and porous Cd (II) metal–organic framework (MOF) has been synthesized by using a robust viologen ligand, named 1-(3-carboxybenzyl)-4,4′-bipyridinium chloride (m-Hbcbpy·Cl) and CdBr2·2H2O. This MOF (Cd–viologen) exhibits fast response and reversible photochromism by electron-transfer (ET) progress due to the viologen radicals formation. Cd–viologen exhibits to select and detect benzenes in solid state due to the electron – deficient properties of m-Hbcbpy·Cl. The benzene detections have been confirmed by visual color changing phenomenon and luminescence quenching experiment. In addition, photo-controlled luminescence properties of this MOF, during the coloration–decoloration process, has been researched.