This paper reported the facile preparation of pyrolytic carbon derived from spent coffee grounds and the evaluation of its electrochemical performance when used as anode in sodium-ion battery. X-ray diffraction analysis, scanning electron microscope, Brunauer–Emmett–Teller were employed to characterize the structure of pyrolytic carbon. Electrochemical performances were tested by constant current charge–discharge, cyclic voltammetry and electrochemical impedance spectroscopy. Results showed that the pyrolytic carbon possess a porous structure (1–2 μm) and a specific surface area of 94.35 m2 g−1. When used as anodes in sodium-ion batteries, a reversible capacity of 154.2 mA h g−1 at a current density of 200 mA g−1 after 50 cycles was obtained. Several electrolytes were evaluated and their electrochemical performances were compared. The result indicated that this material has excellent storage capacity and good cycling stability. Our method provided a preparation of pyrolytic carbon from environmentally friendly resources.