The preparation of mesoporous carbon-based composites derived from metal-organic frameworks (MOFs) has become a new strategy for the fabrication of electromagnetic wave (EMW) absorption materials. However, the EMW absorption effect of metal ion sources preparing precursor MOFs on the final carbonized mesoporous carbon-based composites has not been explored in detail yet. In this work, two kinds of ZIF-67s were synthesized using different cobalt sources (CoCl2·6H2O and Co(NO3)2·6H2O), respectively. It is found that the two ZIF-67s have different morphology and thermal stability owing to the differences in anions of cobalt sources metallic salts. And two series of mesoporous Co/C composites were further prepared by calcination of ZIF-67 at 500, 600, 700, and 800 °C, respectively. Their EMW absorption performance and corresponding mechanism were investigated and compared. Results indicate that the Co/C composites derived from different cobalt sources possess diverse microstructures and EMW absorption capabilities, which also depend on carbonization temperature. Significantly, the Co/C-1-600 and Co/C-2-700 with the loading of 30 wt% in paraffin, achieved the minimum reflection loss of − 34.80 dB and − 37.43 dB at an effective absorption bandwidth of 4.37 GHz and 3.63 GHz with an optimum matching thickness of 2 mm and 2.5 mm, respectively. The different EMW absorption performance of Co/C composites are attributed to the difference of energy loss mechanism caused by different anions in cobalt source metal salt and different calcination temperature, including electrical loss, magnetic loss, interfacial polarization loss, multiple reflection loss and impedance matching.