Metal-organic frameworks (MOFs) are the promising nanomaterials for separation of molecules with close dimensions and structures, such as various types of isomers. The efficiency of separation can be greatly enhanced if the apertures of the nanosized windows, controlling the diffusion of a particular molecule inside the cavities, are fine-tuned by external stimuli. We report the new approach for precise measurement of window sizes in ZIF-8 MOF and employ it in efficient separation of xylenes, which is of high practical importance. For this sake, we synthesized ZIF-8 with embedded stable nitroxides in the pores and applied electron paramagnetic resonance spectroscopy for in situ kinetic measurement of the diffusion of various guest molecules through the material. Slight variation of temperature within 298-333 K allowed tuning of the windows and reaching optimum conditions for separation of p-, m-, and o-xylenes with the efficiency up to 92-95%. The developed methodology provides deeper understanding of steric and kinetic aspects of molecular diffusion in ZIF-8 and paves the way to rational optimization of other MOF-based separation applications.