Computational simulation methods are used for characterizing the detailed attachment, diffusion and desorption of halogen vapor molecules in zeolitic imidazolate framework-8 (ZIF-8). The attachment energies of Cl2, Br2 and I2 are −55.2, −48.5 and −43.0 kJ mol−1, respectively. The framework of ZIF-8 is disrupted by Cl2, which bonds with Zn either on the surface or by freely diffusing into the cage. A framework deformation on the surface of ZIF-8 can be caused by the attachment of Br2, but only reorientation of the 2-methylimidazolate linkers (mIms) for I2. In diffusion, the halogen molecules have a tendency to vertically permeate the apertures of cages followed with swing effect implemented by the mIms. Larger rotation angles of mIms are caused by Br2 because of its stronger interaction with mIms than I2. A maximum of 7 Br2 or 5 I2 molecules can be accommodated in one cage. Br2 are clinging to the mIms and I2 are arranged as crystal layout in the cages, therefore in desorption processes molecules attached to the surface and free inside are desorbed while some remained. These results are beneficial for better understanding the adsorption and desorption processes of halogen vapors in the porous materials.