Both high activity and mass production potential are important for bifunctional electrocatalysts for overall water splitting. Catalytic activity enhancement was demonstrated through the formation of CoS2 nanoparticles with mono-phase and extremely porous structures. To fabricate porous structures at the nanometer scale, Co-based metal-organic frameworks (MOFs), namely a cobalt Prussian blue analogue (Co-PBA, Co3[Co(CN)6]2), was used as a porous template for the CoS2. Then, controlled sulfurization annealing converted the Co-PBA to mono-phase CoS2 nanoparticles with ~ 4 nm pores, resulting in a large surface area of 915.6 m2 g−1. The electrocatalysts had high activity for overall water splitting, and the overpotentials of the oxygen evolution reaction and hydrogen evolution reaction under the operating conditions were 298 mV and −196 mV, respectively, at 10 mA cm−2.