Metal–organic frameworks (MOFs) are widely used as precursors to generate derivatives for electrocatalysis. However, two-dimensional (2D) MOFs often suffer from the collapse of their 2D structures after being treated at high temperature. Herein, we used the dense ZIF-EC1 as a precursor and doped Co as a secondary metal. The content of Co in ZIF-EC1 can be tuned without changing the crystalline structure. After pyrolysis, the derived carbon-based material maintains the 2D morphology from the parental precursor. The derived ZIF-EC1(ZnCo)-20-900 exhibits the best activity toward the ORR, which is even better than that of Pt/C. This work demonstrates the potential of using a nonporous dense MOF as a precursor and optimizing electrocatalytic ORR activity by tuning the Co content.