The purification of H2-rich streams using membranes represents an important separation process, particularly important in the viewpoint of pre-combustion CO2 capture. In this study, the separation of H2 from a mixture containing H2 and CO2 using a zeolitic imidazolate framework (ZIF)-8 membrane is proposed from a theoretical point of view. For this purpose, the adsorption and diffusion coefficients of H2 and CO2 were considered by molecular simulation. The adsorption of these gases followed the Langmuir model, and the diffusion coefficient of H2 was much higher than that of CO2. Then, using the Maxwell–Stefan model, the H2 and CO2 permeances and H2/CO2 permselectivities in the H2–CO2 mixtures were evaluated. Despite the fact that adsorption of CO2 was higher than H2, owing to the simultaneous interference of adsorption and diffusion processes in the membrane, H2 permeation was more pronounced than CO2. The modeling results showed that, for a ZIF-8 membrane, the H2/CO2 permselectivity for the H2–CO2 binary mixture 80/20 ranges between 28 and 32 at ambient temperature.