PVDF based polymer solid electrolytes are one of the most promising choices for all-solid-state sodium ion batteries and sodium metal batteries. However, neat polymer solid electrolytes suffered from relatively low ionic conductivity at room temperature, narrow electrochemical stability window. In this work, g-C3N4 nanosheets are introduced as a novel nanofiller for PVDF-HFP based composite solid polymer electrolytes. The g-C3N4 filler can engineer the PVDF-HFP structure, resulting in reduced decreased crystallinity. Additionally, the surface atoms of the g-C3N4 interact with groups in the sodium salt, promoting further dissociation of the sodium salt. The incorporation of g-C3N4 improves the electrical properties (ionic conductivity, Na+ transference number and electrochemical window), mechanical properties and thermal stability of the composite electrolyte. The composite electrolyte shows a low Na deposition/dissolution overpotential of about 100 mV at a current density of 1 mA cm− 2 after 160 cycles. The sodium metal battery with g-C3N4 composite electrolyte and NVP cathode exhibits lower polarization voltage (90 mV), and stable reversible capacity of 93 mAh g− 1 after 200 cycles at 1C.