In this paper, an edge computing system for IoT-based (Internet of Things) smart grids is proposed to overcome the drawbacks in the current cloud computing paradigm in power systems, where many problems have yet to be addressed such as fully realizing the requirements of high bandwidth with low latency. The new system mainly introduces edge computing in the traditional cloud-based power system and establishes a new hardware and software architecture. Therefore, a considerable amount of data generated in the electrical grid will be analyzed, processed, and stored at the edge of the network. Aided with edge computing paradigm, the IoT-based smart grids will realize the connection and management of substantial terminals, provide the real-time analysis and processing of massive data, and foster the digitalization of smart grids. In addition, we propose a privacy protection strategy via edge computing, data prediction strategy, and preprocessing strategy of hierarchical decision-making based on task grading (HDTG) for the IoT-based smart girds. The effectiveness of our proposed approaches has been demonstrated via the numerical simulations.INDEX TERMS Edge computing, IoT-based smart grids, data prediction, artificial intelligence, data privacy protection, cloud computing.