The incompatibility between electrolyte ions and electrode pore sizes, coupled with the extensive use of activators and dopants, significantly restricts the fabrication of porous carbon materials. Consequently, developing environmentally sustainable and efficient methodologies that exploit the intrinsic properties and pretreatment of materials to facilitate self-activation and self-doping becomes crucial. In this study, potassium histidine and magnesium histidine molecular salts were synthesized as precursors, enabling specific ion activation and bimetallic template-directed tunable porosity through a one-step carbonization process. Notably, the ratio of bimolecular salts significantly influenced the porous structure of carbon, the properties of heteroatoms, and the electrochemical performance. By optimizing the ratio, the porous carbon materials exhibited high accessibility to electrolyte ions and effective ion/electron transport channels. Consequently, the optimal sample (NOSPC-2) achieved a high specific capacitance of 318 F g