Slow pyrolysis is an efficient method for converting agricultural and forestry wastes into valuable resources, thereby addressing energy shortage and environmental pollution. In this study, a slow-pyrolysis experiment of coffee shells (CS) at 450–850 °C was conducted in a tube furnace. The resulting pyrolysis products were comprehensively characterized via FTIR, Raman spectroscopy, nitrogen adsorption analysis via BET theory, SEM, XPS, and PY-GC-MS. Moreover, the pyrolysis reaction mechanism and N transformation pathway of CS were proposed. The results showed that with the increase in pyrolysis temperature, the yield of biochar gradually decreased, and the yield of biogas gradually increased. At 850°C, the yields of biochar, bio-oil and biogas of CS were 27.13, 35.16 and 37.71 %, respectively (on a dry, ash-free basis). The bio-oil yield was highest at 550 °C, reaching 35.7 %. Notably, biochar exhibited favorable characteristics such as high specific surface area and porosity, demonstrating its potential as both a biomass fuel and an adsorption material. Acetone (78.30 %) and caffeine (8.29 %) was the predominant substance in bio-oil. Biogas was predominantly composed of CO2, CO, CH4 and H2. The pyrolysis process of CS mainly involved the degradation of macromolecules into small molecules, the repyrolysis of small molecules, dehydrogenation, deoxygenation, alkylation, isomerization, and self-condensation. These results provide a theoretical basis for the recycling of waste biomass CS, which has environmental protection significance and economic value.