An anode of hard carbon spheres with both small size and a porous structure enables superior electrochemical performance of potassium-ion batteries.