Hard carbons have recently attracted wide interest as anode materials for potassium ion batteries (PIBs) because of their high reversible capacity. But, their high preparation cost and poor cycling stability prevent their practical use. Coconut shell-derived hard carbons (CSHCs) were prepared from waste biomass coconut shell using a one-step carbonization method, and were used as anode materials for potassium ion batteries. The effects of the carbonization temperature on the microstructures and electrochemical properties of the CSHCs were investigated by X-ray diffraction, nitrogen adsorption, Raman spectroscopy, scanning electron microscopy, transmission electron microscopy, and cyclic voltammetry, etc. Results indicate that the CSHC carbonized at 1 000 °C (CSHC-10) has a suitable graphite microcrystal size, pore structure and surface defect content, and has the best electrochemical performance. Specifically, it has a high reversible specific capacity of 254 mAh·g−1 at 30 mA·g−1 with an initial Coulombic efficiency of 75.0%, and the capacity retention rates are 87.5% after 100 cycles and 75.9% after 400 cycles at 100 mA·g−1, demonstrating its excellent potassium storage performance.