The present work describes the adsorption and separation of xylene isomers by ZIF-8. Although the formal pore diameter of ZIF-8 is much smaller than the molecular diameter of the xylene isomers, ZIF-8 is able to separate the isomers by molecular sieving. A structural study indicates that the diffusion of the xylenes into the pore structure of ZIF-8 happens via a transitory deformation of the pore aperture which is based on a tilt of the imidazolate linkers, followed by a return to the initial conformation. The rate of adsorption depends on the size of the isomer, i.e. it decreases from para- to meta- and to ortho-xylene. The separation of the xylene isomers is good in the gas phase. In liquid phase breakthrough experiments, the quality of the separation is deteriorated. Moreover, as expected for a separation based on molecular sieving, para-xylene cannot be well separated from ethyl-benzene.