The production of hydrocarbons for the synthesis of readily available energy and multifunctional materials is of great importance in modern society. Zeolites have proven to be a boon for the targeted regulation of specific hydrocarbon as shape-selective catalyst in converting carbon resources. Yet our mechanistic understanding and quantitative description of shape-selectivity of zeolite catalysis remains rather limited, which restricts the upgrade of zeolite catalysts. Herein, we proposed quantitative principle of shape-selectivity for zeolite catalysis using methanol-to-hydrocarbons (MTH) as model. Combining with molecular simulations and infrared imaging, we unveil the competition of thermodynamic stability, preferential diffusion and favored secondary reactions between different hydrocarbons within zeolite framework are the essence of zeolite shape-selective catalysis. Notably, we provide methodology to in silico search for the optimal combination of framework topology and acidity properties of zeolites with operating conditions that potentially outperform commercial MTH catalysts to achieve high selectivity of desired hydrocarbon products.