Porous carbon materials derived from ZIF-8 have attracted extensive research attention on account of their large surface area, tunable mesoporosity and abundant nitrogen content. However, directly carbonized ZIF-8 usually suffers from a low electronic conductivity, poor wettability and relatively low mesoporosity, which severely restricts their capacitive performance. Herein, P-doped modified carbon materials derived from ZIF-8 (ZPCs) were synthesized by using nontoxic phytic acid as a phosphorus source, followed by carbonization at high temperature. Benefiting from its relatively high specific surface area of 911.7 m2 g−1 and higher ratio of mesopores, as well as N, O and P doping, ZPC-1000 delivers the largest specific capacity, up to 219.4 F g−1 at 1 A g−1, among the prepared samples and an outstanding cycle span, retaining 100% capacity after 2000 cycles at 5 A g−1. In this work, we highlight the strategy of constructing a synergistic effect between high mesoporosity and heteroatom doping, which can greatly boost the capacitive performance of carbon materials.